|
From: David G. <go...@py...> - 2008-12-24 16:12:14
|
On Tue, Dec 23, 2008 at 15:38, Christian Siefkes <chr...@si...> wrote: > I would like to change the `default role` to ``literal`` in all my reST > documents. In a single document, I can write > > .. default-role:: literal > > But I didn't find a way to automatically specify such a setting for all > documents I process. I guess it must be configurable in some way, but > http://docutils.sourceforge.net/docs/user/config.html doesn't mention > anything. Can anybody help me out? There is no way to change the default role globally via configuration files. Why do you want to make such a change? I recommend that you do not change the default role to "literal", for a couple of reasons. 1. ``literal`` is the standard; your text will become non-standard and non-portable. 2. ``text`` is not significantly more difficult to type than `text`. 2. ``...`` has different behavior than :literal:`...` (e.g. :literal:`a\ b \c` vs. ``a\ b \c``, etc.). If you insist on doing it, you could make a custom front-end tool. Copy an existing tool, and add code like this: import docutils.parsers.rst.roles docutils.parsers.rst.roles.DEFAULT_INTERPRETED_ROLE = 'literal' That ought to work (note: untested). Another possibility is to add config functionality. Patches are welcome. -- David Goodger <http://python.net/~goodger> |