textile / python-textile

A Python port of Textile, A humane web text generator
Other
69 stars 22 forks source link

Fixed code block multiline encoding on quotes/span #61

Closed Igoranze closed 6 years ago

Igoranze commented 6 years ago

Hi, There was an error on the python-textile module which was rendering codeblocks multiline as follows:

bc.. This is some TEXT inside a "Code BLOCK"

{
  if (JSON) {

    return {"JSON":"value"}
  }
}

Back to 10-4 CAPS 

p.. Some multiline Paragragh

Here is some output!!! "Some" CAPS

Became:

<pre><code>This is some TEXT inside a &quot;Code BLOCK&quot;

{
  if (&lt;span class=&quot;caps&quot;&gt;JSON&lt;/span&gt;) {

    return {<a href=""><span class="caps">JSON</span></a>&amp;#8220;value&amp;#8221;}
  }
}

Back to 10-4 &lt;span class=&quot;caps&quot;&gt;CAPS&lt;/span&gt; </code></pre>

<p>Some multiline Paragragh

Here is some output!!! &#8220;Some&#8221; <span class="caps">CAPS</span></p>

There are a multiple things wrong here.

<span class='caps'>...</span> (Inside codeblock)
<a href>...</a> (On a word that is not a link)
&amp;#8220; (Double escaping of quotes)

Fixed it by checking the inner_tag of block. If that is equal to 'code' do the same rendering as on the 'pre' tag.

codecov-io commented 6 years ago

Codecov Report

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

Impacted file tree graph

@@          Coverage Diff           @@
##           develop    #61   +/-   ##
======================================
  Coverage      100%   100%           
======================================
  Files           12     12           
  Lines         1195   1195           
  Branches       219    219           
======================================
  Hits          1195   1195
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 7f44b48...3188b0b. Read the comment docs.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 3188b0b9fa8a61c707b9d40ae70eb152d8d0e74c on Igoranze:master into 8b8d973870a1be2a18b7d62f9148bd336efb3af4 on textile:master.