0

So I've got a reStructuredText document which includes fields:

:param foo: set this to do magic

and I want to turn the rST into html, with special treatment of param (and other) fields.

Turning rST into html can be done with docutils.core.publish_parts as suggested here, but obviously without control of how fields are output. Or I can use docutils.core.publish_doctree as suggested here to get the pseudo-XML, and presumably (fairly tediously) modify that, but I don't see how I can control how this is translated to html.

I can see there's a HTMLTranslator class in docutils.writers.html4css1.__init__.py, but I surely can't have to modify this just to control how fields are output? I'm hoping there's some sort of template system somewhere which controls how XML is translated to html ...

Community
  • 1
  • 1
lost
  • 2,210
  • 2
  • 20
  • 34

1 Answers1

0

take a look at this and let me know if this help u out

ReStructuredText (reST)

PurityLake
  • 1,110
  • 10
  • 18
  • Well it's a minimal example of deriving from HTMLTranslator which would be OK if I had to go down this route, but doing this and setting up visit_field methods still seems way too complicated given fields are listed as an extensibility mechanism in the docutils docs. – lost Mar 08 '13 at 19:29
  • sorry that I couldn't come up with much more, reST is highly undocumented it seems – PurityLake Mar 08 '13 at 19:31