Skip to content

Commit 146f82d

Browse files
committed
Merge branch 'release/3.0.3'
2 parents 51cbf11 + fc29e58 commit 146f82d

File tree

4 files changed

+83
-8
lines changed

4 files changed

+83
-8
lines changed

CHANGELOG.textile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
h1. Textile Changelog
22

3+
h2. Version 3.0.3
4+
* BUGFIX: Improve handling code block following extended p block ("#63":https://github.com/textile/python-textile/pull/63)
5+
36
h2. Version 3.0.2
47
* BUGFIX: Fix for multiple multi-line paragraphs. ("#62":https://github.com/textile/python-textile/pull/62)
58

tests/test_github_issues.py

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,15 @@ def test_github_issue_55():
258258
'return configs;\n}\n}</pre>')
259259
assert result == expect
260260

261-
def test_issue_56():
261+
def test_github_issue_56():
262+
"""Empty description lists throw error"""
262263
result = textile.textile("- :=\n-")
263264
expect = '<dl>\n</dl>'
264265
assert result == expect
265266

266-
def test_github_issue_57():
267-
input = '''bc.. This is some TEXT inside a "Code BLOCK"
267+
def test_github_pull_61():
268+
"""Fixed code block multiline encoding on quotes/span"""
269+
test = '''bc.. This is some TEXT inside a "Code BLOCK"
268270
269271
{
270272
if (JSON) {
@@ -294,11 +296,13 @@ def test_github_issue_57():
294296
295297
<p>Here is some output!!! &#8220;Some&#8221; <span class="caps">CAPS</span></p>'''
296298
t = textile.Textile()
297-
result = t.parse(input)
299+
result = t.parse(test)
298300
assert result == expect
299301

300-
def test_issue_58():
301-
input = '''p.. First one 'is'
302+
def test_github_pull_62():
303+
"""Fix for paragraph multiline, only last paragraph is rendered
304+
correctly"""
305+
test = '''p.. First one 'is'
302306
303307
ESCAPED "bad"
304308
@@ -334,5 +338,70 @@ def test_issue_58():
334338
335339
<p><span class="caps">ESCAPED</span> &#8220;good&#8221; test</p>'''
336340
t = textile.Textile()
337-
result = t.parse(input)
341+
result = t.parse(test)
342+
assert result == expect
343+
344+
def test_github_pull_63():
345+
"""Forgot to set multiline_para to False"""
346+
test = '''p.. First one 'is'
347+
348+
ESCAPED "bad"
349+
350+
bc.. {
351+
First code BLOCK
352+
353+
{"JSON":'value'}
354+
}
355+
356+
p.. Second one 'is'
357+
358+
359+
360+
ESCAPED "bad"
361+
362+
p.. Third one 'is'
363+
364+
ESCAPED "bad"
365+
366+
bc.. {
367+
Last code BLOCK
368+
369+
{"JSON":'value'}
370+
}
371+
372+
p.. Last one 'is'
373+
374+
ESCAPED "good" test'''
375+
376+
expect = '''<p>First one &#8216;is&#8217;</p>
377+
378+
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
379+
380+
<pre><code>{
381+
First code BLOCK
382+
383+
{&quot;JSON&quot;:&#39;value&#39;}
384+
}</code></pre>
385+
386+
<p>Second one &#8216;is&#8217;</p>
387+
388+
389+
390+
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
391+
392+
<p>Third one &#8216;is&#8217;</p>
393+
394+
<p><span class="caps">ESCAPED</span> &#8220;bad&#8221;</p>
395+
396+
<pre><code>{
397+
Last code BLOCK
398+
399+
{&quot;JSON&quot;:&#39;value&#39;}
400+
}</code></pre>
401+
402+
<p>Last one &#8216;is&#8217;</p>
403+
404+
<p><span class="caps">ESCAPED</span> &#8220;good&#8221; test</p>'''
405+
t = textile.Textile()
406+
result = t.parse(test)
338407
assert result == expect

textile/core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,9 @@ def block(self, text):
536536
else:
537537
line = self.doPBr(line)
538538

539+
if not block.tag == 'p':
540+
multiline_para = False
541+
539542
line = line.replace('<br>', '<br />')
540543

541544
# if we're in an extended block, and we haven't specified a new

textile/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '3.0.2'
1+
VERSION = '3.0.3'

0 commit comments

Comments
 (0)