Skip to content

Commit 3188b0b

Browse files
Fixed code block multiline encoding on quotes/span
1 parent 8b8d973 commit 3188b0b

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

tests/test_github_issues.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,37 @@ def test_issue_56():
262262
result = textile.textile("- :=\n-")
263263
expect = '<dl>\n</dl>'
264264
assert result == expect
265+
266+
def test_github_issue_57():
267+
input = '''bc.. This is some TEXT inside a "Code BLOCK"
268+
269+
{
270+
if (JSON) {
271+
272+
return {"JSON":"value"}
273+
}
274+
}
275+
276+
Back to 10-4 CAPS
277+
278+
p.. Some multiline Paragragh
279+
280+
Here is some output!!! "Some" CAPS'''
281+
282+
expect = '''<pre><code>This is some TEXT inside a &quot;Code BLOCK&quot;
283+
284+
{
285+
if (JSON) {
286+
287+
return {&quot;JSON&quot;:&quot;value&quot;}
288+
}
289+
}
290+
291+
Back to 10-4 CAPS </code></pre>
292+
293+
<p>Some multiline Paragragh
294+
295+
Here is some output!!! &#8220;Some&#8221; <span class="caps">CAPS</span></p>'''
296+
t = textile.Textile()
297+
result = t.parse(input)
298+
assert result == expect

textile/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ def block(self, text):
503503
block.outer_atts)
504504
line = "\t{0}".format(line)
505505
else:
506-
if block.tag == 'pre':
506+
if block.tag == 'pre' or block.inner_tag == 'code':
507507
line = self.shelve(encode_html(line, quotes=True))
508508
else:
509509
line = self.graf(line)

0 commit comments

Comments
 (0)