-----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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAku5ndoACgkQN9GcIYhpnLDhtACghzQxA8oHWo3yEMHMSSXa0aqR
NjwAnj4zoKVKuKKAVbh8UR1kw57OiTQX
=F7y3
-----END PGP SIGNATURE-----

-- 
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