textile / python-textile

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

Fix for paragraph multiline, only last paragraph is rendered correctly #62

Closed Igoranze closed 6 years ago

Igoranze commented 6 years ago

Hi,

Me agian. There is another error which happens if you use multiple line blocks on paragraph. If the input is:

p.. First one 'is'

ESCAPED "bad"

p.. Second one 'is'

ESCAPED "bad"

p.. Third one 'is'

ESCAPED "bad"

p.. Last one 'is'

ESCAPED "good"

The textile output is:

<p>First one &amp;#8216;is&amp;#8217;

&lt;span class=&quot;caps&quot;&gt;ESCAPED&lt;/span&gt; &amp;#8220;bad&amp;#8221;</p>

<p>Second one &amp;#8216;is&amp;#8217;

&lt;span class=&quot;caps&quot;&gt;ESCAPED&lt;/span&gt; &amp;#8220;bad&amp;#8221;</p>

<p>Third one &amp;#8216;is&amp;#8217;

&lt;span class=&quot;caps&quot;&gt;ESCAPED&lt;/span&gt; &amp;#8220;bad&amp;#8221;</p>

<p>Last one &#8216;is&#8217;

<span class="caps">ESCAPED</span> &#8220;good&#8221;</p>

Here we can see that only the last p.. is escaped good. Other (previous) paragraphs are double escaped:

&amp;#8216; (Double escaped, should be &#8216;)
&lt;span class=&quot;caps&quot;&gt;...&lt;/span&gt; (Double escaped, should be <span class="caps">ESCAPED</span>

Added test and fix.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 2b90b80467b2cd64034da1f2a39ce2fb5b494c6e on Igoranze:master into 674d514a6c82d91a2b0c06e719ef565d14f89f55 on textile:develop.

Igoranze commented 6 years ago

Hmm... looks like there is more work for this fix... I will look into it tomorrow. Do you have any other ideas?

codecov-io commented 6 years ago

Codecov Report

Merging #62 into develop will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           develop    #62   +/-   ##
======================================
  Coverage      100%   100%           
======================================
  Files           12     12           
  Lines         1195   1211   +16     
  Branches       219    225    +6     
======================================
+ Hits          1195   1211   +16
Impacted Files Coverage Δ
textile/core.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 674d514...2b90b80. Read the comment docs.

ikirudennis commented 6 years ago

Hello, and thanks again, @Igoranze for your time and attention.

I'll admit I haven't really looked at this, but if I had to guess it might be due to the difficulty of handling those extended blocks. By the way, I ran your test through txstyle.org, and the result doesn't match your expectation in the test. I always use that as a reference for output.

Igoranze commented 6 years ago

Hello @ikirudennis ,

I'm continuing with this bug development. I'm not quite sure why the tests are not passing? While on my local machine everything seems fine... It looks like the <span class='caps'>...</span> tags are not added here.

Also you said that the expected result does not mach that of txstyle.org. I suspect you mean the <p>...</p> on each new line. Have to look into that as well.

If you did manage to find a solution, please let me know.

Igoranze commented 6 years ago

Hi @ikirudennis,

I just pushed the last commit which fixes the <p>...</p> (output is the same as txstyle.org) Also there is no more double escaping on p.. multiline.

Igoranze commented 6 years ago

Merged multiple commits into one final commit

ikirudennis commented 6 years ago

Thanks again, @Igoranze! Do you have more bugs you are planning to fix? Should I wait a little bit to push a new release?

Igoranze commented 6 years ago

Hi @ikirudennis,

No, I do not have plans to fix other bugs so you can go ahead and release. Thanks.