Skip to content

Commit 3fbdbf4

Browse files
committed
Align trailing angle bracket URL fix with upstream php-textile reference behavior
1 parent d86b755 commit 3fbdbf4

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎tests/test_urls.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ def test_quotes_in_link_text():
7373

7474
def test_link_url_ending_in_angle_bracket():
7575
"""A link whose URL ends in '>' with no closing tag used to raise a raw
76-
AttributeError; the '>' should be pushed out of the URL like other
77-
trailing punctuation."""
76+
AttributeError; the '>' should be dropped completely from the URL and
77+
the output to align with reference php-textile."""
7878
t = Textile()
79-
assert t.parse('"a":b>') == '\t<p><a href="b">a</a>&gt;</p>'
79+
assert t.parse('"a":b>') == '\t<p><a href="b">a</a></p>'
8080
assert t.parse('"x":http://x.com/>') == (
81-
'\t<p><a href="http://x.com/">x</a>&gt;</p>')
81+
'\t<p><a href="http://x.com/">x</a></p>')
8282
# A genuine trailing closing tag is still absorbed as before.
8383
assert t.parse('"y":http://x.com/</a') == (
8484
'\t<p><a href="http://x.com/%3C/a">y</a></p>')
85+
assert t.parse('"y":http://x.com/</a>') == (
86+
'\t<p><a href="http://x.com/">y</a></a></p>')

‎textile/core.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,8 @@ def _rightanglebracket(c, pop, popped, url_chars, counts, pre):
889889

890890
m = re.search(r'(?P<url_chars>.*)(?P<tag><\/[a-z]+)$', urlLeft)
891891
if m is None:
892-
# Lone trailing '>' (no closing tag): pop it out the back.
893-
return '{0}{1}'.format(c, pop), True, url_chars, counts, pre
892+
popped = True
893+
return pop, popped, url_chars, counts, pre
894894
url_chars = m.group('url_chars')
895895
pop = '{0}{1}{2}'.format(m.group('tag'), c, pop)
896896
popped = True

0 commit comments

Comments
 (0)