diff --git a/Cite_body.php b/Cite_body.php index a53cf7cb9..cf2bd973b 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -63,15 +63,6 @@ class Cite { var $mOutCnt = 0; var $mGroupCnt = array(); - /** - * Internal counter for anonymous references, separate from - * $mOutCnt because anonymous references won't increment it, - * but will incremement $mOutCnt - * - * @var int - */ - var $mInCnt = 0; - /** * Counter to track the total number of (useful) calls to either the * ref or references tag hook @@ -400,7 +391,6 @@ class Cite { 'follow' => $follow ) ) ); array_splice( $this->mRefCallStack, $k, 0, array( array( 'new', $call, $str, $key, $group, $this->mOutCnt ) ) ); - $this->mInCnt++; } // return an empty string : this is not a reference return ''; @@ -411,7 +401,7 @@ class Cite { $this->mRefs[$group][] = array( 'count' => - 1, 'text' => $str, 'key' => ++$this->mOutCnt ); $this->mRefCallStack[] = array( 'new', $call, $str, $key, $group, $this->mOutCnt ); - return $this->linkRef( $group, $this->mInCnt++ ); + return $this->linkRef( $group, $this->mOutCnt ); } elseif ( is_string( $key ) ) { // Valid key if ( !isset( $this->mRefs[$group][$key] ) || !is_array( $this->mRefs[$group][$key] ) ) { @@ -424,7 +414,6 @@ class Cite { ); $this->mRefCallStack[] = array( 'new', $call, $str, $key, $group, $this->mOutCnt ); - $this->mInCnt++; return $this->linkRef( $group, @@ -1057,8 +1046,7 @@ class Cite { } $this->mGroupCnt = array(); - $this->mOutCnt = - 1; - $this->mInCnt = 0; + $this->mOutCnt = 0; $this->mCallCnt = 0; $this->mRefs = array(); $this->mReferencesErrors = array(); diff --git a/citeParserTests.txt b/citeParserTests.txt index a9102d68c..af1ea1cb2 100644 --- a/citeParserTests.txt +++ b/citeParserTests.txt @@ -9,7 +9,7 @@ Simple , no !! input Wikipedia rocks!Proceeds of Rockology, vol. XXI !! result -

Wikipedia rocks![1] +

Wikipedia rocks![1]
Cite error: <ref> tags exist, but no <references/> tag was found

!! end @@ -21,9 +21,9 @@ Wikipedia rocks!Proceeds of Rockology, vol. XXI !! result -

Wikipedia rocks![1] +

Wikipedia rocks![1]

-
  1. Proceeds of Rockology, vol. XXI +
    1. Proceeds of Rockology, vol. XXI
    !! end @@ -43,9 +43,9 @@ Templating{{simple template}} !! result -

    Templating[1] +

    Templating[1]

    -
    1. A simple template. +
      1. A simple template.
      !! end @@ -57,9 +57,9 @@ Templating{{simple template}} !! result -

      Templating[1] +

      Templating[1]

      -
      1. {{simple template}} +
        1. {{simple template}}
        !! end @@ -96,9 +96,9 @@ TemplatingText !! result -

        Templating[1] +

        Templating[1]

        -
        1. Text +
          1. Text
          !! end @@ -112,7 +112,7 @@ TemplatingText !! result -

          [1] +

          [1]

          -
          1. one +
            1. one
            !! end @@ -131,7 +131,7 @@ TemplatingText !! input {{REVISIONID}}elite !! result -

            1337[1] +

            1337[1]
            Cite error: <ref> tags exist, but no <references/> tag was found

            !! end @@ -154,10 +154,10 @@ Blank ref followed by ref with content !! result -

            [1] -

            [1] +

            [1] +

            [1]

            -
            1. 1.0 1.1 content +
              1. 1.0 1.1 content
              !! end @@ -171,10 +171,10 @@ Regression: non-blank ref "0" followed by ref with content !! result -

              [1] -

              [1] +

              [1] +

              [1]

              -
              1. 1.0 1.1 0 +
                1. 1.0 1.1 0
                !! end @@ -188,10 +188,10 @@ Regression sanity check: non-blank ref "1" followed by ref with content !! result -

                [1] -

                [1] +

                [1] +

                [1]

                -
                1. 1.0 1.1 1 +
                  1. 1.0 1.1 1
                  !! end @@ -205,15 +205,15 @@ Ref names containing a number !! result -

                  [1] -[2] -[3] +

                  [1] +[2] +[3]

                  -
                  1. One +
                    1. One
                    2. -
                    3. Two +
                    4. Two
                    5. -
                    6. Three +
                    7. Three
                    !! end @@ -237,16 +237,16 @@ Erroneous refs !! result

                    Cite error: Invalid <ref> tag; name cannot be a simple integer. Use a descriptive title -

                    [1] +

                    [1]

                    Cite error: Invalid <ref> tag; refs with no content must have a name -

                    [2] -

                    [3] +

                    [2] +

                    [3]

                    Cite error: Invalid <references> tag; parameter "group" is allowed only. Use <references />, or <references group="..." />

                    -
                    1. Also zero, but differently! (Normal ref) +
                      1. Also zero, but differently! (Normal ref)
                      2. Cite error: Invalid <ref> tag; no text was provided for refs named bar
                      3. @@ -265,13 +265,13 @@ Wikipedia rocks!Proceeds of Rockology, vol. XXI !! result -

                        Wikipedia rocks![1] -Wikipedia rocks![note 1] +

                        Wikipedia rocks![1] +Wikipedia rocks![note 1]

                        -
                        1. Proceeds of Rockology, vol. XXI -
                        1. Proceeds of Rockology, vol. XXI
                        +
                        1. Proceeds of Rockology, vol. XXI +
                        !! end @@ -285,17 +285,17 @@ AAAref aBBBnote bCCC !! result -

                        AAA[参 1]BBB[注 1]CCC[参 2] +

                        AAA[参 1]BBB[注 1]CCC[参 2]

                        refs
                        -
                        1. ref a +
                          1. ref a
                          2. -
                          3. ref c +
                          4. ref c
                          notes
                          -
                          1. note b +
                            1. note b
                            !! end @@ -309,9 +309,9 @@ AAAref aBBBnote bCCCBAR !! result -

                            [1] +

                            [1]

                            -
                            1. BAR +
                              1. BAR
                              !! end @@ -325,9 +325,9 @@ AAAref aBBBnote bCCCBAR }} !! result -

                              [1] +

                              [1]

                              -
                              1. BAR +
                                1. BAR
                                !! end @@ -344,7 +344,7 @@ AAAref aBBBnote bCCC[2 1] +

                                [2 1]

                                1. Cite error: Invalid <ref> tag; no text was provided for refs named foo
                                @@ -367,9 +367,9 @@ Wikipedia rocks!Proceeds of Rockology, vol. XXI !! result -

                                Wikipedia rocks![wa'] +

                                Wikipedia rocks![wa']

                                -
                                1. Proceeds of Rockology, vol. XXI +
                                  1. Proceeds of Rockology, vol. XXI
                                  !! end @@ -381,11 +381,11 @@ Bug 31374 regression check: nested strip items !! result -

                                  [Note 1] +

                                  [Note 1]

                                  -
                                  1. note[1] +
                                    1. note[1]
                                    -
                                    1. reference +
                                      1. reference
                                      !! end