Skip to content

Commit

Permalink
Merge branch 'release/3.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikirudennis committed Apr 22, 2018
2 parents 51cbf11 + fc29e58 commit 146f82d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
h1. Textile Changelog

h2. Version 3.0.3
* BUGFIX: Improve handling code block following extended p block ("#63":https://github.com/textile/python-textile/pull/63)

h2. Version 3.0.2
* BUGFIX: Fix for multiple multi-line paragraphs. ("#62":https://github.com/textile/python-textile/pull/62)

Expand Down
83 changes: 76 additions & 7 deletions tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,15 @@ def test_github_issue_55():
'return configs;\n}\n}</pre>')
assert result == expect

def test_issue_56():
def test_github_issue_56():
"""Empty description lists throw error"""
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"
def test_github_pull_61():
"""Fixed code block multiline encoding on quotes/span"""
test = '''bc.. This is some TEXT inside a "Code BLOCK"
{
if (JSON) {
Expand Down Expand Up @@ -294,11 +296,13 @@ def test_github_issue_57():
<p>Here is some output!!! &#8220;Some&#8221; <span class="caps">CAPS</span></p>'''
t = textile.Textile()
result = t.parse(input)
result = t.parse(test)
assert result == expect

def test_issue_58():
input = '''p.. First one 'is'
def test_github_pull_62():
"""Fix for paragraph multiline, only last paragraph is rendered
correctly"""
test = '''p.. First one 'is'
ESCAPED "bad"
Expand Down Expand Up @@ -334,5 +338,70 @@ def test_issue_58():
<p><span class="caps">ESCAPED</span> &#8220;good&#8221; test</p>'''
t = textile.Textile()
result = t.parse(input)
result = t.parse(test)
assert result == expect

def test_github_pull_63():
"""Forgot to set multiline_para to False"""
test = '''p.. First one 'is'
ESCAPED "bad"
bc.. {
First code BLOCK
{"JSON":'value'}
}
p.. Second one 'is'
ESCAPED "bad"
p.. Third one 'is'
ESCAPED "bad"
bc.. {
Last code BLOCK
{"JSON":'value'}
}
p.. Last one 'is'
ESCAPED "good" test'''

expect = '''<p>First one &#8216;is&#8217;</p>
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
<pre><code>{
First code BLOCK
{&quot;JSON&quot;:&#39;value&#39;}
}</code></pre>
<p>Second one &#8216;is&#8217;</p>
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
<p>Third one &#8216;is&#8217;</p>
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
<pre><code>{
Last code BLOCK
{&quot;JSON&quot;:&#39;value&#39;}
}</code></pre>
<p>Last one &#8216;is&#8217;</p>
<p><span class="caps">ESCAPED</span> &#8220;good&#8221; test</p>'''
t = textile.Textile()
result = t.parse(test)
assert result == expect
3 changes: 3 additions & 0 deletions textile/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ def block(self, text):
else:
line = self.doPBr(line)

if not block.tag == 'p':
multiline_para = False

line = line.replace('<br>', '<br />')

# if we're in an extended block, and we haven't specified a new
Expand Down
2 changes: 1 addition & 1 deletion textile/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '3.0.2'
VERSION = '3.0.3'

0 comments on commit 146f82d

Please sign in to comment.