Page MenuHomePhabricator

{{=}} should be a parser function
Closed, ResolvedPublicFeature

Description

{{=}} is very widely used template used for including "=" in template calls. It seems logical to have it added as a parser function after {{!}} was finally made one.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Is there any progress on this?

@Base I'm afraid that I strongly oppose {{eq}} because of the potential confusion with {{edit request}} (are you really willing all wikis to change that to {{edit protected}}?)

{{eq}} was already discussed in the patch, nobody supported that. I'll change the description, because everybody just writes this, but nobody implements the {{=}} into a good patch

Dvorapa renamed this task from {{=}}/{{Eq}} should be a parser function to {{=}} should be a parser function.Feb 27 2018, 6:09 AM
Dvorapa updated the task description. (Show Details)
Dvorapa edited projects, added Patch-Needs-Improvement; removed Patch-For-Review.

@Dvorapa , @siebrand, @MaxSem ,
I have rebased the patch, or basically reapplied the changes since there was some refactoring done over this time. Could you help me with the requirement you had regarding the tests? Having little MW knowledge I wanted to cargo-cult tests for {{!}} but I could not locate those in \MagicVariableTest which is where I assume the tests should be added.

Also, do I need to also create a patch for Parsoid(s)?

Okay, I guess removing a Template:= mock from tests/parser/parserTests.txt does the job. That is also what was done for Template:! but it is just now that I got the gist what it was all about.

So I still have the question about parsoid.

Also if this is going to be merged, do I need to add it to release notes file as well or someone else does it?

Change 193553 merged by jenkins-bot:
[mediawiki/core@master] Adding = as a parser function

https://gerrit.wikimedia.org/r/c/mediawiki/core/ /193553

At least Dutch Wiktionary uses {{=}} for something different entirely. Other projects may be affected too. It looks like the parser function will override local templates. This patch shouldn't be deployed before wikis have been given a warning through Tech News.

Change 609302 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Revert "Adding = as a parser function"

https://gerrit.wikimedia.org/r/609302

Change 609302 merged by jenkins-bot:
[mediawiki/core@master] Revert "Adding = as a parser function"

https://gerrit.wikimedia.org/r/609302

I will investigate other wikis. This may take some time.

Quick update: several other wikis appear to be affected. I'll give more details later.

Central on-wiki discussion at https://meta.wikimedia.org/wiki/Equals_sign_parser_function_template_conflicts.

https://als.wikibooks.org/wiki/ redirects to https://als.wikipedia.org/wiki/Buech:Houptsyte. It looks like alswikibooks is maintained in the "Buech" namespace on alswiki.

https://als.wiktionary.org/wiki/ redirects to https://als.wikipedia.org/wiki/Wort:Houptsyte. It looks like alswiktionary is maintained in the "Wort" namespace on alswiki.

  • Used for a purpose other than an equals sign (15):
  • Page is a redirect (8):
    • dsbwiki (plain "=")
    • frwikisource (other)
    • huwiki (=)
    • hywiki (plain "=")
    • oswiki (plain "=")
    • sahwiki (plain "=")
    • tkwiki (plain "=")
    • vepwiki (plain "=")
  • Plain "=" (282): afwiki, afwiktionary, angwiki, arwikinews, arwiki, arwikiquote, arwikisource, arwikiversity, arwiktionary, arzwiki, astwiki, aswiki, avwiki, azbwiki, azwikibooks, azwiki, banwiki, bawikibooks, bawiki, bclwiki, betawikiversity, bewiki, be_x_oldwiki, bgwiki, bgwikiquote, bgwiktionary, bhwiki, bjnwiki, bnwikibooks, bnwiki, bnwikisource, bnwikivoyage, bnwiktionary, bswiki, bugwiki, cawiki, cawikiquote, cawikisource, cdowiki, cewiki, ckbwiki, cowiki, crhwiki, cswiki, cuwiki, cvwiki, cywiki, dawiki, dawiktionary, dewikisource, dewikiversity, dewiktionary, diqwiki, dtywiki, eewiki, elwiki, elwiktionary, enwikibooks, enwiki, enwikiquote, enwikisource, enwikiversity, enwiktionary, eowiki, eowiktionary, eswikibooks, eswiki, eswikisource, eswikiversity, eswikivoyage, eswiktionary, etwiki, euwiki, fawikibooks, fawikinews, fawiki, fawikiquote, fawikisource, fawikivoyage, fawiktionary, fiwiki, fiwiktionary, fowiki, frpwiki, frwiki, frwikivoyage, frwiktionary, fywiktionary, ganwiki, gawiki, glwiki, gomwiki, gotwiki, guwiki, guwiktionary, hakwiki, hawiki, hewikibooks, hewiki, hewikiquote, hewikivoyage, hewiktionary, hifwiki, hiwikibooks, hiwiki, hiwikiversity, hrwiki, hrwikiquote, htwiki, hywikiquote, hywiktionary, iawikibooks, iawiki, iawiktionary, idwiki, idwiktionary, ilowiki, inhwiki, iowiki, itwikibooks, itwiki, itwikiquote, itwikisource, jawikibooks, jawiki, jawikisource, jawikiversity, jvwiktionary, kabwiki, kawiki, kawiktionary, kkwiki, kmwiki, kmwiktionary, knwiki, koiwiki, kowikibooks, kowiki, kowikisource, kowikiversity, krcwiki, kuwiki, kuwiktionary, kwwiki, kywiki, kywiktionary, ladwiki, lawiki, lawikisource, lawiktionary, lezwiki, lijwiki, lowiki, lrcwiki, ltwiki, lvwiki, lvwiktionary, maiwiki, mdfwiki, metawiki, minwiki, miwiki, mkwiki, mkwiktionary, mlwiki, mlwikisource, mnwiki, mrwiki, mswiki, mswiktionary, mtwiki, mwlwiki, myvwiki, mywiki, mywiktionary, mznwiki, nahwiki, nds_nlwiki, ndswiki, ndswiktionary, newiki, newiktionary, newwiki, nlwikibooks, nlwiki, nnwiki, nowiki, nowiktionary, nsowiki, nywiki, ocwiki, orwiki, orwikisource, pamwiki, pawiki, plwikibooks, plwiki, plwiktionary, pnbwiki, pswiki, ptwikibooks, ptwiki, ptwikisource, ptwikiversity, ptwiktionary, quwiki, rowiki, ruwikibooks, ruwikinews, ruwiki, ruwikiquote, ruwikisource, ruwikiversity, sawiki, scnwiki, scowiki, sdwiki, shwiki, simplewiki, siwikibooks, siwiktionary, skwiki, slwiki, sowiki, specieswiki, sqwiki, srwiki, srwiktionary, suwiki, svwikibooks, svwikinews, svwiki, svwikisource, svwikiversity, svwikivoyage, swwiki, tawiki, tcywiki, tewiki, tewiktionary, tgwiki, tgwiktionary, thwikibooks, thwiki, thwikiquote, thwiktionary, tlwiki, tlwiktionary, trwiki, trwiktionary, tswiki, tswiktionary, tyvwiki, udmwiki, ukwikibooks, ukwiki, ukwikiquote, ukwikisource, ukwikivoyage, urwikibooks, urwiki, uzwiki, uzwiktionary, viwikibooks, viwiki, viwikisource, warwiki, wawiki, wowiki, wuuwiki, wikidatawiki, xmfwiki, yiwiki, zh_classicalwiki, zh_min_nanwiki, zhwikibooks, zhwiki, zhwikiquote, zhwikiversity, zhwikivoyage, zhwiktionary, zh_yuewiki
  • Plain "=" in nowiki tags (12): bmwiki, brwiki, commonswiki, crwiki, dewikivoyage, elwikisource, frwikibooks, frwikinews, frwikiversity, gagwiki, itwikivoyage, pcdwiki
  • = (10): chwiki, gdwiki, gdwiktionary, gvwiki, jvwiki, siwiki, svwiktionary, tawikibooks, yowiki, zhwikisource
  • = (1): wawiktionary
  • Template does not exist (364): abwiki, acewiki, adywiki, afwikibooks, afwikiquote, akwiki, alswiki, amwiki, amwiktionary, angwiktionary, anwiki, anwiktionary, arcwiki, arwikibooks, astwiktionary, atjwiki, aywiki, aywiktionary, azwiktionary, barwiki, bat_smgwiki, bewikibooks, bewikiquote, bgwikibooks, bgwikinews, biwiki, bowiki, bowiktionary, bpywiki, brwikiquote, brwikisource, brwiktionary, bswikibooks, bswikinews, bswikiquote, bswikisource, bswiktionary, bxrwiki, cawikibooks, cawikinews, cawiktionary, cbk_zamwiki, cebwiki, chrwiki, chrwiktionary, chywiki, cowiktionary, csbwiki, csbwiktionary, cswikibooks, cswikinews, cswikiquote, cswikisource, cswikiversity, cswiktionary, cvwikibooks, cywikibooks, cywikiquote, cywikisource, cywiktionary, dawikibooks, dawikiquote, dawikisource, dewikibooks, dewikinews, dewiki, dewikiquote, dinwiki, dvwiktionary, dzwiki, elwikibooks, elwikinews, elwikiquote, elwikiversity, elwikivoyage, emlwiki, enwikivoyage, eowikibooks, eowikiquote, eswikinews, eswikiquote, etwikibooks, etwiktionary, euwikibooks, euwikiquote, euwikisource, euwiktionary, extwiki, ffwiki, fiu_vrowiki, fiwikibooks, fiwikinews, fiwikiquote, fiwikisource, fiwikiversity, fiwikivoyage, fjwiki, fjwiktionary, fowiktionary, frrwiki, frwikiquote, furwiki, fywikibooks, fywiki, gawiktionary, glkwiki, glwikibooks, glwikisource, glwiktionary, gnwiki, gnwiktionary, gorwiki, guwikiquote, gvwiktionary, hawiktionary, hawwiki, hewikinews, hiwikivoyage, hiwiktionary, hrwikibooks, hrwikisource, hrwiktionary, hsbwiki, huwikinews, huwikiquote, hywikibooks, hywikisource, idwikibooks, idwikiquote, idwikisource, iewiki, iewiktionary, igwiki, ikwiki, ikwiktionary, iowiktionary, iswikibooks, iswiki, iswikiquote, iswikisource, iswiktionary, itwikinews, itwikiversity, itwiktionary, iuwiki, iuwiktionary, jamwiki, jawikinews, jawikiquote, jbowiki, kaawiki, kawikibooks, kawikiquote, kbdwiki, kbpwiki, kgwiki, kiwiki, kkwikibooks, kkwiktionary, klwiki, klwiktionary, kmwikibooks, knwiktionary, kowikinews, kowikiquote, kowiktionary, kshwiki, kswiki, kswiktionary, kuwikibooks, kuwikiquote, kvwiki, kwwiktionary, kywikibooks, lawikibooks, lawikiquote, lbewiki, lbwiki, lbwikiquote, lbwiktionary, lfnwiki, lgwiki, liwiki, liwikiquote, liwikisource, liwiktionary, lmowiki, lnwiki, lnwiktionary, lowiktionary, ltgwiki, ltwikibooks, ltwikiquote, ltwikisource, ltwiktionary, map_bmswiki, mgwikibooks, mgwiki, mgwiktionary, mhrwiki, miwiktionary, mkwikibooks, mlwikibooks, mlwikiquote, mlwiktionary, mnwiktionary, mrjwiki, mrwikibooks, mrwikiquote, mrwiktionary, mswikibooks, mtwiktionary, nahwiktionary, napwiki, nawiki, nawiktionary, nowikibooks, nowikiquote, newikibooks, nlwikinews, nlwikiquote, nlwikisource, nlwikivoyage, nnwiktionary, novwiki, nowikinews, nrmwiki, ocwikibooks, ocwiktionary, olowiki, omwiki, omwiktionary, pagwiki, papwiki, pawikibooks, pawikisource, pawiktionary, pdcwiki, pflwiki, pihwiki, piwiki, plwikinews, plwikiquote, plwikisource, plwikivoyage, pmswiki, pmswikisource, pnbwiktionary, pntwiki, pswikivoyage, pswiktionary, ptwikinews, ptwikiquote, ptwikivoyage, quwiktionary, rmwiki, rmywiki, rnwiki, roa_rupwiki, roa_rupwiktionary, roa_tarawiki, rowikibooks, rowikinews, rowikiquote, rowikisource, rowikivoyage, rowiktionary, ruewiki, ruwikivoyage, rwwiki, rwwiktionary, sahwikiquote, sawikiquote, sawiktionary, scnwiktionary, scwiki, sdwikinews, sdwiktionary, sewiki, sgwiki, sgwiktionary, shwiktionary, simplewiktionary, skwikibooks, skwikiquote, skwikisource, skwiktionary, slwikibooks, slwikiquote, slwikisource, slwikiversity, slwiktionary, smwiki, smwiktionary, snwiki, sowiktionary, sqwikinews, sqwiktionary, srnwiki, srwikibooks, srwikinews, srwikiquote, srwikisource, sswiki, sswiktionary, stqwiki, stwiki, stwiktionary, suwiktionary, svwikiquote, swwiktionary, szlwiki, tawikinews, tawikiquote, tawiktionary, tetwiki, tewikibooks, tgwikibooks, thwikinews, thwikisource, tiwiki, tiwiktionary, tkwiktionary, tlwikibooks, tnwiki, tnwiktionary, towiki, tpiwiki, tpiwiktionary, trwikibooks, trwikinews, trwikiquote, trwikisource, ttwikibooks, ttwiktionary, tumwiki, twwiki, tywiki, ugwiki, ugwiktionary, ukwikinews, urwikiquote, urwiktionary, vecwiki, vewiki, viwikivoyage, viwiktionary, vlswiki, vowikibooks, vowiki, vowiktionary, wowiktionary, xalwiki, xhwiki, yiwikisource, yiwiktionary, yuewiktionary, zawiki, zawiktionary, zeawiki, zh_min_nanwiktionary, zhwikinews, zuwiki, zuwiktionary

This is unacceptable to ruwiktionary! Please make it configurable.

Fixed ttwiki, it was meant to be = and several articles were broken because of an extra line break.

There definitively should be a parser function for this, but perhaps we have to investigate more about its name

Base removed Base as the assignee of this task.Jul 11 2020, 5:50 PM

If what we come up with is an opt-outable parser function, then I do not have enough experience to do it, please pick this up, someone. (I am open to be taught too :) )

If what we come up with is an opt-outable parser function, then I do not have enough experience to do it, please pick this up, someone. (I am open to be taught too :) )

I don't know about that. We are making good progress in getting the template renamed or adjusted in affected projects. However, MediaWiki isn't just used by the WMF. I think in the upgrade script (part of MediaWiki installer) a check should be added for the existence of this template, and throw an error and/or offer renaming the template (or disabling the feature) if it exists.

We've discussed this on the parsing team and @cscott will chime in more, but just to get this out early while you are all discussing this here and other forums, we definitely will not support wiki-specific configuration for a parser function. So, that means: if you want {{=}} as a parser function, all wikis will get it. There will not be an option to opt out.

We've discussed this on the parsing team and @cscott will chime in more, but just to get this out early while you are all discussing this here and other forums, we definitely will not support wiki-specific configuration for a parser function. So, that means: if you want {{=}} as a parser function, all wikis will get it. There will not be an option to opt out.

I think that's sane. There are only three WMF projects left that use {{=}} for something else. ukwiktionary is now expected to rename soon (possibly today or tomorrow, depends on when Ahonc responds), sourceswiki will rename it (just pondering over what the new name shall be) leaving just ruwiktionary. I'll ask them again to rename it. If push comes to shove, {{=}} could be replaced with {{Template:=}} in their usage. I don't expect it to come to that though.

Can you and/or @cscott consider the upgrade script for non-WMF wikis?

Can you and/or @cscott consider the upgrade script for non-WMF wikis?

We never created any such script for {{!}}, we just mentioned in it the release notes. I agree that it would be good to have but I wouldn't consider it a blocker.

Can you and/or @cscott consider the upgrade script for non-WMF wikis?

We never created any such script for {{!}}, we just mentioned in it the release notes. I agree that it would be good to have but I wouldn't consider it a blocker.

At least make sure it will be mentioned, and include a a warning. There is no way to search for this. Here are some non-WMF wikis that use Template:= to insert an equal sign:

It's not hard to imagine that there will be some out there using Template:= for something different. And the wikiverse is probably a lot bigger today than it was back when {{!}} was added.

Change 617246 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Tracking category and parser warning for deprecated uses of {{=}}

https://gerrit.wikimedia.org/r/617246

Uploaded a patch to add a tracking category in the next release for anything using Template:=. Then we'd add the parser function to the release after that one, after giving third-party wikis a release cycle's warning time.

We've discussed this on the parsing team and @cscott will chime in more, but just to get this out early while you are all discussing this here and other forums, we definitely will not support wiki-specific configuration for a parser function. So, that means: if you want {{=}} as a parser function, all wikis will get it. There will not be an option to opt out.

To elaborate, briefly: the point of adding {{=}} as a parser function is to allow it to be used as an automatic/reliable escape mechanisms for = characters in template arguments, in a similar way to how {{!}} is used to escape |. It can't be used as a reliable escape mechanism if it is configurable per-site. There are alternative mechanisms, for example using a numeric parameter name, or using heredoc escaping (T114432). If you need to code an alternative in the case where {{=}} is disabled on the site, then you may as well use the alternative in all cases and the motivation for adding {{=}} is reduced.

I don't understand why not use the sequence {{{|=}}} for this case.

Can {{=}} be parsed as an equal sign only if it has no parameters?

I don't understand why not use the sequence {{{|=}}} for this case.

The syntax {{=}} mirrors the syntax {{!}} already used for the pipe magic word. The syntax {{{|}}} isn't used for anything, and IMO is too confusing given triple curly braces are used for parameters.

Can {{=}} be parsed as an equal sign only if it has no parameters?

If a magic word doesn't support parameters (as is the case for {{!}} and will be the case for {{=}}), it just ignores any parameters passed in.

There are many similar templates {{(!}}, {{!)}}, {{!!}} . Why did you choose this one?

I don't understand why not use the sequence {{{|=}}} for this case.

The syntax {{=}} mirrors the syntax {{!}} already used for the pipe magic word. The syntax {{{|}}} isn't used for anything, and IMO is too confusing given triple curly braces are used for parameters.

This sequence is already working. No changes required.

Change 617246 merged by jenkins-bot:
[mediawiki/core@master] Tracking category and parser warning for deprecated uses of {{=}}

https://gerrit.wikimedia.org/r/617246

There are many similar templates {{(!}}, {{!)}}, {{!!}} . Why did you choose this one?

(When {{!}} was implemented there was a mention that it is better to do the other ones one by one. In any case when I created this task I wanted it to be an easy first task for myself, and it kinda was before it became more complicated :) )

Can {{=}} be parsed as an equal sign only if it has no parameters?

If a magic word doesn't support parameters (as is the case for {{!}} and will be the case for {{=}}), it just ignores any parameters passed in.

This is not true; the wikitext {{!|foo}} transcludes the template Template:! rather than being evaluated as a magic word. Assuming the {{=}} magic word behaves the same way, there will be a need to go through the list of remaining transclusions for Template:= after implementing the magic word, and remove any parameters that are passed. Only then can Template:= be removed (or replaced with a link to the magic word documentation, etc).

Ruwiktionary has changed existing usage to {{t:=}}, explicitly calling the template. That was the last wiki on the list.

Change 791685 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] Add {{=}} as a built-in magic word

https://gerrit.wikimedia.org/r/791685

@AlexisJazz: Please either check the comment added right before your last comment, or ask a more specific question. Thanks a lot.

@AlexisJazz: Please either check the comment added right before your last comment, or ask a more specific question. Thanks a lot.

I thought the patch set comment was old. Misread or overlooked the date. (maybe because Phabricator omits the year for the current year, not sure) I'm not sure that comment was even what brought me here, I was going over some old stuff so it could be a coincidence.

Change 791685 merged by jenkins-bot:

[mediawiki/core@master] Add {{=}} as a built-in magic word

https://gerrit.wikimedia.org/r/791685

Re: Tech News - What wording would you suggest as the content, and When should it be included? Thanks! (The deadline for entries in the next edition, is ~24 hours from now)

Re: Tech News - What wording would you suggest as the content, and When should it be included? Thanks! (The deadline for entries in the next edition, is ~24 hours from now)

https://meta.wikimedia.org/w/index.php?title=Tech/News/2022/22&diff=23333633&oldid=23333585

I don't know when the magic word will become available on production, so if anyone knows that they could maybe add that info.

Since the Gerrit change has been merged, it should be available with the next train, i.e. May 31 – June 2 (depending on the wiki). I moved the Tech News entry to Changes later this week.

Tacsipacsi changed the subtype of this task from "Task" to "Feature Request".May 26 2022, 11:05 PM
Tacsipacsi removed a project: Patch-For-Review.

@AlexisJazz thanks, the tech news entry looks good. I'd probably add another sentence or two mentioning that this has been "in process" since July 2020 (maybe link to the previous tech news entries) and giving credit to the many editors who helped make this happen: https://meta.wikimedia.org/wiki/Equals_sign_parser_function_template_conflicts

@AlexisJazz thanks, the tech news entry looks good. I'd probably add another sentence or two mentioning that this has been "in process" since July 2020 (maybe link to the previous tech news entries) and giving credit to the many editors who helped make this happen: https://meta.wikimedia.org/wiki/Equals_sign_parser_function_template_conflicts

Tech News was delivered last Monday so it's slightly too late for corrections. I considered linking the page (I created it and guided it, I have 15000 edits on nvwiki now!) but Tech News is typically very concise so I figured that would get scrapped anyway.

Frostly assigned this task to cscott.
Frostly added a subscriber: Frostly.

Deployed on all Wikimedia wikis; verified on testwiki.