On Wed, 07 May 2008 21:05:21 +0000, brion wrote:
Revision: 34400 Author: brion Date: 2008-05-07 21:05:21 +0000 (Wed, 07 May 2008)
Log Message:
Revert r34398 for now; near-duplicate of existing tag seems a bit odd to me
I thought there was a wide consensus, both on this list and on wikipedia, that a second tag was wanted even if the behavior was identical to ref, just because it's shorter than <ref group=note>. And to me, it seems neater to have two separate tags than to try and overload another behavior into the existing tag, both in the implementation and in avoiding an interface that looks like you could have references in the same group with different types.
Modified Paths:
trunk/extensions/Cite/Cite.i18n.php trunk/extensions/Cite/Cite.php
Modified: trunk/extensions/Cite/Cite.i18n.php
--- trunk/extensions/Cite/Cite.i18n.php 2008-05-07 21:02:28 UTC (rev 34399) +++ trunk/extensions/Cite/Cite.i18n.php 2008-05-07 21:05:21 UTC (rev 34400) @@ -67,7 +67,6 @@ # Although I could just use # instead of <li> above and nothing here that # will break on input that contains linebreaks 'cite_references_prefix' => '<ol class="references">',
- 'cite_references_prefix_a' => '<ol type="a" class="references">', 'cite_references_suffix' => '</ol>',
);
Modified: trunk/extensions/Cite/Cite.php
--- trunk/extensions/Cite/Cite.php 2008-05-07 21:02:28 UTC (rev 34399) +++ trunk/extensions/Cite/Cite.php 2008-05-07 21:05:21 UTC (rev 34400) @@ -67,7 +67,7 @@ * </code> * * This works because:
* * PHP's datastructures are guaranteed to be returned in the
* * PHP's datastructures are guarenteed to be returned in the
- order that things are inserted into them (unless you mess
- with that)
- User supplied keys can't be integers, therefore avoiding
@@ -82,7 +82,7 @@ * * @var int */
static $mOutCnt = 0;
var $mOutCnt = 0;
var $mGroupCnt = array();
/**
@@ -92,7 +92,7 @@ * * @var int */
static $mInCnt = 0;
var $mInCnt = 0;
/**
- The backlinks, in order, to pass as $3 to
@@ -282,9 +282,9 @@ if ( $key === null ) { // No key //$this->mRefs[$group][] = $str;
$this->mRefs[$group][] = array('count'=>-1, 'text'=>$str, 'key'=>++self::$mOutCnt);
$this->mRefs[$group][] = array('count'=>-1, 'text'=>$str, 'key'=>++$this->mOutCnt);
return $this->linkRef( $group, self::$mInCnt++ );
return $this->linkRef( $group, $this->mInCnt++ ); } else if ( is_string( $key ) ) { // Valid key if ( ! isset( $this->mRefs[$group][$key] ) || ! is_array( $this->mRefs[$group][$key] ) ) {
@@ -292,10 +292,10 @@ $this->mRefs[$group][$key] = array( 'text' => $str, 'count' => 0,
'key' => ++self::$mOutCnt,
'key' => ++$this->mOutCnt, 'number' => ++$this->mGroupCnt[$group] );
self::$mInCnt++;
$this->mInCnt++; return $this->linkRef( $group,
@@ -373,7 +373,7 @@ * * @return string XHTML ready for output */
function referencesFormat($group, $prefix='cite_references_prefix') {
function referencesFormat($group) { if (( count( $this->mRefs ) == 0 ) or (empty( $this->mRefs[$group] ) )) return '';
@@ -383,7 +383,7 @@ foreach ( $this->mRefs[$group] as $k => $v ) $ent[] = $this->referencesFormatEntry( $k, $v );
$prefix = wfMsgForContentNoTrans( $prefix );
$prefix = wfMsgForContentNoTrans( 'cite_references_prefix' ); $suffix = wfMsgForContentNoTrans( 'cite_references_suffix' ); $content = implode( "\n", $ent );
@@ -516,12 +516,6 @@ } }
function refCounterString($counter) {
global $wgContLang;
return $wgContLang->formatNum($counter);
}
- /**
- Return an id for use in wikitext output based on a key and
- optionally the number of it, used in <references>, not <ref>
@@ -570,18 +564,19 @@ * @param int $count The index of the key, used for distinguishing * multiple occurances of the same key * @param int $label The label to use for the link, I want to
* use the same label for all occurances of
* use the same label for all occourances of
*/ function linkRef( $group, $key, $count = null, $label = null, $subkey = '' ) {
the same named reference.
- @return string
global $wgContLang; return $this->parse( wfMsgForContentNoTrans( 'cite_reference_link', $this->refKey( $key, $count ), $this->referencesKey( $key . $subkey ),
(($group == CITE_DEFAULT_GROUP)?'':"$group ").$this->refCounterString( is_null( $label ) ? ++$this->mGroupCnt[$group] : $label )
}(($group == CITE_DEFAULT_GROUP)?'':"$group ").$wgContLang->formatNum( is_null( $label ) ? ++$this->mGroupCnt[$group] : $label ) ) );
@@ -685,8 +680,8 @@ */ function clearState() { $this->mGroupCnt = array();
self::$mOutCnt = -1;
self::$mInCnt = 0;
$this->mOutCnt = -1;
$this->mInCnt = 0; $this->mRefs = array(); return true;
@@ -737,51 +732,7 @@ /**#@-*/ }
- class Note extends Cite
- {
/**
* Constructor
*/
function Note() {
$this->setHooks();
}
/**
* Initialize the parser hooks
*/
function setHooks() {
global $wgParser, $wgHooks;
$wgParser->setHook( 'note' , array( &$this, 'ref' ) );
$wgParser->setHook( 'footnotes' , array( &$this, 'references' ) );
$wgHooks['ParserClearState'][] = array( &$this, 'clearState' );
}
function refCounterString($counter) {
return $this->referencesFormatEntryAlternateBacklinkLabel( $counter-1 );
}
/**
* Make output to be returned from the references() function
*
* @return string XHTML ready for output
*/
function referencesFormat($group, $prefix='cite_references_prefix_a') {
return parent::referencesFormat($group, $prefix);
-}
- }
- new Cite;
- new Note;
}
/**#@-*/
wikitech-l@lists.wikimedia.org