Index: trunk/extensions/Cite/Cite_body.php |
— | — | @@ -693,20 +693,22 @@ |
694 | 694 | 'cite_references_link_one', |
695 | 695 | $this->referencesKey( $key ), |
696 | 696 | $this->refKey( $key ), |
697 | | - rtrim( $val, "\n" ) . "\n" |
| 697 | + $this->referenceText( $key, $val ) |
698 | 698 | ); |
699 | | - } elseif ( isset( $val['follow'] ) ) { |
| 699 | + } |
| 700 | + $text = $this->referenceText( $key, $val['text'] ); |
| 701 | + if ( isset( $val['follow'] ) ) { |
700 | 702 | return wfMsgForContentNoTrans( |
701 | 703 | 'cite_references_no_link', |
702 | 704 | $this->referencesKey( $val['follow'] ), |
703 | | - rtrim( $val['text'], "\n" ) . "\n" |
| 705 | + $text |
704 | 706 | ); |
705 | 707 | } elseif ( $val['text'] == '' ) { |
706 | 708 | return wfMsgForContentNoTrans( |
707 | 709 | 'cite_references_link_one', |
708 | 710 | $this->referencesKey( $key ), |
709 | 711 | $this->refKey( $key, $val['count'] ), |
710 | | - $this->error( 'cite_error_references_no_text', $key, 'noparse' ) |
| 712 | + $text |
711 | 713 | ); |
712 | 714 | } |
713 | 715 | |
— | — | @@ -716,7 +718,7 @@ |
717 | 719 | $this->referencesKey( $val['key'] ), |
718 | 720 | # $this->refKey( $val['key'], $val['count'] ), |
719 | 721 | $this->refKey( $val['key'] ), |
720 | | - ( $val['text'] != '' ? rtrim( $val['text'], "\n" ) . "\n" : $this->error( 'cite_error_references_no_text', $key, 'noparse' ) ) |
| 722 | + $text |
721 | 723 | ); |
722 | 724 | // Standalone named reference, I want to format this like an |
723 | 725 | // anonymous reference because displaying "1. 1.1 Ref text" is |
— | — | @@ -728,7 +730,7 @@ |
729 | 731 | $this->referencesKey( $key . "-" . $val['key'] ), |
730 | 732 | # $this->refKey( $key, $val['count'] ), |
731 | 733 | $this->refKey( $key, $val['key'] . "-" . $val['count'] ), |
732 | | - ( $val['text'] != '' ? rtrim( $val['text'], "\n" ) . "\n" : $this->error( 'cite_error_references_no_text', $key, 'noparse' ) ) |
| 734 | + $text |
733 | 735 | ); |
734 | 736 | // Named references with >1 occurrences |
735 | 737 | } else { |
— | — | @@ -748,12 +750,25 @@ |
749 | 751 | return wfMsgForContentNoTrans( 'cite_references_link_many', |
750 | 752 | $this->referencesKey( $key . "-" . $val['key'] ), |
751 | 753 | $list, |
752 | | - ( $val['text'] != '' ? rtrim( $val['text'], "\n" ) . "\n" : $this->error( 'cite_error_references_no_text', $key, 'noparse' ) ) |
| 754 | + $text |
753 | 755 | ); |
754 | 756 | } |
755 | 757 | } |
756 | 758 | |
757 | 759 | /** |
| 760 | + * Returns formatted reference text |
| 761 | + * @param String $key |
| 762 | + * @param String $text |
| 763 | + * @return String |
| 764 | + */ |
| 765 | + function referenceText( $key, $text ) { |
| 766 | + if ( $text == '' ) { |
| 767 | + return $this->error( 'cite_error_references_no_text', $key, 'noparse' ); |
| 768 | + } |
| 769 | + return '<span class="reference-text">' . rtrim( $text, "\n" ) . "</span>\n"; |
| 770 | + } |
| 771 | + |
| 772 | + /** |
758 | 773 | * Generate a numeric backlink given a base number and an |
759 | 774 | * offset, e.g. $base = 1, $offset = 2; = 1.2 |
760 | 775 | * Since bug #5525, it correctly does 1.9 -> 1.10 as well as 1.099 -> 1.100 |
Index: trunk/extensions/Cite/citeParserTests.txt |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | !! result |
25 | 25 | <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
26 | 26 | </p> |
27 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Proceeds of Rockology, vol. XXI |
| 27 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">Proceeds of Rockology, vol. XXI</span> |
28 | 28 | </li></ol> |
29 | 29 | |
30 | 30 | !! end |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | !! result |
47 | 47 | <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
48 | 48 | </p> |
49 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> A <i>simple</i> template. |
| 49 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">A <i>simple</i> template.</span> |
50 | 50 | </li></ol> |
51 | 51 | |
52 | 52 | !! end |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | !! result |
61 | 61 | <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
62 | 62 | </p> |
63 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> {{simple template}} |
| 63 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">{{simple template}}</span> |
64 | 64 | </li></ol> |
65 | 65 | |
66 | 66 | !! end |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | !! result |
100 | 100 | <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
101 | 101 | </p> |
102 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Text |
| 102 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">Text</span> |
103 | 103 | </li></ol> |
104 | 104 | |
105 | 105 | !! end |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | </div> |
123 | 123 | </div></li> |
124 | 124 | </ul> |
125 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> one |
| 125 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">one</span> |
126 | 126 | </li></ol> |
127 | 127 | |
128 | 128 | !! end |
— | — | @@ -157,7 +157,7 @@ |
158 | 158 | <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
159 | 159 | </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
160 | 160 | </p> |
161 | | -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> content |
| 161 | +<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> <span class="reference-text">content</span> |
162 | 162 | </li></ol> |
163 | 163 | |
164 | 164 | !! end |
— | — | @@ -174,7 +174,7 @@ |
175 | 175 | <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
176 | 176 | </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
177 | 177 | </p> |
178 | | -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> 0 |
| 178 | +<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> <span class="reference-text">0</span> |
179 | 179 | </li></ol> |
180 | 180 | |
181 | 181 | !! end |
— | — | @@ -191,7 +191,7 @@ |
192 | 192 | <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
193 | 193 | </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup> |
194 | 194 | </p> |
195 | | -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> 1 |
| 195 | +<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1">1.1</a></sup> <span class="reference-text">1</span> |
196 | 196 | </li></ol> |
197 | 197 | |
198 | 198 | !! end |
— | — | @@ -209,11 +209,11 @@ |
210 | 210 | <sup id="cite_ref-123test_1-0" class="reference"><a href="#cite_note-123test-1">[2]</a></sup> |
211 | 211 | <sup id="cite_ref-test123_2-0" class="reference"><a href="#cite_note-test123-2">[3]</a></sup> |
212 | 212 | </p> |
213 | | -<ol class="references"><li id="cite_note-test123test-0"><a href="#cite_ref-test123test_0-0">↑</a> One |
| 213 | +<ol class="references"><li id="cite_note-test123test-0"><a href="#cite_ref-test123test_0-0">↑</a> <span class="reference-text">One</span> |
214 | 214 | </li> |
215 | | -<li id="cite_note-123test-1"><a href="#cite_ref-123test_1-0">↑</a> Two |
| 215 | +<li id="cite_note-123test-1"><a href="#cite_ref-123test_1-0">↑</a> <span class="reference-text">Two</span> |
216 | 216 | </li> |
217 | | -<li id="cite_note-test123-2"><a href="#cite_ref-test123_2-0">↑</a> Three |
| 217 | +<li id="cite_note-test123-2"><a href="#cite_ref-test123_2-0">↑</a> <span class="reference-text">Three</span> |
218 | 218 | </li></ol> |
219 | 219 | |
220 | 220 | !! end |
— | — | @@ -246,7 +246,7 @@ |
247 | 247 | parameter "group" is allowed only. |
248 | 248 | Use <code><references /></code>, or <code><references group="..." /></code></strong> |
249 | 249 | </p> |
250 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Also zero, but differently! (Normal ref) |
| 250 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">Also zero, but differently! (Normal ref)</span> |
251 | 251 | </li> |
252 | 252 | <li id="cite_note-bar"><a href="#cite_ref-bar_0">↑</a> <strong class="error">Cite error: Invalid <code><ref></code> tag; |
253 | 253 | no text was provided for refs named <code>bar</code></strong></li> |
— | — | @@ -268,9 +268,9 @@ |
269 | 269 | <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
270 | 270 | Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[note 1]</a></sup> |
271 | 271 | </p> |
272 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Proceeds of Rockology, vol. XXI |
| 272 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">Proceeds of Rockology, vol. XXI</span> |
273 | 273 | </li></ol> |
274 | | -<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI |
| 274 | +<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> <span class="reference-text">Proceeds of Rockology, vol. XXI</span> |
275 | 275 | </li></ol> |
276 | 276 | |
277 | 277 | !! end |
— | — | @@ -289,13 +289,13 @@ |
290 | 290 | </p> |
291 | 291 | <dl><dt>refs |
292 | 292 | </dt></dl> |
293 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> ref a |
| 293 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">ref a</span> |
294 | 294 | </li> |
295 | | -<li id="cite_note-2"><a href="#cite_ref-2">↑</a> ref c |
| 295 | +<li id="cite_note-2"><a href="#cite_ref-2">↑</a> <span class="reference-text">ref c</span> |
296 | 296 | </li></ol> |
297 | 297 | <dl><dt>notes |
298 | 298 | </dt></dl> |
299 | | -<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> note b |
| 299 | +<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> <span class="reference-text">note b</span> |
300 | 300 | </li></ol> |
301 | 301 | |
302 | 302 | !! end |
— | — | @@ -311,7 +311,7 @@ |
312 | 312 | !! result |
313 | 313 | <p><sup id="cite_ref-foo_0-0" class="reference"><a href="#cite_note-foo-0">[1]</a></sup> |
314 | 314 | </p> |
315 | | -<ol class="references"><li id="cite_note-foo-0"><a href="#cite_ref-foo_0-0">↑</a> BAR |
| 315 | +<ol class="references"><li id="cite_note-foo-0"><a href="#cite_ref-foo_0-0">↑</a> <span class="reference-text">BAR</span> |
316 | 316 | </li></ol> |
317 | 317 | |
318 | 318 | !! end |
— | — | @@ -327,7 +327,7 @@ |
328 | 328 | !! result |
329 | 329 | <p><sup id="cite_ref-foo_0-0" class="reference"><a href="#cite_note-foo-0">[1]</a></sup> |
330 | 330 | </p> |
331 | | -<ol class="references"><li id="cite_note-foo-0"><a href="#cite_ref-foo_0-0">↑</a> BAR |
| 331 | +<ol class="references"><li id="cite_note-foo-0"><a href="#cite_ref-foo_0-0">↑</a> <span class="reference-text">BAR</span> |
332 | 332 | </li></ol> |
333 | 333 | |
334 | 334 | !! end |
— | — | @@ -369,7 +369,7 @@ |
370 | 370 | !! result |
371 | 371 | <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[wa']</a></sup> |
372 | 372 | </p> |
373 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Proceeds of Rockology, vol. XXI |
| 373 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">Proceeds of Rockology, vol. XXI</span> |
374 | 374 | </li></ol> |
375 | 375 | |
376 | 376 | !! end |
— | — | @@ -383,9 +383,9 @@ |
384 | 384 | !! result |
385 | 385 | <p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[Note 1]</a></sup> |
386 | 386 | </p> |
387 | | -<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> note<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
| 387 | +<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> <span class="reference-text">note<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup></span> |
388 | 388 | </li></ol> |
389 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> reference |
| 389 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">reference</span> |
390 | 390 | </li></ol> |
391 | 391 | |
392 | 392 | !! end |
Index: trunk/extensions/Cite/modules/ext.cite/ext.cite.js |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | $( function() { |
4 | 4 | $('.biblio-cite-link,sup.reference a').tooltip({ |
5 | 5 | bodyHandler: function() { |
6 | | - return $( '#' + this.hash.substr(1) ) |
| 6 | + return $( '#' + this.hash.substr(1) + ' > .reference-text' ) |
7 | 7 | .html(); |
8 | 8 | }, |
9 | 9 | showURL : false |
Index: trunk/extensions/Cite/citeCatTreeParserTests.txt |
— | — | @@ -15,10 +15,11 @@ |
16 | 16 | !! result |
17 | 17 | <p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup> |
18 | 18 | </p> |
19 | | -<div class=" CategoryTreeTag"><div class="CategoryTreeSection"><div class="CategoryTreeItem"><span class="CategoryTreeEmptyBullet">[<b>×</b>] </span> <a class="CategoryTreeLabel CategoryTreeLabelNs14 new CategoryTreeLabelCategory" href="https://www.mediawiki.org/index.php?title=Category:Articles_tagged_for_deletion_and_rescue&action=edit&redlink=1">Articles tagged for deletion and rescue</a> <span title="contains 0 subcategories, 0 pages, and 0 files">(0)</span></div> |
| 19 | +<div class=" CategoryTreeTag" data-ct-mode="0" data-ct-options="{&quot;mode&quot;:0,&quot;hideprefix&quot;:20,&quot;showcount&quot;:true,&quot;namespaces&quot;:false}"><div class="CategoryTreeSection"><div class="CategoryTreeItem"><span class="CategoryTreeEmptyBullet">[<b>×</b>] </span> <a class="CategoryTreeLabel CategoryTreeLabelNs14 new CategoryTreeLabelCategory" href="https://www.mediawiki.org/index.php?title=Category:Articles_tagged_for_deletion_and_rescue&action=edit&redlink=1">Articles tagged for deletion and rescue</a> <span title="Contains 0 subcategories, 0 pages, and 0 files" dir="ltr">(empty)</span></div> |
20 | 20 | <div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">no subcategories</i></div></div> |
21 | 21 | </div> |
22 | | -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> ref</li></ol> |
| 22 | +<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> <span class="reference-text">ref</span> |
| 23 | +</li></ol> |
23 | 24 | |
24 | 25 | !! end |
25 | 26 | |