python-textile icon indicating copy to clipboard operation
python-textile copied to clipboard

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

Open kpot opened this issue 2 years ago • 0 comments

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.

kpot avatar Aug 31 '22 07:08 kpot