r108031 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108030‎ | r108031 | r108032 >
Date:15:00, 4 January 2012
Author:maxsem
Status:ok
Tags:
Comment:
Follow-up r102160: removed arrows from tooltips
Modified paths:
  • /trunk/extensions/Cite/Cite_body.php (modified) (history)
  • /trunk/extensions/Cite/citeCatTreeParserTests.txt (modified) (history)
  • /trunk/extensions/Cite/citeParserTests.txt (modified) (history)
  • /trunk/extensions/Cite/modules/ext.cite/ext.cite.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite_body.php
@@ -693,20 +693,22 @@
694694 'cite_references_link_one',
695695 $this->referencesKey( $key ),
696696 $this->refKey( $key ),
697 - rtrim( $val, "\n" ) . "\n"
 697+ $this->referenceText( $key, $val )
698698 );
699 - } elseif ( isset( $val['follow'] ) ) {
 699+ }
 700+ $text = $this->referenceText( $key, $val['text'] );
 701+ if ( isset( $val['follow'] ) ) {
700702 return wfMsgForContentNoTrans(
701703 'cite_references_no_link',
702704 $this->referencesKey( $val['follow'] ),
703 - rtrim( $val['text'], "\n" ) . "\n"
 705+ $text
704706 );
705707 } elseif ( $val['text'] == '' ) {
706708 return wfMsgForContentNoTrans(
707709 'cite_references_link_one',
708710 $this->referencesKey( $key ),
709711 $this->refKey( $key, $val['count'] ),
710 - $this->error( 'cite_error_references_no_text', $key, 'noparse' )
 712+ $text
711713 );
712714 }
713715
@@ -716,7 +718,7 @@
717719 $this->referencesKey( $val['key'] ),
718720 # $this->refKey( $val['key'], $val['count'] ),
719721 $this->refKey( $val['key'] ),
720 - ( $val['text'] != '' ? rtrim( $val['text'], "\n" ) . "\n" : $this->error( 'cite_error_references_no_text', $key, 'noparse' ) )
 722+ $text
721723 );
722724 // Standalone named reference, I want to format this like an
723725 // anonymous reference because displaying "1. 1.1 Ref text" is
@@ -728,7 +730,7 @@
729731 $this->referencesKey( $key . "-" . $val['key'] ),
730732 # $this->refKey( $key, $val['count'] ),
731733 $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
733735 );
734736 // Named references with >1 occurrences
735737 } else {
@@ -748,12 +750,25 @@
749751 return wfMsgForContentNoTrans( 'cite_references_link_many',
750752 $this->referencesKey( $key . "-" . $val['key'] ),
751753 $list,
752 - ( $val['text'] != '' ? rtrim( $val['text'], "\n" ) . "\n" : $this->error( 'cite_error_references_no_text', $key, 'noparse' ) )
 754+ $text
753755 );
754756 }
755757 }
756758
757759 /**
 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+ /**
758773 * Generate a numeric backlink given a base number and an
759774 * offset, e.g. $base = 1, $offset = 2; = 1.2
760775 * 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 @@
2424 !! result
2525 <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
2626 </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>
2828 </li></ol>
2929
3030 !! end
@@ -45,7 +45,7 @@
4646 !! result
4747 <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
4848 </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>
5050 </li></ol>
5151
5252 !! end
@@ -59,7 +59,7 @@
6060 !! result
6161 <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
6262 </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>
6464 </li></ol>
6565
6666 !! end
@@ -98,7 +98,7 @@
9999 !! result
100100 <p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
101101 </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>
103103 </li></ol>
104104
105105 !! end
@@ -121,7 +121,7 @@
122122 </div>
123123 </div></li>
124124 </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>
126126 </li></ol>
127127
128128 !! end
@@ -157,7 +157,7 @@
158158 <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
159159 </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
160160 </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>
162162 </li></ol>
163163
164164 !! end
@@ -174,7 +174,7 @@
175175 <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
176176 </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
177177 </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>
179179 </li></ol>
180180
181181 !! end
@@ -191,7 +191,7 @@
192192 <p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
193193 </p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
194194 </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>
196196 </li></ol>
197197
198198 !! end
@@ -209,11 +209,11 @@
210210 <sup id="cite_ref-123test_1-0" class="reference"><a href="#cite_note-123test-1">[2]</a></sup>
211211 <sup id="cite_ref-test123_2-0" class="reference"><a href="#cite_note-test123-2">[3]</a></sup>
212212 </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>
214214 </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>
216216 </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>
218218 </li></ol>
219219
220220 !! end
@@ -246,7 +246,7 @@
247247 parameter "group" is allowed only.
248248 Use <code>&lt;references /&gt;</code>, or <code>&lt;references group="..." /&gt;</code></strong>
249249 </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>
251251 </li>
252252 <li id="cite_note-bar"><a href="#cite_ref-bar_0">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
253253 no text was provided for refs named <code>bar</code></strong></li>
@@ -268,9 +268,9 @@
269269 <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
270270 Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[note 1]</a></sup>
271271 </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>
273273 </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>
275275 </li></ol>
276276
277277 !! end
@@ -289,13 +289,13 @@
290290 </p>
291291 <dl><dt>refs
292292 </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>
294294 </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>
296296 </li></ol>
297297 <dl><dt>notes
298298 </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>
300300 </li></ol>
301301
302302 !! end
@@ -311,7 +311,7 @@
312312 !! result
313313 <p><sup id="cite_ref-foo_0-0" class="reference"><a href="#cite_note-foo-0">[1]</a></sup>
314314 </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>
316316 </li></ol>
317317
318318 !! end
@@ -327,7 +327,7 @@
328328 !! result
329329 <p><sup id="cite_ref-foo_0-0" class="reference"><a href="#cite_note-foo-0">[1]</a></sup>
330330 </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>
332332 </li></ol>
333333
334334 !! end
@@ -369,7 +369,7 @@
370370 !! result
371371 <p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[wa']</a></sup>
372372 </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>
374374 </li></ol>
375375
376376 !! end
@@ -383,9 +383,9 @@
384384 !! result
385385 <p><sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[Note 1]</a></sup>
386386 </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>
388388 </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>
390390 </li></ol>
391391
392392 !! end
Index: trunk/extensions/Cite/modules/ext.cite/ext.cite.js
@@ -2,7 +2,7 @@
33 $( function() {
44 $('.biblio-cite-link,sup.reference a').tooltip({
55 bodyHandler: function() {
6 - return $( '#' + this.hash.substr(1) )
 6+ return $( '#' + this.hash.substr(1) + ' > .reference-text' )
77 .html();
88 },
99 showURL : false
Index: trunk/extensions/Cite/citeCatTreeParserTests.txt
@@ -15,10 +15,11 @@
1616 !! result
1717 <p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
1818 </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&amp;action=edit&amp;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="{&amp;quot;mode&amp;quot;:0,&amp;quot;hideprefix&amp;quot;:20,&amp;quot;showcount&amp;quot;:true,&amp;quot;namespaces&amp;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&amp;action=edit&amp;redlink=1">Articles tagged for deletion and rescue</a>‎ <span title="Contains 0 subcategories, 0 pages, and 0 files" dir="ltr">(empty)</span></div>
2020 <div class="CategoryTreeChildren" style="display:block"><i class="CategoryTreeNotice">no subcategories</i></div></div>
2121 </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>
2324
2425 !! end
2526

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102160Merging ReferenceTooltips into Cite step 2: rename/registermaxsem08:02, 6 November 2011

Status & tagging log