Re: escaping Text so that's docutils doesn't try to format it?
David Goodger <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <CABiJP=+y7CiT-X8QBEK0um1fTVefV1Wy1Ro8ceRMSdS-7Zu4Wg@mail.gmail.com> |
On 4 June 2018 at 09:39, Erik Stein <[email protected]> wrote: > > Hello -- > > I'm using docutils to semi-automatically construct certain content pages. > I've got the problem that sometimes people enter text which in the context > of a restructured text file has some semantical meaning, but this is not the > intention in the actual case. > > E.g. > > "v. l. Donald Trump, Kim Jong UN" > > where "v. l." means "from left to right" in a photo. > > Docutils interprets this as a roman numbered list (my guess, this is in the > context of a figure You are correct that Docutils is interpreting this text as a list. In fact, this specific text will be interpreted as two nested lowercase-alphabetic enumerated lists. > is there a (python) function in docutils which allows to escape a string in > a way that docutils simply renders it as text? There is no generic "escape all" function in Docutils. In many cases, simply prefixing a backslash to the text will escape it: $ rst2pseudoxml.py <<EOF > \v. l. a b c > > EOF <document source="<stdin>"> <paragraph> v. l. a b c David Goodger <http://python.net/~goodger> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot