r49075 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49074‎ | r49075 | r49076 >
Date:14:26, 31 March 2009
Author:simetrical
Status:ok
Tags:
Comment:
Don't add empty title attributes to anchor links

All parser tests updated.
Modified paths:
  • /trunk/extensions/Cite/citeParserTests.txt (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -1454,7 +1454,7 @@
14551455 !! input
14561456 [[%23%3c]][[%23%3e]]
14571457 !! result
1458 -<p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
 1458+<p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
14591459 </p>
14601460 !! end
14611461
@@ -4662,7 +4662,7 @@
46634663 !! input
46644664 <span id="æ: v">byte</span>[[#æ: v|backlink]]
46654665 !! result
4666 -<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
 4666+<p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
46674667 </p>
46684668 !! end
46694669
Index: trunk/phase3/includes/Linker.php
@@ -291,7 +291,10 @@
292292 }
293293
294294 # Get a default title attribute.
295 - if( in_array( 'known', $options ) ) {
 295+ if( $target->getPrefixedText() == '' ) {
 296+ # A link like [[#Foo]]. This used to mean an empty title
 297+ # attribute, but that's silly. Just don't output a title.
 298+ } elseif( in_array( 'known', $options ) ) {
296299 $defaults['title'] = $target->getPrefixedText();
297300 } else {
298301 $defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
Index: trunk/phase3/RELEASE-NOTES
@@ -313,6 +313,7 @@
314314 with <strong> tags, helps with text-based browsers
315315 * (bug 18259) Special:DeletedContributions now also uses
316316 MediaWiki:Sp-contributions-logs for the link to Special:Log
 317+* Don't add empty title="" attributes to links to anchors on the current page
317318
318319 == API changes in 1.15 ==
319320 * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions
Index: trunk/extensions/Cite/citeParserTests.txt
@@ -9,7 +9,7 @@
1010 !! input
1111 Wikipedia rocks!<ref>Proceeds of Rockology, vol. XXI</ref>
1212 !! result
13 -<p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 13+<p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
1414 </p>
1515 <br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
1616 !! end
@@ -21,9 +21,9 @@
2222
2323 <references/>
2424 !! result
25 -<p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 25+<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" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
 27+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
2828
2929 !! end
3030
@@ -42,9 +42,9 @@
4343
4444 <references/>
4545 !! result
46 -<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 46+<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
4747 </p>
48 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> A <i>simple</i> template.</li></ol>
 48+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> A <i>simple</i> template.</li></ol>
4949
5050 !! end
5151
@@ -55,9 +55,9 @@
5656
5757 <references/>
5858 !! result
59 -<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 59+<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
6060 </p>
61 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> {{simple template}}</li></ol>
 61+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> {{simple template}}</li></ol>
6262
6363 !! end
6464
@@ -93,9 +93,9 @@
9494
9595 <references/>
9696 !! result
97 -<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 97+<p>Templating<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
9898 </p>
99 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Text</li></ol>
 99+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Text</li></ol>
100100
101101 !! end
102102
@@ -108,7 +108,7 @@
109109
110110 <references/>
111111 !! result
112 -<p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 112+<p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
113113 </p>
114114 <table class="gallery" cellspacing="0" cellpadding="0">
115115 <tr>
@@ -119,7 +119,7 @@
120120 </div></td>
121121 </tr>
122122 </table>
123 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> one</li></ol>
 123+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> one</li></ol>
124124
125125 !! end
126126
@@ -128,7 +128,7 @@
129129 !! input
130130 {{REVISIONID}}<ref>elite</ref>
131131 !! result
132 -<p>1337<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 132+<p>1337<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
133133 </p>
134134 <br /><strong class="error">Cite error: <code>&lt;ref&gt;</code> tags exist, but no <code>&lt;references/&gt;</code> tag was found</strong>
135135 !! end
@@ -151,10 +151,10 @@
152152
153153 <references/>
154154 !! result
155 -<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
156 -</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
 155+<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
 156+</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
157157 </p>
158 -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> content</li></ol>
 158+<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</li></ol>
159159
160160 !! end
161161
@@ -167,10 +167,10 @@
168168
169169 <references/>
170170 !! result
171 -<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
172 -</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
 171+<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
 172+</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
173173 </p>
174 -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> 0</li></ol>
 174+<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</li></ol>
175175
176176 !! end
177177
@@ -183,10 +183,10 @@
184184
185185 <references/>
186186 !! result
187 -<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
188 -</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0" title="">[1]</a></sup>
 187+<p><sup id="cite_ref-blank_0-0" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
 188+</p><p><sup id="cite_ref-blank_0-1" class="reference"><a href="#cite_note-blank-0">[1]</a></sup>
189189 </p>
190 -<ol class="references"><li id="cite_note-blank-0">↑ <sup><a href="#cite_ref-blank_0-0" title="">1.0</a></sup> <sup><a href="#cite_ref-blank_0-1" title="">1.1</a></sup> 1</li></ol>
 190+<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</li></ol>
191191
192192 !! end
193193
@@ -199,13 +199,13 @@
200200
201201 <references />
202202 !! result
203 -<p><sup id="cite_ref-test123test_0-0" class="reference"><a href="#cite_note-test123test-0" title="">[1]</a></sup>
204 -<sup id="cite_ref-123test_1-0" class="reference"><a href="#cite_note-123test-1" title="">[2]</a></sup>
205 -<sup id="cite_ref-test123_2-0" class="reference"><a href="#cite_note-test123-2" title="">[3]</a></sup>
 203+<p><sup id="cite_ref-test123test_0-0" class="reference"><a href="#cite_note-test123test-0">[1]</a></sup>
 204+<sup id="cite_ref-123test_1-0" class="reference"><a href="#cite_note-123test-1">[2]</a></sup>
 205+<sup id="cite_ref-test123_2-0" class="reference"><a href="#cite_note-test123-2">[3]</a></sup>
206206 </p>
207 -<ol class="references"><li id="cite_note-test123test-0"><a href="#cite_ref-test123test_0-0" title="">↑</a> One</li>
208 -<li id="cite_note-123test-1"><a href="#cite_ref-123test_1-0" title="">↑</a> Two</li>
209 -<li id="cite_note-test123-2"><a href="#cite_ref-test123_2-0" title="">↑</a> Three</li></ol>
 207+<ol class="references"><li id="cite_note-test123test-0"><a href="#cite_ref-test123test_0-0">↑</a> One</li>
 208+<li id="cite_note-123test-1"><a href="#cite_ref-123test_1-0">↑</a> Two</li>
 209+<li id="cite_note-test123-2"><a href="#cite_ref-test123_2-0">↑</a> Three</li></ol>
210210
211211 !! end
212212
@@ -230,21 +230,21 @@
231231 !! result
232232 <p><strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
233233 name cannot be a simple integer. Use a descriptive title</strong>
234 -</p><p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
 234+</p><p><sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
235235 </p><p><strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
236236 refs with no content must have a name</strong>
237 -</p><p><sup id="cite_ref-bar_1-0" class="reference"><a href="#cite_note-bar-1" title="">[2]</a></sup>
238 -</p><p><sup id="cite_ref-blankwithnoreference_2-0" class="reference"><a href="#cite_note-blankwithnoreference-2" title="">[3]</a></sup>
 237+</p><p><sup id="cite_ref-bar_1-0" class="reference"><a href="#cite_note-bar-1">[2]</a></sup>
 238+</p><p><sup id="cite_ref-blankwithnoreference_2-0" class="reference"><a href="#cite_note-blankwithnoreference-2">[3]</a></sup>
239239 </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
240240 no input is allowed. Use <code>&lt;references /&gt;</code></strong>
241241 </p><p><strong class="error">Cite error: Invalid <code>&lt;references&gt;</code> tag;
242242 parameter "group" is allowed only.
243243 Use <code>&lt;references /&gt;</code>, or <code>&lt;references group="…" /&gt;</code></strong>
244244 </p>
245 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Also zero, but differently! (Normal ref)</li>
246 -<li id="cite_note-bar"><a href="#cite_ref-bar_0" title="">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 245+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Also zero, but differently! (Normal ref)</li>
 246+<li id="cite_note-bar"><a href="#cite_ref-bar_0">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
247247 no text was provided for refs named <code>bar</code></strong></li>
248 -<li id="cite_note-blankwithnoreference"><a href="#cite_ref-blankwithnoreference_0" title="">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 248+<li id="cite_note-blankwithnoreference"><a href="#cite_ref-blankwithnoreference_0">↑</a> <strong class="error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
249249 no text was provided for refs named <code>blankwithnoreference</code></strong></li></ol>
250250
251251 !! end
@@ -259,11 +259,11 @@
260260 <references/>
261261 <references group=note/>
262262 !! result
263 -<p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[1]</a></sup>
264 -Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[note 1]</a></sup>
 263+<p>Wikipedia rocks!<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[1]</a></sup>
 264+Wikipedia rocks!<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[note 1]</a></sup>
265265 </p>
266 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
267 -<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1" title="">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
 266+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
 267+<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> Proceeds of Rockology, vol. XXI</li></ol>
268268
269269 !! end
270270
@@ -277,14 +277,14 @@
278278 ;notes
279279 <references group="注" />
280280 !! result
281 -<p>AAA<sup id="cite_ref-0" class="reference"><a href="#cite_note-0" title="">[参 1]</a></sup>BBB<sup id="cite_ref-1" class="reference"><a href="#cite_note-1" title="">[注 1]</a></sup>CCC<sup id="cite_ref-2" class="reference"><a href="#cite_note-2" title="">[参 2]</a></sup>
 281+<p>AAA<sup id="cite_ref-0" class="reference"><a href="#cite_note-0">[参 1]</a></sup>BBB<sup id="cite_ref-1" class="reference"><a href="#cite_note-1">[注 1]</a></sup>CCC<sup id="cite_ref-2" class="reference"><a href="#cite_note-2">[参 2]</a></sup>
282282 </p>
283283 <dl><dt>refs
284284 </dt></dl>
285 -<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0" title="">↑</a> ref a</li>
286 -<li id="cite_note-2"><a href="#cite_ref-2" title="">↑</a> ref c</li></ol>
 285+<ol class="references"><li id="cite_note-0"><a href="#cite_ref-0">↑</a> ref a</li>
 286+<li id="cite_note-2"><a href="#cite_ref-2">↑</a> ref c</li></ol>
287287 <dl><dt>notes
288288 </dt></dl>
289 -<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1" title="">↑</a> note b</li></ol>
 289+<ol class="references"><li id="cite_note-1"><a href="#cite_ref-1">↑</a> note b</li></ol>
290290
291291 !! end

Status & tagging log