Re: escaping Text so that's docutils doesn't try to format it?
Erik Stein <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks, David. One additional question: Is it safe to just prefix every string like this (which shouldn't be interpreted by docutils), or might there be cases where the backslash ends up in the resulting document? Best -- erik On 04.06.2018 17:16, David Goodger wrote: > 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 > _______________________________________________ > Docutils-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/docutils-users > > Please use "Reply All" to reply to the list. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot