quetzai / wikimodel

Automatically exported from code.google.com/p/wikimodel
0 stars 0 forks source link

IWikiScannerContext - Empty extra cell in a table row. #172

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1.Use MediaWikiParser and pass a Table with two rows and two cells each
with MediaWikiParser.

2.Handle Table Cell event with public void onTableCell(boolean head,
WikiParameters params).

What is the expected output?
<div class='wikimodel-document'>
<table><tbody>
  <tr><th>Heading
<span class='wikimodel-escaped'>!</span>Not a heading</th><th>Heading
again!</th></tr>
</tbody></table>
</div>

What do you see instead?
<div class='wikimodel-document'>
<table><tbody>
  <tr><td></td><th>Heading
<span class='wikimodel-escaped'>!</span>Not a heading</th><th>Heading
again!</th></tr>
</tbody></table>
</div>

Bug

When first cell in the table is encountered.onTableCell event checks if
style is opened, if not its fires beginCell event, followed by end cell and
at the end begin cell. Which leads to creation of extra empty cell.

Actually, it should call endCell event only if isInTableCell() is true.

Reference

http://code.google.com/p/wikimodel/source/browse/trunk/org.wikimodel.wem/src/mai
n/java/org/wikimodel/wem/impl/InternalWikiScannerContext.java

Original issue reported on code.google.com by vipunreddy.n on 15 Mar 2010 at 1:20

Attachments:

GoogleCodeExporter commented 8 years ago
Actually it does not work that way, you are not supposed to call onTableCell 
for the
first cell: the first cell of a raw is already opened by beginTableRow

Original comment by thomas.m...@gmail.com on 17 Mar 2010 at 3:55

GoogleCodeExporter commented 8 years ago

Original comment by thomas.m...@gmail.com on 28 Mar 2010 at 5:52

GoogleCodeExporter commented 8 years ago
Applied patch from Arun Reddy

Original comment by thomas.m...@gmail.com on 28 Mar 2010 at 5:57