4.4.1.1.9. readers

This package contains Docutils Reader modules.

class docutils.readers.ReReader(parser=None, parser_name=None)[source]

Bases: docutils.readers.Reader

A reader which rereads an existing document tree (e.g. a deserializer).

Often used in conjunction with writers.UnfilteredWriter.

Initialize the Reader instance.

Several instance attributes are defined with dummy initial values. Subclasses may use these attributes as they wish.

get_transforms()[source]
class docutils.readers.Reader(parser=None, parser_name=None)[source]

Bases: docutils.Component

Abstract base class for docutils Readers.

Each reader module or package must export a subclass also called ‘Reader’.

The two steps of a Reader’s responsibility are scan() and parse(). Call read() to process a document.

Initialize the Reader instance.

Several instance attributes are defined with dummy initial values. Subclasses may use these attributes as they wish.

component_type = 'reader'
config_section = 'readers'
get_transforms()[source]
input = None

Raw text input; either a single string or, for more complex cases, a collection of strings.

new_document()[source]

Create and return a new empty document tree (root node).

parse()[source]

Parse self.input into a document tree.

parser = None

A parsers.Parser instance shared by all doctrees. May be left unspecified if the document source determines the parser.

read(source, parser, settings)[source]
set_parser(parser_name)[source]

Set self.parser by name.

source = None

docutils.io IO object, source of input data.

docutils.readers.get_reader_class(reader_name)[source]

Return the Reader class from the reader_name module.