Merge "Remove (revert) expensive parsing of 1-character message"

This commit is contained in:
jenkins-bot 2023-07-25 20:29:47 +00:00 committed by Gerrit Code Review
commit 1732720608
4 changed files with 29 additions and 31 deletions

View file

@ -46,8 +46,8 @@
"cite_reference_backlink_symbol": "↑",
"cite_reference_link": "<sup id=\"$1\" class=\"reference\">[[#$2|&#91;$3&#93;]]</sup>",
"cite_references_no_link": "<p id=\"$1\">$2</p>",
"cite_references_link_one": "<li id=\"$1\"$4><span class=\"mw-cite-backlink\">[[#$2|$5]]</span> $3</li>",
"cite_references_link_many": "<li id=\"$1\"$4><span class=\"mw-cite-backlink\">$5 $2</span> $3</li>",
"cite_references_link_one": "<li id=\"$1\"$4><span class=\"mw-cite-backlink\">[[#$2|]]</span> $3</li>",
"cite_references_link_many": "<li id=\"$1\"$4><span class=\"mw-cite-backlink\"> $2</span> $3</li>",
"cite_references_link_many_format": "<sup>[[#$1|$2]]</sup>",
"cite_references_link_many_format_backlink_labels": "a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv cw cx cy cz da db dc dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv dw dx dy dz ea eb ec ed ee ef eg eh ei ej ek el em en eo ep eq er es et eu ev ew ex ey ez fa fb fc fd fe ff fg fh fi fj fk fl fm fn fo fp fq fr fs ft fu fv fw fx fy fz ga gb gc gd ge gf gg gh gi gj gk gl gm gn go gp gq gr gs gt gu gv gw gx gy gz ha hb hc hd he hf hg hh hi hj hk hl hm hn ho hp hq hr hs ht hu hv hw hx hy hz ia ib ic id ie if ig ih ii ij ik il im in io ip iq ir is it iu iv iw ix iy iz ja jb jc jd je jf jg jh ji jj jk jl jm jn jo jp jq jr js jt ju jv jw jx jy jz ka kb kc kd ke kf kg kh ki kj kk kl km kn ko kp kq kr ks kt ku kv kw kx ky kz la lb lc ld le lf lg lh li lj lk ll lm ln lo lp lq lr ls lt lu lv lw lx ly lz ma mb mc md me mf mg mh mi mj mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nb nc nd ne nf ng nh ni nj nk nl nm nn no np nq nr ns nt nu nv nw nx ny nz oa ob oc od oe of og oh oi oj ok ol om on oo op oq or os ot ou ov ow ox oy oz pa pb pc pd pe pf pg ph pi pj pk pl pm pn po pp pq pr ps pt pu pv pw px py pz qa qb qc qd qe qf qg qh qi qj qk ql qm qn qo qp qq qr qs qt qu qv qw qx qy qz ra rb rc rd re rf rg rh ri rj rk rl rm rn ro rp rq rr rs rt ru rv rw rx ry rz sa sb sc sd se sf sg sh si sj sk sl sm sn so sp sq sr ss st su sv sw sx sy sz ta tb tc td te tf tg th ti tj tk tl tm tn to tp tq tr ts tt tu tv tw tx ty tz ua ub uc ud ue uf ug uh ui uj uk ul um un uo up uq ur us ut uu uv uw ux uy uz va vb vc vd ve vf vg vh vi vj vk vl vm vn vo vp vq vr vs vt vu vv vw vx vy vz wa wb wc wd we wf wg wh wi wj wk wl wm wn wo wp wq wr ws wt wu wv ww wx wy wz xa xb xc xd xe xf xg xh xi xj xk xl xm xn xo xp xq xr xs xt xu xv xw xx xy xz ya yb yc yd ye yf yg yh yi yj yk yl ym yn yo yp yq yr ys yt yu yv yw yx yy yz za zb zc zd ze zf zg zh zi zj zk zl zm zn zo zp zq zr zs zt zu zv zw zx zy zz",
"cite_references_link_many_sep": "&#32;",

View file

@ -50,8 +50,8 @@
"cite_reference_backlink_symbol": "{{optional}}\nSymbol used for the reference section, used to link back to where the reference is used.",
"cite_reference_link": "{{notranslate}}\n\nParameters:\n* $1 - ref key\n* $2 - references key\n* $3 - link label",
"cite_references_no_link": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - reference text",
"cite_references_link_one": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - ref key\n* $3 - reference text\n* $4 - optional CSS class for direction\n* $5 - {{msg-mw|cite_reference_backlink_symbol}}",
"cite_references_link_many": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - list of links\n* $3 - reference text\n* $4 - optional CSS class for direction\n* $5 - {{msg-mw|cite_reference_backlink_symbol}}",
"cite_references_link_one": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - ref key\n* $3 - reference text\n* $4 - optional CSS class for direction",
"cite_references_link_many": "{{notranslate}}\n\nParameters:\n* $1 - references key\n* $2 - list of links\n* $3 - reference text\n* $4 - optional CSS class for direction",
"cite_references_link_many_format": "{{notranslate}}\n\nParameters:\n* $1 - reference key\n* $2 - canonical numeric backlink label for the link, always in the form \"1.2\"\n* $3 - optional alternate backlink label as defined via [[MediaWiki:cite_references_link_many_format_backlink_labels]]",
"cite_references_link_many_format_backlink_labels": "{{Optional}}",
"cite_references_link_many_sep": "{{notranslate}}",

View file

@ -181,8 +181,7 @@ class ReferencesFormatter {
$this->anchorFormatter->getReferencesKey( $id ),
$backlinkId,
$text . $error,
$extraAttributes,
$this->messageLocalizer->msg( 'cite_reference_backlink_symbol' )->parse()
$extraAttributes
)->plain();
}
@ -207,8 +206,7 @@ class ReferencesFormatter {
$this->anchorFormatter->getReferencesKey( $key . '-' . ( $val['key'] ?? '' ) ),
$this->listToText( $backlinks ),
$text . $error,
$extraAttributes,
$this->messageLocalizer->msg( 'cite_reference_backlink_symbol' )->parse()
$extraAttributes
)->plain();
}

View file

@ -68,7 +68,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
],
'<div class="mw-references-wrap"><ol class="references">' . "\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n</ol></div>"
"\n|)</li>\n</ol></div>"
],
'Ref with extends' => [
[
@ -91,11 +91,11 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
],
'<div class="mw-references-wrap"><ol class="references">' . "\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t1</span>' . "\n" .
'||)<ol class="mw-extended-references"><li>(cite_references_link_many|||' .
'<span class="reference-text">t2</span>' . "\n||)</li>\n" .
'|)<ol class="mw-extended-references"><li>(cite_references_link_many|||' .
'<span class="reference-text">t2</span>' . "\n|)</li>\n" .
"</ol></li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t3</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'</ol></div>'
],
'Subref of subref' => [
@ -122,11 +122,11 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
],
'<div class="mw-references-wrap"><ol class="references">' . "\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t3</span>' . "\n" .
'||)<ol class="mw-extended-references"><li>(cite_references_link_many|||' .
'|)<ol class="mw-extended-references"><li>(cite_references_link_many|||' .
'<span class="reference-text">t1 (cite_error_ref_nested_extends|a|b)</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t2</span>' .
"\n||)</li>\n</ol></li>\n" .
"\n|)</li>\n</ol></li>\n" .
'</ol></div>'
],
'Use columns' => [
@ -138,27 +138,27 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
),
'<div class="mw-references-wrap mw-references-columns"><ol class="references">' .
"\n" . '<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n" .
"\n|)</li>\n" .
'<li>(cite_references_link_many|||<span class="reference-text">t</span>' .
"\n||)</li>\n</ol></div>"
"\n|)</li>\n</ol></div>"
],
];
}
@ -241,7 +241,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
[
'text' => 't',
],
'(cite_references_link_many|1-||<span class="reference-text">t</span>' . "\n||)"
'(cite_references_link_many|1-||<span class="reference-text">t</span>' . "\n|)"
],
'With dir' => [
1,
@ -250,7 +250,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'text' => 't',
],
'(cite_references_link_many|1-||<span class="reference-text">t</span>' .
"\n" . '| class="mw-cite-dir-rtl"|)'
"\n" . '| class="mw-cite-dir-rtl")'
],
'Incomplete follow' => [
1,
@ -267,7 +267,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'key' => 5,
'text' => 't',
],
'(cite_references_link_one|1-5|1+5-0|<span class="reference-text">t</span>' . "\n||)"
'(cite_references_link_one|1-5|1+5-0|<span class="reference-text">t</span>' . "\n|)"
],
'Count negative' => [
1,
@ -277,7 +277,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'number' => 3,
'text' => 't',
],
'(cite_references_link_one|5|5+|<span class="reference-text">t</span>' . "\n||)"
'(cite_references_link_one|5|5+|<span class="reference-text">t</span>' . "\n|)"
],
'Count positive' => [
1,
@ -292,7 +292,7 @@ class ReferencesFormatterTest extends \MediaWikiUnitTestCase {
'(cite_references_link_many_sep)(cite_references_link_many_format|1+5-1|3.1|' .
'(cite_error_references_no_backlink_label))(cite_references_link_many_and)' .
'(cite_references_link_many_format|1+5-2|3.2|(cite_error_references_no_backlink_label' .
'))|<span class="reference-text">t</span>' . "\n||)"
'))|<span class="reference-text">t</span>' . "\n|)"
],
];
}