textile / python-textile

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

Wrong HTML output when "bc.." is the very last in the document #81

Open kpot opened 1 year ago

kpot commented 1 year ago

Hi!

Given the following Textile document (in a form of a Python string):

bc.. Paragraph 1\n\nParagraph 2\n\nParagraph 3

python-textile outputs

"<pre>Paragraph 1\n\nParagraph 2\n\nParagraph 3</pre>"

When it should be producing

"<pre><code>Paragraph 1\n\nParagraph 2\n\nParagraph 3</code></pre>"

This happens only when the "bc.." block is the very last or the only block of the document. If it is followed by anything else, say a p. Extra text block, the resulting HTML is correct.

I'm currently working on porting python-textile to Rust, so I'm quite familiar with the code and plan to fix the bug myself. I'll send a PR with some extra tests.