[py-svn] r33702 - in py/dist/py/rst: . testing
guido at codespeak.net
guido at codespeak.net
Wed Oct 25 01:16:05 CEST 2006
Author: guido
Date: Wed Oct 25 01:16:03 2006
New Revision: 33702
Modified:
py/dist/py/rst/rst.py
py/dist/py/rst/testing/test_rst.py
Log:
Not escaping link target anymore (can result in broken links), added _ to the
list of to-be-escaped characters.
Modified: py/dist/py/rst/rst.py
==============================================================================
--- py/dist/py/rst/rst.py (original)
+++ py/dist/py/rst/rst.py Wed Oct 25 01:16:03 2006
@@ -15,7 +15,9 @@
def escape(txt):
"""escape ReST markup"""
- for c in '\\*`[|:':
+ # XXX this takes a very naive approach to escaping, but it seems to be
+ # sufficient...
+ for c in '\\*`[|:_':
txt = txt.replace(c, '\\%s' % (c,))
return txt
@@ -111,7 +113,7 @@
link_texts = []
# XXX this could check for duplicates and remove them...
for link, target in self.links.iteritems():
- link_texts.append(".. _`%s`: %s" % (escape(link), escape(target)))
+ link_texts.append(".. _`%s`: %s" % (escape(link), target))
return "\n" + "\n".join(link_texts) + "\n\n"
def text(self, escape=True):
Modified: py/dist/py/rst/testing/test_rst.py
==============================================================================
--- py/dist/py/rst/testing/test_rst.py (original)
+++ py/dist/py/rst/testing/test_rst.py Wed Oct 25 01:16:03 2006
@@ -10,7 +10,7 @@
txt = Paragraph(Strong('*strong*')).text()
assert txt == '**\\*strong\\***'
txt = Rest(Paragraph(Link('foo[bar]', 'foo[bar]'))).text()
- assert txt == "`foo\\[bar]`_\n\n.. _`foo\\[bar]`: foo\\[bar]\n\n"
+ assert txt == "`foo\\[bar]`_\n\n.. _`foo\\[bar]`: foo[bar]\n\n"
def test_escape_literal():
txt = LiteralBlock('*escape* ``test``').text()
More information about the pytest-commit
mailing list