Skip to content

Commit fd8b10a

Browse files
committed
fix a slight issue with link text containing quotes, and bring coverage back to 100%.
1 parent 055b5c5 commit fd8b10a

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

tests/test_glyphs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,3 @@ def test_glyphs():
2626
result = t.glyphs("<p><cite>Cat's Cradle</cite> by Vonnegut</p>")
2727
expect = '<p><cite>Cat&#8217;s Cradle</cite> by Vonnegut</p>'
2828
assert result == expect
29-
30-
result = t.glyphs('test"')
31-
expect = 'test&#8221; '
32-
assert result == expect

tests/test_urls.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,11 @@ def test_rel_attribute():
5959
result = t.parse('"$":http://domain.tld')
6060
expect = '\t<p><a href="http://domain.tld" rel="nofollow">domain.tld</a></p>'
6161
assert result == expect
62+
63+
def test_quotes_in_link_text():
64+
"""quotes in link text are tricky."""
65+
test = '""this is a quote in link text"":url'
66+
t = Textile()
67+
result = t.parse(test)
68+
expect = '\t<p><a href="url">&#8220;this is a quote in link text&#8221;</a></p>'
69+
assert result == expect

textile/core.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,6 @@ def glyphs(self, text):
577577
So, for the first pass, we use the glyph_search_initial set of
578578
regexes. For all remaining passes, we use glyph_search
579579
"""
580-
# fix: hackish
581-
if text.endswith('"'):
582-
text = '{0} '.format(text)
583-
584580
text = text.rstrip('\n')
585581
result = []
586582
searchlist = self.glyph_search_initial
@@ -729,7 +725,7 @@ def markStartOfLinks(self, text):
729725

730726
try:
731727
possibility = possible_start_quotes.pop()
732-
except IndexError:
728+
except IndexError: # pragma: no branch
733729
# If out of possible starting segments we back the
734730
# last one from the linkparts array
735731
linkparts.pop()

0 commit comments

Comments
 (0)