From: David Goodger <goodger@py...> - 2008-02-25 19:27:09
On Mon, Feb 25, 2008 at 2:16 PM, David Priest <davidp@...> wrote:
> The following snippet fails with
> "DocTreeInput instance has no attribute 'startswith'"
> doctree = core.publish_doctree(
> parts = core.publish_parts(
> What I'm trying to do:
> 1. get the doctree
> 2. modify the doctree
> 3. extract parts['fragment'] for display
> core.publish_doctree does function correctly; I am not yet modifying
> the doctree so there are no self-induced errors in it; and
> core.publish_parts does, when given the book.txt source instead of the
> doctree, parse thefile correctly and provide access to
docutils.core.publish_parts isn't designed to handle doctree input;
docutils.core.publish_from_doctree is. You may be able to get the
results you want, but I'm not sure. Compare publish_parts and
publish_from_doctree, and note the source_class and parser_name
defaults. You'll have to match the publish_parts parameters to the
values used in publish_from_doctree.
If you can't, you'll have to roll your own.
David Goodger <http://python.net/~goodger>