Skip to content

Commit 713b83a

Browse files
committed
Merge branch 'release/2.3.16'
2 parents bf40e2d + eda1971 commit 713b83a

File tree

5 files changed

+47
-10
lines changed

5 files changed

+47
-10
lines changed

CHANGELOG.textile

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

3+
h2. Version 2.3.16
4+
* Bugfixes:
5+
** Fix processing of extended code blocks ("#50":https://github.com/textile/python-textile/issues/50)
6+
** Don't break when links fail to include "http:" ("#51":https://github.com/textile/python-textile/issues/51)
7+
** Better handling of poorly-formatted tables ("#52":https://github.com/textile/python-textile/issues/52)
8+
39
h2. Version 2.3.15
410
* Bugfix: Don't break on unicode characters in the fragment of a url.
511

tests/test_github_issues.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,29 @@ def test_github_issue_49():
173173
result = textile.textile(s)
174174
expect = '\t<p><a href="https://ru.vuejs.org/v2/guide/components.html#Входные-параметры">link</a></p>'
175175
assert result == expect
176+
177+
def test_github_issue_50():
178+
"""Incorrect wrap code with Java generics in pre"""
179+
test = ('pre.. public class Tynopet<T extends Framework> {}\n\nfinal '
180+
'List<List<String>> multipleList = new ArrayList<>();')
181+
result = textile.textile(test)
182+
expect = ('<pre>public class Tynopet&lt;T extends Framework&gt; {}\n\n'
183+
'final List&lt;List&lt;String&gt;&gt; multipleList = new '
184+
'ArrayList&lt;&gt;();</pre>')
185+
assert result == expect
186+
187+
def test_github_issue_51():
188+
"""Link build with $ sign without "http" prefix broken."""
189+
test = '"$":www.google.com.br'
190+
result = textile.textile(test)
191+
expect = '\t<p><a href="www.google.com.br">www.google.com.br</a></p>'
192+
assert result == expect
193+
194+
def test_github_issue_52():
195+
"""Table build without space after aligment raise a AttributeError."""
196+
test = '|=.First Header |=. Second Header |'
197+
result = textile.textile(test)
198+
expect = ('\t<table>\n\t\t<tr>\n\t\t\t<td>=.First Header '
199+
'</td>\n\t\t\t<td style="text-align:center;">Second Header </td>'
200+
'\n\t\t</tr>\n\t</table>')
201+
assert result == expect

textile/core.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,10 @@ def block(self, text):
534534
# at this point, we've gone through all the lines, and if there's still
535535
# an extension in effect, we close it here.
536536
if ext and out:
537-
final = generate_tag(block.outer_tag, out.pop(), block.outer_atts)
537+
block.content = out.pop()
538+
block.process()
539+
final = generate_tag(block.outer_tag, block.content,
540+
block.outer_atts)
538541
out.append(final)
539542
return ''.join(out)
540543

@@ -917,7 +920,7 @@ def _casesdefault(c, pop, popped, url_chars, counts, pre):
917920
text = url
918921
if "://" in text:
919922
text = text.split("://")[1]
920-
else:
923+
elif ":" in text:
921924
text = text.split(":")[1]
922925

923926
text = text.strip()

textile/objects/table.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ def process(self):
3838
# as a normal center-aligned cell.
3939
if i == 0 and row[:2] == '|=':
4040
captionpattern = (r"^\|\=(?P<capts>{s}{a}{c})\. "
41-
r"(?P<cap>[^\n]*)(?P<row>.*)".format(**{'s':
42-
table_span_re_s, 'a': align_re_s, 'c': cls_re_s}))
41+
r"(?P<cap>[^\n]*)(?P<row>.*)".format(**{
42+
's': table_span_re_s, 'a': align_re_s,
43+
'c': cls_re_s}))
4344
caption_re = re.compile(captionpattern, re.S)
4445
cmtch = caption_re.match(row)
45-
caption = Caption(**cmtch.groupdict())
46-
self.caption = '\n{0}'.format(caption.caption)
47-
row = cmtch.group('row').lstrip()
48-
if row == '':
49-
continue
46+
if cmtch:
47+
caption = Caption(**cmtch.groupdict())
48+
self.caption = '\n{0}'.format(caption.caption)
49+
row = cmtch.group('row').lstrip()
50+
if row == '':
51+
continue
5052

5153
# Colgroup -- A colgroup row will not necessarily end with a |.
5254
# Hence it may include the next row of actual table data.

textile/version.py

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

0 commit comments

Comments
 (0)