Page MenuHomePhabricator

Non-block figure captions get confused if they contain |
Closed, ResolvedPublic

Description

$ echo '[[File:Foo.jpg|thumb|thecaption]]' | tests/parse.js --normalize=parsoid | sed -e 's/thecaption/|/' | tests/parse.js --html2wt
[[File:Foo.jpg|thumb|<nowiki>|</nowiki>]]

But if you remove "thumb":

$ echo '[[File:Foo.jpg|thecaption]]' | tests/parse.js --normalize=parsoid | sed -e 's/thecaption/|/' | tests/parse.js --html2wt

[[File:Foo.jpg||]]

The caption embedded in the data-mw property is not being properly nowiki-escaped.

Event Timeline

cscott raised the priority of this task from to Medium.
cscott updated the task description. (Show Details)
cscott added a project: Parsoid.
cscott subscribed.

Change 228009 had a related patch set uploaded (by Cscott):
WIP: T107435: Properly escape non-block image captions during WTS.

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

Arlolra claimed this task.
Arlolra subscribed.

This seems fine on master now,

echo '[[File:Foo.jpg|thecaption]]' | node bin/parse.js --normalize=parsoid | sed -e 's/thecaption/|/' | node bin/parse.js --html2wt

[[File:Foo.jpg|<nowiki>|</nowiki>]]