Index: trunk/extensions/Cite/citeParserTests.txt |
— | — | @@ -136,3 +136,51 @@ |
137 | 137 | <p>1337 |
138 | 138 | </p> |
139 | 139 | !! end |
| 140 | + |
| 141 | +!! test |
| 142 | +Blank ref followed by ref with content |
| 143 | +!! input |
| 144 | +<ref name="blank"/> |
| 145 | + |
| 146 | +<ref name="blank">content</ref> |
| 147 | + |
| 148 | +<references/> |
| 149 | +!! result |
| 150 | +<p><sup id="_ref-blank_0" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 151 | +</p><p><sup id="_ref-blank_1" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 152 | +</p> |
| 153 | +<ol class="references"><li id="_note-blank">↑ <a href="#_ref-blank_0" title=""><sup>1.0</sup></a> <a href="#_ref-blank_1" title=""><sup>1.1</sup></a> content</li></ol> |
| 154 | + |
| 155 | +!! end |
| 156 | + |
| 157 | +!! test |
| 158 | +Regression: non-blank ref "0" followed by ref with content |
| 159 | +!! input |
| 160 | +<ref name="blank">0</ref> |
| 161 | + |
| 162 | +<ref name="blank">content</ref> |
| 163 | + |
| 164 | +<references/> |
| 165 | +!! result |
| 166 | +<p><sup id="_ref-blank_0" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 167 | +</p><p><sup id="_ref-blank_1" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 168 | +</p> |
| 169 | +<ol class="references"><li id="_note-blank">↑ <a href="#_ref-blank_0" title=""><sup>1.0</sup></a> <a href="#_ref-blank_1" title=""><sup>1.1</sup></a> 0</li></ol> |
| 170 | + |
| 171 | +!! end |
| 172 | + |
| 173 | +!! test |
| 174 | +Regression sanity check: non-blank ref "1" followed by ref with content |
| 175 | +!! input |
| 176 | +<ref name="blank">1</ref> |
| 177 | + |
| 178 | +<ref name="blank">content</ref> |
| 179 | + |
| 180 | +<references/> |
| 181 | +!! result |
| 182 | +<p><sup id="_ref-blank_0" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 183 | +</p><p><sup id="_ref-blank_1" class="reference"><a href="#_note-blank" title="">[1]</a></sup> |
| 184 | +</p> |
| 185 | +<ol class="references"><li id="_note-blank">↑ <a href="#_ref-blank_0" title=""><sup>1.0</sup></a> <a href="#_ref-blank_1" title=""><sup>1.1</sup></a> 1</li></ol> |
| 186 | + |
| 187 | +!! end |
Index: trunk/extensions/Cite/Cite.php |
— | — | @@ -291,7 +291,7 @@ |
292 | 292 | ); |
293 | 293 | } else { |
294 | 294 | // We've been here before |
295 | | - if ( empty($this->mRefs[$key]['text']) and !empty($str)) { |
| 295 | + if ( $this->mRefs[$key]['text'] === null && $str !== '' ) { |
296 | 296 | // If no text found before, use this text |
297 | 297 | $this->mRefs[$key]['text'] = $str; |
298 | 298 | }; |