Skip to content

Commit

Permalink
Fixed code block multiline encoding on quotes/span
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanspengen-ct committed Apr 10, 2018
1 parent 8b8d973 commit 3188b0b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,37 @@ def test_issue_56():
result = textile.textile("- :=\n-")
expect = '<dl>\n</dl>'
assert result == expect

def test_github_issue_57():
input = '''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'''

expect = '''<pre><code>This is some TEXT inside a &quot;Code BLOCK&quot;
{
if (JSON) {
return {&quot;JSON&quot;:&quot;value&quot;}
}
}
Back to 10-4 CAPS </code></pre>
<p>Some multiline Paragragh
Here is some output!!! &#8220;Some&#8221; <span class="caps">CAPS</span></p>'''
t = textile.Textile()
result = t.parse(input)
assert result == expect
2 changes: 1 addition & 1 deletion textile/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def block(self, text):
block.outer_atts)
line = "\t{0}".format(line)
else:
if block.tag == 'pre':
if block.tag == 'pre' or block.inner_tag == 'code':
line = self.shelve(encode_html(line, quotes=True))
else:
line = self.graf(line)
Expand Down

0 comments on commit 3188b0b

Please sign in to comment.