Thanks Jens,
For those who would like to try it out, here is the patch made on a recent svn checkout of docutils.
The patch adds the latex-math role and directive to docutils. Using it, you should be able to run epydoc and
generate pdf output from the docstrings of any python module (correctly formated, that is). The html output doesn't work very well for me, but that may be due to my browser not supporting MathML fonts.
The next step would be to add support for the :input:, :ouput:, :example: and :see also: tags. It shouldn't be difficult, but I'll leave that to someone else : )
To see it in action, try
epydoc --pdf epytest.py
Cheers,
David
On Tue, 2006-12-19 at 15:34 -0500, David Huard wrote:
> If I understand correctly, I'd have to add the latex-math
> role to rst/roles.py and the latex-math directive to the
> rst/directives directory and register it in the __init__. However, the
> directives defined in Jens' sandbox are writer specific, so I'm a bit lost.
You will have to merge the code from rst2mathml.py and rst2latexmath.py.
I would start from the code in rst2mathml.py, where the node class
(latex_math) will have to be changed to something like this:
class latex_math(nodes.Element):
tagname = '#latex-math'
def __init__(self, rawsource, mathml_tree, latex):
nodes.Element.__init__(self, rawsource)
self.mathml_tree = mathml_tree
self.latex = latex
Also the latex_math_role function and the latex_math_directive class
will have to be modified a bit to use the new node class.
And then the visit/depart methods should be added to the writers.
Hope that helps,
Jens Jørgen
> A little bit of context:
> The SciPy and NumPy folks are looking at the
> various documentation systems out there to build the API documentation
> and tutorials. Up to now, the combination epydoc+reST seems to most
> powerful. However, Latex formulas are a must for those packages and the
> raw role is a bit low-level for our needs, hence the interest in
> including the latex-math role and directive in the trunk so that epydoc
> can run smoothly using it.