On Mon, Apr 5, 2010 at 3:22 AM, Georg Brandl <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Am 05.03.2010 00:59, schrieb Kevin Horn:
> > I'm creating a Sphinx extension which just adds a custom docutils
> > "role".  A couple of questions:
> >
> > 1) What's the opinion of the list on whether to use a standard "role
> > function" or the CustomRole class in docutils.parsers.rst.roles.py
> > <http://docutils.parsers.rst.roles.py>?  Which is better and why?
>
> CustomRole is meant mostly for the implementation of the "role" directive,
> which you can use to add custom roles in reST documents themselves.
>
> If you need the capabilities of CustomRole (adding options and content
> automatically), you can use it, otherwise I would use a normal role
> function.
>
> > 2) What's the best way to access a Sphinx config variable in my role
> > function/class?  Pass the Sphinx app object into the function/class in
> > my extensions setup function? Or is there a better way?
>
> You can get at the app via document.settings.env.app.
>
> cheers,
> Georg
>

Yes, but how do I get a reference to "document" inside my role function?  Is
it a global variable?

Kevin Horn

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to