Page MenuHomePhabricator

Multiline headers don't show in TOC
Closed, ResolvedPublic

Description

Author: jlegras

Description:
I have found a very strange formatting problem. I can work around it, but
there might be a better solution?

If I use the following heading in a Wiki Page:

<table width="100%" cellpadding="2" cellspacing="5" style="vertical-
align:top;background-color:#f5fffa">
<tr>
<th><h2 style="margin:0;background-color:#cef2e0;font-size:120%;font-
weight:bold;border:1px solid #a3bfb1;text-align:left;color:#000;padding:0.2em 
0.4em;">Example Table</h2>
</th></tr>
<tr>
<td style="color:#000"><div style="float:left;margin-right:0.9em">
<p>
=== Introduction ===
=== Overview ===
=== More Detail ===
=== Even More Detail ===
=== Summary ===
</p>

But if I use the following:

<table width="100%" cellpadding="2" cellspacing="5" style="vertical-
align:top;background-color:#f5fffa">
<tr>
<th><h2 style="margin:0;background-color:#cef2e0;font-size:120%;font-
weight:bold;border:1px solid #a3bfb1;text-align:left;color:#000;padding:0.2em 
0.4em;">Example
 Table</h2>
</th></tr>
<tr>
<td style="color:#000"><div style="float:left;margin-right:0.9em">
<p>
=== Introduction ===
=== Overview ===
=== More Detail ===
=== Even More Detail ===
=== Summary ===
</p>

The only difference is that the text for "Example Table" is split over two
lines, but it completely changes the location of the contents table. I
actually want the effect of the second example.

Is this a feature or a bug (or just me not understanding something)?


Version: unspecified
Severity: minor

Details

Reference
bz9760

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 9:37 PM
bzimport set Reference to bz9760.
bzimport added a subscriber: Unknown Object (MLST).

First, your code has some html errors: unclosed div, <h2> into <p>

Second, this can be shortened to
<table width="100%" style="background-color:#f5fffa"><tr>
<th><h2>Example
Table</h2></th></tr>
<tr><td>

Introduction

Overview

More Detail

Even More Detail

</td></tr></table>

Third, the problem has nothing to do with the tables. (though they help to
visualize).
Multiline titles doesn't appear on TOC. There's is no problem when they're
wiki-titles because == on different lines doesn't make a title, but when you use
html titles, there is.

Parsertest fror bug 9760

Attaching parsertest. Updating summary.

Attached:

ayg wrote:

How do we want to handle this anyway? <br /> is allowed in headers, but note
that elements like <p> seem not to be (if I'm reading the XHTML DTD right). I
guess we should just compress whitespace for TOC display?

Yes, we would change them into spaces. Or maybe into <br />s :P

Note however that this is not the reported problem. <h2>AAA\nBBB</h2> has the
same html output as <h2>AAA BBB</h2>. Thus it should work the same for the TOC.

*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*

audreyt wrote:

Hi Platonides, thank you for working on this bug!

As you may already know, MediaWiki is currently revamping its PHP-based parser
into a "Parsoid" prototype component, to support the rich-text Visual Editor
project:

https://www.mediawiki.org/wiki/Parsoid
https://www.mediawiki.org/wiki/Visual_editor

Folks interested in enhancing the parser's capabilities are very much welcome
to join the Parsoid project, and contribute patches as Git branches:

https://www.mediawiki.org/wiki/Git/Tutorial#How_to_submit_a_patch

Compared to .diff attachments in Bugzilla tickets, Git branches are much easier
for us to review, refine and merge features together.

Each change set has a distinct URL generated by the "git review" tool, which
can be referenced in Bugzilla by pasting its gerrit.wikimedia.org URL as a
comment.

If you run into any issues with the patch process, please feel free to ask on
irc.freenode.net #wikimedia-dev and the wikitext-l mailing list. Thank you!

Hi audrey,
May I ask who you are and why are you pasting this template on multiple bugs?
(Your only bugzilla contribution, on 14 parser related bugs, even when they have little relationship with the Visual editor)

On a bright note I hope that "are much easier for us to review" means you're volunteering to do that :)

audreyt wrote:

Hi Platonides. I'm 唐鳳, aka Audrey Tang:

https://www.mediawiki.org/wiki/User:Au
http://linkedin.com/in/tangaudrey
http://pugs.blogs.com/

Recently I've started volunteering for the VE/Parsoid projects, and you're indeed correct that I've registered a Bugzilla account for the explicit purpose of sending this form letter to all parser bugs with patches attached, at the behest of Sumana, in an effort to encourage people signing up to Gerrit, and hopefully bring their patches to Parsoid where it makes sense.

I tried to triage them and send only to bugs that seems pertinent, but due to my inexperience, there may still be a bit of false positives -- e.g. this bug only pertains to parser tests and might indeed be unrelated to Parsoid.

My sincere apologies for the spamming -- it won't happen again anytime soon. :-)

As for review, I've just started reviewing and +1'ing Gerrit change sets as I can, however as I'm relatively new to the parser codebase, I'd be happy to defer to more seasoned devs for the actual merge & approval.

The two examples given in the description render the same for me these days. This might be resolved?

Per previous comment