Page MenuHomePhabricator

disallow multiple table captions
Closed, ResolvedPublic

Description

Author: a.d.bergi

Description:
Hello, you can generate more tahn one caption for a table with the wikisyntax
{|

+ caption 1
+ caption 2
}

The problem is, Firefox doesn't show the further captions, just the the first one. It works in other Browsers (IE, Opera), so a page edited by a user with one of these browsers leads to a very different view in Firefox.


Version: unspecified
Severity: major
URL: http://de.wikipedia.org/w/index.php?title=Vorlage:Infobox_Musikalbum/Tabelle&oldid=81115052

Details

Reference
bz25794

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:11 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz25794.
bzimport added a subscriber: Unknown Object (MLST).

a.d.bergi wrote:

Could you please add an error message instead of the second (and following) captions?

If the table has no data, the display is messed up, but, otherwise, multiple captions can be displayed.

http://en.wikipedia.org/wiki/User:MarkAHershberger/Bug_Examples#Bug_25739

a.d.bergi wrote:

No, the invalid (?) table syntax (captions without cells) is not the issue of this bug.
I've addded a third example at your page, which generates a valid table. Firefox, also in version 4, doesn't show the second caption. Users of other browsers should be warned.

alright, the HTML being generated in those two cases is different. When you put it in the wikitable class, actual caption elements are produced. Otherwise, the caption is just stuffed in a <pre> tag.

Strike that. Examples added to my demo. When captions are first they're in a caption element. When captions are last, they are in a <pre> element.

(In reply to comment #5)

When captions are last, they are in a <pre> element.

Make that a <p> element.

The W3C specification states the same, Firefox is correct here.

HTML4 says there may only be one element.

HTML5 is even stricter: it says it must be the first direct child of the table element (which also means there can only be one).

http://www.w3.org/TR/html4/struct/tables.html#h-11.2.2

A TABLE element may only contain one CAPTION element.

http://www.w3.org/TR/html5/tabular-data.html#the-caption-element

As the first element child of a table element.

I understand that it is in the spec. That makes complete sense.

We haven't given the user a warning when they didn't put the caption before the row data -- we just worked around it. Starting to warn when they do something wonky seems bad, too. The only case I'm aware of that we provide warning is in the Cite extension when there is no <references> tag.

Does anyone oppose to stripping any nth>1 caption in the parser?

(In reply to comment #9)

Does anyone oppose to stripping any nth>1 caption in the parser?

That seems fine to me since it would make the mis-placed captions work the same as those placed correctly.

Now, if you're going to strip captions, maybe we can have a look at making captions work the same no matter where they're placed. But that's another bug.

Now, if you're going to strip captions, maybe we can have a look at making
captions work the same no matter where they're placed. But that's another bug.

I actually fixed that when implementing thead&tfoot. Do you have a bug id?

(In reply to comment #11)

Now, if you're going to strip captions, maybe we can have a look at making
captions work the same no matter where they're placed. But that's another bug.

I actually fixed that when implementing thead&tfoot. Do you have a bug id?

No, I would have had to create one. Thanks!