PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Text » Text_Wiki_Mediawiki » Bug #8450

Invalid nesting of paragraphs for tables

Details

Submitted2006-08-15 16:28 UTC
Frombjs5075 at rit dot edu
Assignedritzmo
StatusClosed
PackageText_Wiki_Mediawiki
PHP Version5.1.4
OSDebian etch
Roadmaps(Not assigned)

Comments

[2006-08-15 16:28 UTC] bjs5075 at rit dot edu

Description:
------------
Because the Text_Wiki parser has no concept of element
nesting, it is very difficult to enforce a hierchy
required by XHTML elements.
One example is that paragraphs are split by table
formatting, ultimately producing invalid XHTML.

The paragraph must somehow know to split itself over
delimeters that it cannot contain (such as table). Or in
such cases where it does contain them, to not insert any
paragraph tokens at all.

Test script:
---------------
{|
|

table cell
|
more text

|}

Expected result:
----------------
Something similar to:

<table>
<tr>
<td><p>table cell</p></td>
<td><p>more text</p></td>
</tr>
</table>

Actual result:
--------------
Paragraph must not overlap table elements as happens here:

<table>
<tr>
<td><p>table cell </td>
<td> more text</p>

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

[2006-08-15 17:20 UTC] ritzmo at php dot net

This is a weird Bug, as it actually shouldn't occur.
But a quick fix would be to strip double line breaks from the table elements.

[2006-08-15 17:26 UTC] bjs5075 at rit dot edu

Here's a fix that simply adds line breaks around the table
tags; forcing the paragraphs to break around the tags.

--- Parse/Mediawiki/Table.php (revision 766)
+++ Parse/Mediawiki/Table.php (working copy)
@@ -280,7 +280,7 @@
$this->_countCells[$this->_level]
[$this->_countRows[$this->_level]] += $param['span'];
$ret = $this->wiki->addToken($this->rule,
$param);
$param['type'] = 'cell_end';
- return $ret . $matches[3] .
$this->wiki->addToken($this->rule, $param );
+ return $ret ."\n". $matches[3] ."\n".
$this->wiki->addToken($this->rule, $param );
}
}
?>