diff --git a/tests/test_github_issues.py b/tests/test_github_issues.py index 27befff7..6b5b3d75 100644 --- a/tests/test_github_issues.py +++ b/tests/test_github_issues.py @@ -262,3 +262,37 @@ def test_issue_56(): result = textile.textile("- :=\n-") expect = '
\n
' 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 = '''
This is some TEXT inside a "Code BLOCK"
+
+{
+  if (JSON) {
+
+    return {"JSON":"value"}
+  }
+}
+
+Back to 10-4 CAPS 
+ +

Some multiline Paragragh + +Here is some output!!! “Some” CAPS

''' + t = textile.Textile() + result = t.parse(input) + assert result == expect diff --git a/textile/core.py b/textile/core.py index 7572a468..a5dae835 100644 --- a/textile/core.py +++ b/textile/core.py @@ -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)