Page MenuHomePhabricator

Serialize empty modified image captions to nothing
Closed, ResolvedPublic

Description

Right now, VE doesn't remove <figcaption> tags even if they are empty, to make it easy for users to go back and forth on types and filling out/removing captions.

However, that seems to result with a redundant pipe in the wikitext on save for images that have and empty caption. So, when the <figcaption> tag is empty, the wikitext still results with a redundant pipe, like:

[[File:image.jpg|left|500x|]]


Version: unspecified
Severity: minor

Details

Reference
bz62264

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:00 AM
bzimport set Reference to bz62264.

This sure seems like a VE bug to me.

Our DOM representation has a way to represent both "empty caption" and "no caption". VE should be using the right one.

Is there actually a use case for 'no caption' for new content being encoded as [[File:Foo.png|thumb|]] vs. [[File:Foo.png|thumb]] ? They seem to render the same: https://www.mediawiki.org/wiki/User:GWicke/Test/EmptyCaption

If this is only about round-tripping then we should just handle that transparently in Parsoid. If the caption is edited we can only serialize it out explicitly if it is non-empty.

We are changing our serialization, but only in the "non-round trip" case.

Change 122577 had a related patch set uploaded by Cscott:
Serialize empty modified image captions to nothing.

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

Change 122577 merged by jenkins-bot:
Serialize empty modified image captions to nothing.

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