docutils.readers.doctree module

Reader for existing document trees.

class Reader(parser=None, parser_name=None)[source]

Bases: ReReader

Adapt the Reader API for an existing document tree.

The existing document tree must be passed as the source parameter to the docutils.core.Publisher initializer, wrapped in a docutils.io.DocTreeInput object:

pub = docutils.core.Publisher(
    ..., source=docutils.io.DocTreeInput(document), ...)

The original document settings are overridden; if you want to use the settings of the original document, pass settings=document.settings to the Publisher call above.

supported = ('doctree',)

Name and aliases for this component. Override in subclasses.

config_section = 'doctree reader'

The name of the config file section specific to this component (lowercase, no brackets). Override in subclasses.

config_section_dependencies = ('readers',)

A list of names of config file sections that are to be applied before config_section, in order (from general to specific). In other words, the settings in config_section are to be overlaid on top of the settings from these sections. The “general” section is assumed implicitly. Override in subclasses.

parse()[source]

No parsing to do; refurbish the document tree instead. Overrides the inherited method.