Page MenuHomePhabricator

Image captions should ignore paragraph tags
Open, LowPublic

Description

Add linebreaks to a caption in wikitext doesn't generate <p> tags, so adding <p> tags shouldn't generate linebreaks.

Currently
...<figcaption><p>FOO</p></figcaption>... -> [[File:Foo.jpg|\nFOO\n]] ->
whereas
[[File:Foo.jpg|\nFOO\n]] -> ...<figcaption>\nFOO\n</figcaption>...

Should be
...<figcaption><p>FOO</p></figcaption>... -> [[File:Foo.jpg|FOO]] ->

The HTML above is generated if the user adds content to an empty caption in VE.

Event Timeline

ssastry triaged this task as Medium priority.

What happens if there are multiple paragraph tags? What is the editor intention there? @Sbailey and I were discussing this and we are going to just run them together with a single space.

This is ignoring the broader discussion we were having today about loosening some restrictions -- that is a different thread to be picked up later.

Change 420615 had a related patch set uploaded (by Sbailey; owner: Sbailey):
[mediawiki/services/parsoid@master] Image captions ignore paragraph tags

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

What happens if there are multiple paragraph tags? What is the editor intention there? @Sbailey and I were discussing this and we are going to just run them together with a single space.

That's fine with us. We're doing our best to prevent users from inputting more than one line at the moment.

Ed, Subbu and I have discussed that for multiple p tags in the caption, we will be replacing the new lines with a single space, merging the captions together. The hope is that the captions would be sentences and that joining them with a space will be a reasonable way to "fix" this situation.

The first submission of the patch just fixes the single case.

Change 420615 merged by jenkins-bot:
[mediawiki/services/parsoid@master] html2wt: Image captions ignore paragraph tags

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

ssastry lowered the priority of this task from Medium to Low.Apr 2 2018, 7:17 PM

The main part of this ticket, as it affects VE, is done now and will be deployed when we push out code next. So, if there is a single p-tag, we handle that properly.

Se could also handle the case more generally to also suppress newlines when there are multiple p-tags. That work is yet to be done. But it is lower priority since VE doesn't introduce multiple p-tags during editing sessions.

Adding a second patch to handle multiple paragraphs being collapsed in a figcaption.

https://gerrit.wikimedia.org/r/#/c/423818/

Change 425726 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/core@master] [WIP] Remove newline stripping from image captions

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

Aklapper added a subscriber: Sbailey.

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)