Help save net neutrality! Learn more.
Close

#3 Escaping '\' characters in RST

open
nobody
Code Change (2)
5
2011-01-05
2011-01-05
No

Hello,

I'd like to suggest a patch to pyWeb 2.2 related to RST generation. As
I see, RST output is not escaping '\' characters properly. For example
the attached input file "a.w":

------->8------------ [start of "a.w"]
Testing '\\' characters

@o a.xml
@{
<target name="removeStatics">
<mkdir dir="${remove_to}\eto\buttons" />
<move todir="${remove_to}\eto\buttons">
<fileset dir="${webContent}\eto\buttons"/>
</move>
</target>
@}
-------8<------------ [end of "a.w"]

should produce

------->8------------ [start of "a.rst"]
Testing '\\' characters

.. _`1`:
.. rubric:: a.xml (1)
.. parsed-literal::

<target name="removeStatics">
<mkdir dir="${remove\_to}\\eto\\buttons" />
<move todir="${remove\_to}\\eto\\buttons">
<fileset dir="${webContent}\\eto\\buttons"/>
</move>
</target>
-------8<------------ [end of "a.rst"]

but currently produces

------->8------------ [start of "a.rst"]
Testing '\\' characters

.. _`1`:
.. rubric:: a.xml (1)
.. parsed-literal::

<target name="removeStatics">
<mkdir dir="${remove\_to}\eto\buttons" />
<move todir="${remove\_to}\eto\buttons">
<fileset dir="${webContent}\eto\buttons"/>
</move>
</target>
-------8<------------ [end of "a.rst"]

Suggested fix is for section
Weaver quoted characters (21)

------->8------------ [start of update]
quoted_chars = [
# prevent some RST markup from being recognized
('\\',r'\\'),
('`',r'\`'),
('_',r'\_'),
('*',r'\*'),
('|',r'\|'),
]
-------8<------------ [end of update]

Best regards,
Egor

Discussion


Log in to post a comment.