Skip to content

Commit 76ba349

Browse files
committed
fix issue #27
1 parent 4f36105 commit 76ba349

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

tests/test_github_issues.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,12 @@ def test_github_issue_26():
4141
result = textile.textile(text)
4242
expect = ''
4343
assert result == expect
44+
45+
def test_github_issue_27():
46+
test="""
47+
* Folders with ":" in their names are displayed with a forward slash "/" instead. (Filed as "#4581709":Radar:4581709, which was considered "normal behaviour" - quote: "Please note that Finder presents the 'Carbon filesystem' view, regardless of the underlying filesystem.")
48+
49+
"""
50+
result = textile.textile(test)
51+
expect = """\t<ul>\n\t\t<li>Folders with &#8220;:&#8221; in their names are displayed with a forward slash &#8220;/&#8221; instead. (Filed as <a href="Radar%3A4581709">#4581709</a>, which was considered &#8220;normal behaviour&#8221; &#8211; quote: &#8220;Please note that Finder presents the &#8216;Carbon filesystem&#8217; view, regardless of the underlying filesystem.&#8221;)</li>\n\t</ul>"""
52+
assert result == expect

textile/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,8 @@ def markStartOfLinks(self, text):
610610
# inline links between the link text and the url part and are much more
611611
# infrequent than '"' characters so we have less possible links to
612612
# process.
613-
slices = text.split('":')
613+
slice_re = re.compile(r'":(?={0})'.format(regex_snippets['char']))
614+
slices = slice_re.split(text)
614615
output = []
615616

616617
if len(slices) > 1:
@@ -619,6 +620,11 @@ def markStartOfLinks(self, text):
619620
last_slice = slices.pop()
620621

621622
for s in slices:
623+
# If there is no possible start quote then this slice is not
624+
# a link
625+
if '"' not in s:
626+
output.append(s)
627+
continue
622628
# Cut this slice into possible starting points wherever we find
623629
# a '"' character. Any of these parts could represent the start
624630
# of the link text - we have to find which one.

0 commit comments

Comments
 (0)