Page MenuHomePhabricator

Escape pipes in select
Closed, ResolvedPublic

Description

I just came across the need to have pipes "|" in my select (because of regex) and realised that this of course breaks the template. I tried escaping them with {{!}} but am still getting an error.

Guessing a post prosessing step is needed to deal with converting this after loading the template.

Event Timeline

JeanFred triaged this task as Medium priority.Nov 6 2019, 9:12 AM

Mentioned in SAL (#wikimedia-cloud) [2019-11-06T09:12:40Z] <wm-bot> <jeanfred> Deploy latest from Git master: 7202182 (T237187)

Looks like my patch was only a partial fix. The harvest and queries work fine but when outputting to the page the {{Property dashboard}} template gets partially overwritten.

Looks like my patch was only a partial fix. The harvest and queries work fine but when outputting to the page the {{Property dashboard}} template gets partially overwritten.

Looks like the regex in pages_processor.py:replace_in_page terminates after the }} of {{!}}.

Should be fixed by using regex_text = f('({{{{{self.template_name}.*?(?<!{{{{!)}}}}).*?({{{{{self.end_template_name}}}}})') per https://regex101.com/r/Nb7sXS/1

Mentioned in SAL (#wikimedia-cloud) [2019-11-21T08:46:15Z] <wm-bot> <jeanfred> Deploy latest from Git master: 2f94256 (T237187)