Hi!

In one of my applications [1] I'm using the docutils.core.publish_doctree
method to parse rst files. This method directly returns the doctree which I
use to display some information about the file (currently the structure of the
file and parsing errors/warnings).

Now I would like to add support for Sphinx. My basic requirement is pretty
simple: I would like to get the doctree of a single rst file which contains
Sphinx specific markup (no support for extensions for the moment).

So far I can think about two possibilities for the implementation:

1. Via an extension that adds a custom Builder (the doctree is passed
   as an argument to the `write_doc` method)
2. A more low level approach that creates a
   sphinx.environment.BuildEnvironment instance (as far as I understood it,
   Sphinx directives and roles are registered at this point and are known by
   docutils afterwards) and uses one of the docutils publish methods.

The first approach seems a bit clunky but it uses the official API...

Any hints how to proceed? Is there a better way to do this?

Thanks a lot!

--
Bernhard Leiner           http://bernh.net

[1] http://bernh.net/projects/pida-rst-plugin/

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

Reply via email to