mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Merge "Sanitize underscores as core does, to not create broken links"
This commit is contained in:
commit
9e981d28b6
|
@ -1080,6 +1080,7 @@ class Cite {
|
|||
*/
|
||||
private function normalizeKey( $key ) {
|
||||
$key = Sanitizer::escapeIdForAttribute( $key );
|
||||
$key = preg_replace( '/__+/', '_', $key );
|
||||
$key = Sanitizer::safeEncodeAttribute( $key );
|
||||
|
||||
return $key;
|
||||
|
|
|
@ -271,6 +271,21 @@ Ref names containing a number
|
|||
|
||||
!! end
|
||||
|
||||
!! test
|
||||
T184912: Consistent normalization of consecutive underscores
|
||||
!! wikitext
|
||||
<ref name="x__x">example</ref>
|
||||
<references />
|
||||
!! html
|
||||
<p><sup id="cite_ref-x_x_1-0" class="reference"><a href="#cite_note-x_x-1">[1]</a></sup>
|
||||
</p>
|
||||
<div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-x_x-1"><span class="mw-cite-backlink"><a href="#cite_ref-x_x_1-0">↑</a></span> <span class="reference-text">example</span>
|
||||
</li>
|
||||
</ol></div>
|
||||
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Erroneous refs
|
||||
!! wikitext
|
||||
|
|
Loading…
Reference in a new issue