* (since otherwise it would link to itself)
*
* @static
@@ -489,23 +548,22 @@ function wfCite() {
* and return XHTML ready for output
*
* @param string $key The key for the link
- * @param int $count The # of the key, used for distinguishing
- * multiple occourances of the same key
+ * @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 occourances of
* the same named reference.
* @return string
*/
- function linkRef( $key, $count = null, $label = null ) {
+ function linkRef( $group, $key, $count = null, $label = null, $subkey = '' ) {
global $wgContLang;
-
return
$this->parse(
wfMsgForContentNoTrans(
'cite_reference_link',
$this->refKey( $key, $count ),
- $this->referencesKey( $key ),
- $wgContLang->formatNum( is_null( $label ) ? ++$this->mOutCnt : $label )
+ $this->referencesKey( $key . $subkey ),
+ (($group == CITE_DEFAULT_GROUP)?'':"$group ").$wgContLang->formatNum( is_null( $label ) ? ++$this->mGroupCnt[$group] : $label )
)
);
}
@@ -608,7 +666,9 @@ function wfCite() {
* want the counts to transcend pages and other instances
*/
function clearState() {
- $this->mOutCnt = $this->mInCnt = 0;
+ $this->mGroupCnt = array();
+ $this->mOutCnt = -1;
+ $this->mInCnt = 0;
$this->mRefs = array();
return true;
diff --git a/citeParserTests.txt b/citeParserTests.txt
index c3193a070..09c940617 100644
--- a/citeParserTests.txt
+++ b/citeParserTests.txt
@@ -149,10 +149,10 @@ Blank ref followed by ref with content
!! result
-[1]
-
[1]
+
[1]
+
[1]
-- ↑ 1.0 1.1 content
+- ↑ 1.0 1.1 content
!! end
@@ -165,10 +165,10 @@ Regression: non-blank ref "0" followed by ref with content
!! result
-[1]
-
[1]
+
[1]
+
[1]
-- ↑ 1.0 1.1 0
+- ↑ 1.0 1.1 0
!! end
@@ -181,10 +181,10 @@ Regression sanity check: non-blank ref "1" followed by ref with content
!! result
-[1]
-
[1]
+
[1]
+
[1]
-- ↑ 1.0 1.1 1
+- ↑ 1.0 1.1 1
!! end
@@ -197,13 +197,13 @@ Ref names containing a number
!! result
-[1]
-[2]
-[3]
+
[1]
+[2]
+[3]
-- ↑ One
-- ↑ Two
-- ↑ Three
+- ↑ One
+- ↑ Two
+- ↑ Three
!! end
@@ -229,8 +229,8 @@ Erroneous refs
Cite error: Invalid <ref>
tag; name cannot be a simple integer, use a descriptive title
[1]
Cite error: Invalid <ref>
tag; refs with no content must have a name
-
[2]
-
[3]
+
[2]
+
[3]
Cite error: Invalid <references>
tag; no input is allowed, use
<references />
Cite error: Invalid <references>
tag; no parameters are allowed, use <references />
@@ -242,3 +242,19 @@ Erroneous refs
!! end
+!! test
+Simple [, with in group
+!! input
+Wikipedia rocks!][Proceeds of Rockology, vol. XXI]
+Wikipedia rocks![Proceeds of Rockology, vol. XXI]
+
+
+
+!! result
+Wikipedia rocks![1]
+Wikipedia rocks![note 1]
+
+- ↑ Proceeds of Rockology, vol. XXI
+- ↑ Proceeds of Rockology, vol. XXI
+
+!! end