Skip to content

Commit

Permalink
Merge branch 'release/2.3.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikirudennis committed Aug 14, 2017
2 parents bf40e2d + eda1971 commit 713b83a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
h1. Textile Changelog

h2. Version 2.3.16
* Bugfixes:
** Fix processing of extended code blocks ("#50":https://github.com/textile/python-textile/issues/50)
** Don't break when links fail to include "http:" ("#51":https://github.com/textile/python-textile/issues/51)
** Better handling of poorly-formatted tables ("#52":https://github.com/textile/python-textile/issues/52)

h2. Version 2.3.15
* Bugfix: Don't break on unicode characters in the fragment of a url.

Expand Down
26 changes: 26 additions & 0 deletions tests/test_github_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,29 @@ def test_github_issue_49():
result = textile.textile(s)
expect = '\t<p><a href="https://ru.vuejs.org/v2/guide/components.html#Входные-параметры">link</a></p>'
assert result == expect

def test_github_issue_50():
"""Incorrect wrap code with Java generics in pre"""
test = ('pre.. public class Tynopet<T extends Framework> {}\n\nfinal '
'List<List<String>> multipleList = new ArrayList<>();')
result = textile.textile(test)
expect = ('<pre>public class Tynopet&lt;T extends Framework&gt; {}\n\n'
'final List&lt;List&lt;String&gt;&gt; multipleList = new '
'ArrayList&lt;&gt;();</pre>')
assert result == expect

def test_github_issue_51():
"""Link build with $ sign without "http" prefix broken."""
test = '"$":www.google.com.br'
result = textile.textile(test)
expect = '\t<p><a href="www.google.com.br">www.google.com.br</a></p>'
assert result == expect

def test_github_issue_52():
"""Table build without space after aligment raise a AttributeError."""
test = '|=.First Header |=. Second Header |'
result = textile.textile(test)
expect = ('\t<table>\n\t\t<tr>\n\t\t\t<td>=.First Header '
'</td>\n\t\t\t<td style="text-align:center;">Second Header </td>'
'\n\t\t</tr>\n\t</table>')
assert result == expect
7 changes: 5 additions & 2 deletions textile/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,10 @@ def block(self, text):
# at this point, we've gone through all the lines, and if there's still
# an extension in effect, we close it here.
if ext and out:
final = generate_tag(block.outer_tag, out.pop(), block.outer_atts)
block.content = out.pop()
block.process()
final = generate_tag(block.outer_tag, block.content,
block.outer_atts)
out.append(final)
return ''.join(out)

Expand Down Expand Up @@ -917,7 +920,7 @@ def _casesdefault(c, pop, popped, url_chars, counts, pre):
text = url
if "://" in text:
text = text.split("://")[1]
else:
elif ":" in text:
text = text.split(":")[1]

text = text.strip()
Expand Down
16 changes: 9 additions & 7 deletions textile/objects/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ def process(self):
# as a normal center-aligned cell.
if i == 0 and row[:2] == '|=':
captionpattern = (r"^\|\=(?P<capts>{s}{a}{c})\. "
r"(?P<cap>[^\n]*)(?P<row>.*)".format(**{'s':
table_span_re_s, 'a': align_re_s, 'c': cls_re_s}))
r"(?P<cap>[^\n]*)(?P<row>.*)".format(**{
's': table_span_re_s, 'a': align_re_s,
'c': cls_re_s}))
caption_re = re.compile(captionpattern, re.S)
cmtch = caption_re.match(row)
caption = Caption(**cmtch.groupdict())
self.caption = '\n{0}'.format(caption.caption)
row = cmtch.group('row').lstrip()
if row == '':
continue
if cmtch:
caption = Caption(**cmtch.groupdict())
self.caption = '\n{0}'.format(caption.caption)
row = cmtch.group('row').lstrip()
if row == '':
continue

# Colgroup -- A colgroup row will not necessarily end with a |.
# Hence it may include the next row of actual table data.
Expand Down
2 changes: 1 addition & 1 deletion textile/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.3.15'
VERSION = '2.3.16'

0 comments on commit 713b83a

Please sign in to comment.