Add {{=}} as a built-in magic word

This is a replay of 4bc0dc348a, which
was reverted in 9bd4fc0ae9 due to unexpected
use on Dutch Wiktionary.  In 1.36 deprecation warnings and a tracking
category were added if a wiki defined [[Template:=]] to expand to
anything other than `=` (see aeb3f45c20).
This patch follows up that deprecation by finally defining `{{=}}` as
a built-in, since the last usage on deployed wikis was cleaned up
sometime around February 2021 (list at
https://meta.wikimedia.org/wiki/Equals_sign_parser_function_template_conflicts
).

We've left the tracking category defined for now, so that any remaining
pages left in the tracking category on third-party wikis still retain
localized category documentation.  But it is expected that the next MW
release will also remove the tracking category.

Bug: T91154
Change-Id: I4717172f1d74d326212d51015a6cd87c3758f30d
This commit is contained in:
C. Scott Ananian 2022-05-13 17:10:28 -04:00
parent 69dfd13bae
commit cf52f646bb
6 changed files with 22 additions and 13 deletions

View file

@ -52,6 +52,11 @@ For notes on 1.38.x and older releases, see HISTORY.
* Administrators now have the option to delete/undelete the associated "Talk"
page when they are (un)deleting a given page. `deletetalk` and `undeletetalk`
options were added to the 'delete' and 'undelete' action APIs in MW 1.38.
* `{{=}}` is now a wikitext built-in magic word, expanding to `=`. This is
conventionally used as an escape mechanism to allow the use of `=` in
unnamed template arguments. Defining [[Template:=]] to expand to something
other than `=` has been deprecated since 1.36, with affected pages put into
a special tracking category for migration.
* …
=== New developer features in 1.39 ===

View file

@ -43,6 +43,7 @@ class MagicWordFactory {
/** @var string[] */
private $mVariableIDs = [
'!',
'=',
'currentmonth',
'currentmonth1',
'currentmonthname',

View file

@ -73,6 +73,9 @@ class TrackingCategories {
'post-expand-template-argument-category',
'post-expand-template-inclusion-category',
'restricted-displaytitle-ignored',
# template-equals-category is unused in MW>=1.39, but the category
# can be left around for a major release or so for an easier
# transition for anyone who didn't do the cleanup. T91154
'template-equals-category',
'template-loop-category',
'unstrip-depth-category',

View file

@ -64,6 +64,8 @@ class CoreMagicVariables {
switch ( $id ) {
case '!':
return '|';
case '=':
return '=';
case 'currentmonth':
return $pageLang->formatNumNoSeparators( $ts->format( 'm' ) );
case 'currentmonth1':

View file

@ -210,6 +210,7 @@ $bookstoreList = [
$magicWords = [
# ID CASE SYNONYMS
'!' => [ 1, '!' ],
'=' => [ 1, '=' ],
'anchorencode' => [ 0, 'ANCHORENCODE' ],
'articlepath' => [ 0, 'ARTICLEPATH' ],
'basepagename' => [ 1, 'BASEPAGENAME' ],

View file

@ -5,26 +5,23 @@ Template:=
no
!! endarticle
# {{=}} will be converted to a parser function which expands to `=`
# If you have it defined as a Template that expands to something other
# than `=` that will generate a warning and a tracking category, although
# referencing the template explicitly as {{Template:=}} is fine
# {{=}} is a parser function which expands to `=`, although
# referencing a template explicitly as {{Template:=}} is fine
# regardless of what it expands to. (T91154)
!! test
Using {{=}} when that doesn't expand to "=" should create a tracking category
!! options
cat
Basic usage of {{=}}
!! wikitext
This uses {{=}}.
!! html/php
cat=Pages_which_use_=_as_a_template sort=
!! html
<p>This uses =.
</p>
!! end
!! test
Using {{Template:=}} shouldn't create tracking category regardless of definition
!! options
cat
Using {{Template:=}} doesn't invoke the parser function
!! wikitext
This uses {{Template:=}}.
!! html/php
!! html
<p>This uses no.
</p>
!! end