[Doc-SIG] The Use of Roles

Aahz aahz at pythoncraft.com
Tue Jun 10 01:51:56 EDT 2003


On Mon, Jun 09, 2003, David Priest wrote:
> 
> Why not allow users to add Roles in much the same manner that Directives 
> can be added?  I'd much rather hack an __init__ file and add a .py role- 
> handler, than hack the Docutils source itself.

It's not much more difficult.  Read
docutils/parsers/rst/__init__.py

Mainly, you need to subclass from rst.states.Inliner, and you'll need to
update rst.languages.en.roles when your module gets imported.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra



More information about the Doc-SIG mailing list