Page MenuHomePhabricator

Template inclusion with -{ (minus followed by an opening curly brace) stops parser and prevents inclusion
Open, Needs TriagePublic

Description

We’re currently in the process of upgrading to MW 1.30 (from 1.27) and noticed the following problem: When having a template inclusion and one of the arguments includes a minus followed by an opening curly brace, i.e. -{, the parser just stops interpreting that inclusion completely resulting in the raw wiki output. When any other combination is used, there is no problem. I have yet to test this on a fresh environment with no dependencies but I was able to reproduce this on Wikipedia.

You can simply test this yourself. The following breaks:

{{Test| -{ }}

Whereas the following combinations will work just fine:

{{Test| -} }}
{{Test| - { }}
{{Test| -{{x}} }}
{{Test| {- }}

Event Timeline

Oh, yes, that does help! Or at least it explains what’s going on.

Is there a way to disable this? It is kind of blocking us from upgrading right now, and we have no actual need for this feature.

Also, when the syntax is generally -{ }- isn’t it a bug that the parser chokes on something like {{ -{ }}? Shouldn’t the wiki text parser make sure that the tokens are properly balanced, making {{ -{ }- }} or -{ {{ }} }- valid but not {{ -{ }} }- or -{ {{ }- }}? And shouldn’t it especially look for at least a closing }- somewhere?

Aklapper renamed this task from Template inclusion with minus followed by an opening curly brace stops parser and prevents inclusion to Template inclusion with -{ (minus followed by an opening curly brace) stops parser and prevents inclusion.Aug 12 2019, 10:26 AM
Aklapper added a subscriber: jeblad.

This was an intentional change to make preprocessor behavior more uniform. Just entity-escape the - or the { if you don't want language converter syntax, or wrap the -{ in a <nowiki>. See T54661: Preprocessor/Parser irregularities with -{...}- variant constructs. and T146304: Preprocessor should handle -{...}- variant constructs in template arguments. We had wikilint volunteers fix these issues with out existing content, they can probably help you out with tools if that's helpful. https://www.mediawiki.org/wiki/Parsoid/Language_conversion/Preprocessor_fixups discusses the wikitext fixup process in more detail.

This was an intentional change to make preprocessor behavior more uniform.

Fine. Great to learn this now. Then, please answer the questions I raised in T230318:

  • By which TechNews the affected communities have been informed in advance?
  • On which mw:Help: page the new Wikisyntax has been explained? Translated into which languages?

Furthermore, the page you are quoting tells of an analysis made until mid of 2017. The deployment was not observed in April 2019. Since when LanguageConverter has been deployed to all WMF wikis, by which configuration change?

@PerfektesChaos: Could you explain how T230318 is related to this task and the ones mentioned by cscott? Which "deployment was not observed in April 2019"?

Tech news notifications documented in T165175, which is linked from the page I cited above.

Briefly: https://meta.wikimedia.org/wiki/Tech/News/2017/19 and https://meta.wikimedia.org/wiki/Tech/News/2017/20 although this was a multi-month effort with a lot of community participation.

After linting cleaned up all problematic uses of the -{ syntax the patch was merged into development branch on May 23, 2017 and deployed to production in 1.30.0 wmf.2 on May 25, 2017. MediaWiki version 1.30.0 was released on 12 December 2017.

The change in the handling of -{ is mentioned in https://www.mediawiki.org/wiki/MediaWiki_1.30#Other_changes (and of course in the RELEASE-NOTES-1.30 included in the source code).

Again, LanguageConverter is not being "turned on". The difference is solely in the preprocessor, which for over two years now handles -{/}- brace matching the same way it handles other special brace tokens.

In general, the documentation on the preprocessor is very poor. The only documentation I am aware of was extremely out of date; I added a note warning of its inadequacies in https://www.mediawiki.org/w/index.php?title=Preprocessor_ABNF&type=revision&diff=2622589&oldid=2305066&diffmode=source . Similarly, language converter syntax is not documented at all in the standard Help pages as far as I can tell; the only documentation I am aware of is https://www.mediawiki.org/wiki/Writing_systems/Syntax . Unfortunately, this is not uncommon for wikitext in general: the actual wikitext parser contains quite a number of "magic" features and corner cases that are nowhere documented in Help: pages. It would probably be helpful to add a link to a brief description of language converter syntax to https://www.mediawiki.org/wiki/Help:Formatting#Other_formatting .

Johan subscribed.

(This has already been reported more than once.)