Page MenuHomePhabricator

"|" (pipe) character in any field breaks {{Information}} template and should be replaced with "{{!}}"
Closed, ResolvedPublic

Description

(Split off from T123127)

"|" (pipe) character in any field breaks {{Information}} template and should be replaced with "{{!}}". They are sometimes found in source URLs like " http://www.britishmuseum.org/research/collection_online/collection_object_details.aspx?place=33529&plaA=33529-3-1&ILINK|34484,|assetId=106527001&objectId=282816&partId=1 " or authors add a pipe between their name and the name of some institution they belong to. See example problem file at File:الشيخ عبد الحليم محمود.jpg

Event Timeline

matmarex created this task.Jul 20 2016, 3:06 PM
Restricted Application added subscribers: Zppix, Poyekhali, Steinsplitter and 2 others. · View Herald TranscriptJul 20 2016, 3:06 PM

This is going to be tricky – we should escape pipes in URLs and in plain text, but not in wikitext links or wikitext templates, if any appear in the text. (And should we also try to handle wikitext tables?)

This would be a pretty weird transformation that could confuse experienced users – our input fields would be not exactly wikitext, but not exactly WYSIWYG either. The perfect solution would be to have mini-VisualEditors for each field that allows wikitext (implemented more like in Flow, with on-the-fly switching between visual and wikitext editing). I think we should at least add an ability to preview the file page before submitting.

Jarekt added a subscriber: Jarekt.Jul 20 2016, 3:18 PM

The only time "|" is ok is if it is inside a link [[...|...]] or template {{...|...}}. Otherwise it breaks infobox tables. Most likely cases where they show up:

  1. URLs in the source field
  2. In the author field where someone uses "person name | institution name" format
  3. any field with mismatched [] or {} brackets
Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Jul 20 2016, 9:17 PM

Change 307115 had a related patch set uploaded (by Matthias Mullie):
Replace pipes in input before feeding them into a template

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

In URLs, it could be more interesting to encode the character as %7C.

MarkTraceur closed this task as Resolved.Sep 12 2016, 4:44 PM

Change 307115 merged by jenkins-bot:
Replace pipes in input before feeding them into a template

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