Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5224
hiddenrefs.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:22 PM
2014-11-21 22:22:51 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
hiddenrefs.patch
View Options
Index: Cite_body.php
===================================================================
--- Cite_body.php (revision 41257)
+++ Cite_body.php (working copy)
@@ -128,7 +128,7 @@
$this->mParser = $parser;
# The key here is the "name" attribute.
- list($key,$group) = $this->refArg( $argv );
+ list($key,$group,$hidden) = $this->refArg( $argv );
if( $str === '' ) {
# <ref ...></ref>. This construct is always invalid: either
@@ -183,7 +183,7 @@
# fers to an existing one. If it refers to a nonexistent ref,
# we'll figure that out later. Likewise it's definitely valid
# if there's any content, regardless of key.
- return $this->stack( $str, $key, $group );
+ return $this->stack( $str, $key, $group, $hidden );
}
# Not clear how we could get here, but something is probably
@@ -206,8 +206,8 @@
$group = null;
$key = null;
- if ( $cnt > 2 )
- // There should only be one key and one group
+ if ( $cnt > 3 )
+ // There should only be one key and one group and one hidden
return false;
else if ( $cnt >= 1 ) {
if ( isset( $argv['name'] ) ) {
@@ -223,16 +223,23 @@
unset( $argv['group']);
--$cnt;
}
+
+ if ( isset( $argv['hidden'] ) ){
+ if ($argv['hidden']='true') $hidden=true;
+ else $hidden=false;
+ --$cnt;
+ }
+ else $hidden=false;
if ( $cnt == 0)
- return array ($key,$group);
+ return array ($key,$group,$hidden);
else
// Invalid key
- return array(false,false);
+ return array(false,false,false);
}
else
// No key
- return array(null,$group);
+ return array(null,$group,false);
}
/**
@@ -242,7 +249,7 @@
* @param mixed $key Argument to the <ref> tag as returned by $this->refArg()
* @return string
*/
- function stack( $str, $key = null, $group ) {
+ function stack( $str, $key = null, $group, $hidden ) {
if (! isset($this->mRefs[$group]))
$this->mRefs[$group]=array();
if (! isset($this->mGroupCnt[$group]))
@@ -279,14 +286,16 @@
// If no text found before, use this text
$this->mRefs[$group][$key]['text'] = $str;
};
- return
+ if (!$hidden) return
$this->linkRef(
$group,
$key,
$this->mRefs[$group][$key]['key']."-".++$this->mRefs[$group][$key]['count'],
$this->mRefs[$group][$key]['number'],
"-".$this->mRefs[$group][$key]['key']
- ); }
+ );
+ else return '';
+ }
}
else
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4785
Default Alt Text
hiddenrefs.patch (2 KB)
Attached To
Mode
T17724: Allow refs to be hidden
Attached
Detach File
Event Timeline
Log In to Comment