textile / python-textile

A Python port of Textile, A humane web text generator
Other
68 stars 23 forks source link

Trailing space after table row statement results into different table as without it #74

Closed barsch closed 2 weeks ago

barsch commented 3 years ago
>>> from textile import __version__
>>> __version__
'4.0.1'

>>> from textile.core import Textile
>>> Textile().parse("| 1 | 2 |\n| 3 | 4 |")  # without space results into table with 2 rows and 2 cols
'\t<table>\n\t\t<tr>\n\t\t\t<td> 1 </td>\n\t\t\t<td> 2 </td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td> 3 </td>\n\t\t\t<td> 4 </td>\n\t\t</tr>\n\t</table>'
>>> Textile().parse("| 1 | 2 | \n| 3 | 4 |")  # trailing space after first row results into table with 1 row and 4 cols
'\t<table>\n\t\t<tr>\n\t\t\t<td> 1 </td>\n\t\t\t<td> 2 </td>\n\t\t\t<td> <br />\n</td>\n\t\t\t<td> 3 </td>\n\t\t\t<td> 4 </td>\n\t\t</tr>\n\t</table>'

I'm not sure how the textile standard is defined in this case, however testing other textile implementations (e.g. javascript or https://textile-lang.com/doc/tables) produce both the same HTML tables (2 cols, 2 rows).

Same applies for trailing tabs - didn't test any other whitespace characters. It is also independent of the linebreak characters /r, /r/n, /n.

ikirudennis commented 2 weeks ago

At long last, I've had some time to work on this project a little bit, and it looks like the two examples are not producing different output. As of version 4.0.2, they both produce 2 rows and 2 columns.