Page MenuHomePhabricator

Unavoidable <p> in multiline table cells
Open, LowPublic

Description

Author: qleah

Description:
Mediawiki automatically adds a <p> at the first line break in a table cell. The
following code produces the unintuitive result shown at the referenced URL.

{| style="border: 1px solid #aaa"
|-
| a
b<br>
c
d
|-
|}

Intuitively, "b" should be on the same line as "a", just like "d" is on the same
line as "c". Instead, the <p> forces a blank line that doesn't correspond to a
blank line in the wiki markup. The closing </p> forces a blank line after "d".

{| style="border: 1px solid #aaa"
|-
|
a
b<br>
c
d
|-
|}

If "a" is moved to the next line, it trades places with the first blank line,
leaving extra space at both ends of the cell. In this situation, "b" is on the
same line as "a", as it should be.

{| style="border: 1px solid #aaa"
|-
|
a
b<br>
c

d
|-
|}

Inserting a blank line produces the expected behavior that a blank line in the
markup corresponds to a blank line in the output.


Version: unspecified
Severity: normal
URL: http://meta.wikimedia.org/wiki/Bugs/Multiline_table_cell

Details

Reference
bz4780

Event Timeline

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

pyrios wrote:

I am interested in looking at this. It has some similarities to this bug http://bugzilla.wikimedia.org/show_bug.cgi?id=5718

  • Bug 9921 has been marked as a duplicate of this bug. ***

marin wrote:

This is a real pity that this bug has never been resolved. It's been 2 years and a half since it was reported. Anybody to take care of that ?

Why not just do

{| style="border: 1px solid #aaa"

-
ab<br>

cd

-
}

?

@Bawolff that actually doesn't resolve it:

{|
|-
|ab<br>
cd
|-
|}

Results in a <p> around the "cd":

<table>
  <tbody>
    <tr>
      <td>
        ab<br>
        <p>
          cd
        </p>
      </td>
    </tr>
  </tbody>
</table>

When what you expect is:

<table>
  <tbody>
    <tr>
      <td>
        ab<br>cd
      </td>
    </tr>
  </tbody>
</table>