textile / python-textile

A Python port of Textile, A humane web text generator
Other
69 stars 23 forks source link

textile to links containing parentheses fails #20

Closed hhsprings closed 8 years ago

hhsprings commented 8 years ago

See spec(20 May 2009).

>>> import textile
>>> textile.__version__
'2.2.2'
>>> from textile import textile
>>> r = textile('''\
... This is a link to a \
... ["Wikipedia article about Textile":http://en.wikipedia.org/wiki/Textile_(markup_language)].
... ''')
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "c:\Python27\lib\site-packages\textile\core.py", line 1661, in textile
    head_offset=head_offset)
  File "c:\Python27\lib\site-packages\textile\core.py", line 267, in parse
    text = self.block(text, int(head_offset))
  File "c:\Python27\lib\site-packages\textile\core.py", line 780, in block
    cite, line)
  File "c:\Python27\lib\site-packages\textile\core.py", line 913, in fBlock
    content = self.graf(content)
  File "c:\Python27\lib\site-packages\textile\core.py", line 1105, in graf
    text = self.links(text)
  File "c:\Python27\lib\site-packages\textile\core.py", line 1160, in links
    text = re.compile(pattern, re.X | re.U).sub(self.fLink, text)
  File "c:\Python27\lib\site-packages\textile\core.py", line 1203, in fLink
    out = ''.join([pre, out, post, tail])
TypeError: sequence item 3: expected string or Unicode, NoneType found
>>> 

I don't know what is Textile 2.5 which is mentioned at TODO.textile, but this spec is at least 8 years old, so python-textile may have to render this correctly, or at least it should not stop render by Exception but should ignore this markup.

ikirudennis commented 8 years ago

This is resolved in the develop branch. It will be merged in soon-ish.