class documentation

class Body(RSTState): (source)

Known subclasses: docutils.parsers.rst.states.RFC2822Body, docutils.parsers.rst.states.SpecializedBody, docutils.parsers.rst.states.SubstitutionDef

View In Hierarchy

Generic classifier of the first line of a block.
Method add​_target Undocumented
Method anonymous Anonymous hyperlink targets.
Method anonymous​_target Undocumented
Method block​_quote Undocumented
Method build​_table Undocumented
Method build​_table​_row Undocumented
Method bullet Bullet list item.
Method check​_attribution Check attribution shape. Return the index past the end of the attribution, and the indent.
Method citation Undocumented
Method comment Undocumented
Method directive Returns a 2-tuple: list of nodes, and a "blank finish" boolean.
Method disallowed​_inside​_substitution​_definitions Undocumented
Method doctest Undocumented
Method enumerator Enumerated List Item
Method explicit​_construct Determine which explicit construct this is, parse & return it.
Method explicit​_list Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets).
Method explicit​_markup Footnotes, hyperlink targets, directives, comments.
Method field Undocumented
Method field​_marker Field list item.
Method footnote Undocumented
Method grid​_table​_top Top border of a full table.
Method hyperlink​_target Undocumented
Method indent Block quote.
Method is​_enumerated​_list​_item Check validity based on the ordinal value and the second line.
Method is​_reference Undocumented
Method isolate​_grid​_table Undocumented
Method isolate​_simple​_table Undocumented
Method line Section title overline or transition marker.
Method line​_block First line of a line block.
Method line​_block​_line Return one line element of a line_block.
Method list​_item Undocumented
Method make​_enumerator Construct and return the next enumerated list item marker, and an auto-enumerator ("#" instead of the regular enumerator).
Method make​_target Undocumented
Method malformed​_table Undocumented
Method nest​_line​_block​_lines Undocumented
Method nest​_line​_block​_segment Undocumented
Method option​_list​_item Undocumented
Method option​_marker Option list item.
Method parse​_attribution Undocumented
Method parse​_directive​_arguments Undocumented
Method parse​_directive​_block Undocumented
Method parse​_directive​_options Undocumented
Method parse​_enumerator Analyze an enumerator and return the results.
Method parse​_extension​_options Parse datalines for a field list containing extension options matching option_spec.
Method parse​_field​_body Undocumented
Method parse​_field​_marker Extract & return field name from a field marker match.
Method parse​_option​_marker Return a list of node.option and node.option_argument objects, parsed from an option marker match.
Method parse​_target Determine the type of reference of a target.
Method run​_directive Parse a directive then run its directive function.
Method simple​_table​_top Top border of a simple table.
Method split​_attribution Check for a block quote attribution and split it off:
Method substitution​_def Undocumented
Method table Parse a table.
Method table​_top Top border of a generic table.
Method text Titles, definition lists, paragraphs.
Method unknown​_directive Undocumented
Class Variable attribution​_pattern Undocumented
Class Variable enum Enumerated list parsing information.
Class Variable explicit Patterns and constants used for explicit markup recognition.
Class Variable grid​_table​_top​_pat Matches the top (& bottom) of a full table).
Class Variable initial​_transitions A list of transitions to initialize when a State is instantiated. Each entry is either a transition name string, or a (transition name, next state name) pair. See make_transitions(). Override in subclasses.
Class Variable pats Fragments of patterns used by transitions.
Class Variable patterns {Name: pattern} mapping, used by make_transition(). Each pattern may be a string or a compiled re pattern. Override in subclasses.
Class Variable simple​_table​_border​_pat Matches the bottom & header bottom of a simple table.
Class Variable simple​_table​_top​_pat Matches the top of a simple table.

Inherited from RSTState:

Method __init__ Initialize a StateSM object; extends State.__init__().
Method bof Called at beginning of file.
Method check​_subsection Check for a valid subsection header. Return 1 (true) or None (false).
Method goto​_line Jump to input line abs_line_offset, ignoring jumps past the end.
Method inline​_text Return 2 lists: nodes (text and inline elements), and system_messages.
Method nested​_list​_parse Create a new StateMachine rooted at node and run it over the input block. Also keep track of optional intermediate blank lines and the required final one.
Method nested​_parse Create a new StateMachine rooted at node and run it over the input block.
Method new​_subsection Append new subsection to document tree. On return, check level.
Method no​_match Override StateWS.no_match to generate a system message.
Method paragraph Return a list (paragraph & messages) & a boolean: literal_block next?
Method runtime​_init Initialize this State before running the state machine; called from self.state_machine.run().
Method section Check for a valid subsection and create one if it checks out.
Method title​_inconsistent Undocumented
Method unindent​_warning Undocumented
Class Variable nested​_sm​_cache Undocumented
Instance Variable document Undocumented
Instance Variable inliner Undocumented
Instance Variable memo Undocumented
Instance Variable nested​_sm​_kwargs Keyword arguments dictionary, passed to the nested_sm constructor.
Instance Variable parent Undocumented
Instance Variable reporter Undocumented

Inherited from StateWS (via RSTState):

Method add​_initial​_transitions Add whitespace-specific transitions before those defined in subclass.
Method blank Handle blank lines. Does nothing. Override in subclasses.
Method first​_known​_indent Handle an indented text block (first line's indent known).
Method known​_indent Handle a known-indent text block. Extend or override in subclasses.
Class Variable ws​_initial​_transitions Default initial whitespace transitions, added before those listed in State.initial_transitions. May be overridden in subclasses.
Class Variable ws​_patterns Patterns for default whitespace transitions. May be overridden in subclasses.
Instance Variable indent​_sm The StateMachine class handling indented text blocks.
Instance Variable indent​_sm​_kwargs Keyword arguments dictionary, passed to the indent_sm constructor.
Instance Variable known​_indent​_sm The StateMachine class handling known-indented text blocks.
Instance Variable known​_indent​_sm​_kwargs Keyword arguments dictionary, passed to the known_indent_sm constructor.

Inherited from State (via RSTState, StateWS):

Method add​_transition Add a transition to the start of the transition list.
Method add​_transitions Add a list of transitions to the start of the transition list.
Method eof Handle end-of-file. Return empty result.
Method make​_transition Make & return a transition tuple based on name.
Method make​_transitions Return a list of transition names and a transition mapping.
Method nop A "do nothing" transition method.
Method remove​_transition Remove a transition by name.
Method unlink Remove circular references to objects no longer required.
Instance Variable debug Debugging mode on/off.
Instance Variable nested​_sm The StateMachine class for handling nested processing.
Instance Variable state​_machine A reference to the controlling StateMachine object.
Instance Variable transition​_order A list of transition names in search order.
Instance Variable transitions No summary
def add_target(self, targetname, refuri, target, lineno): (source)

Undocumented

def anonymous(self, match, context, next_state): (source)
Anonymous hyperlink targets.
def anonymous_target(self, match): (source)

Undocumented

def block_quote(self, indented, line_offset): (source)

Undocumented

def build_table(self, tabledata, tableline, stub_columns=0, widths=None): (source)

Undocumented

def build_table_row(self, rowdata, tableline): (source)

Undocumented

def bullet(self, match, context, next_state): (source)
Bullet list item.
def check_attribution(self, indented, attribution_start): (source)
Check attribution shape. Return the index past the end of the attribution, and the indent.
def citation(self, match): (source)

Undocumented

def comment(self, match): (source)

Undocumented

def directive(self, match, **option_presets): (source)
Returns a 2-tuple: list of nodes, and a "blank finish" boolean.
def disallowed_inside_substitution_definitions(self, node): (source)

Undocumented

def doctest(self, match, context, next_state): (source)

Undocumented

def enumerator(self, match, context, next_state): (source)
Enumerated List Item
def explicit_construct(self, match): (source)
Determine which explicit construct this is, parse & return it.
def explicit_list(self, blank_finish): (source)
Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets).
def explicit_markup(self, match, context, next_state): (source)
Footnotes, hyperlink targets, directives, comments.
def field(self, match): (source)

Undocumented

def field_marker(self, match, context, next_state): (source)
def footnote(self, match): (source)

Undocumented

def grid_table_top(self, match, context, next_state): (source)
Top border of a full table.
def hyperlink_target(self, match): (source)

Undocumented

def indent(self, match, context, next_state): (source)
Block quote.
def is_enumerated_list_item(self, ordinal, sequence, format): (source)

Check validity based on the ordinal value and the second line.

Return true if the ordinal is valid and the second line is blank, indented, or starts with the next enumerator or an auto-enumerator.

def is_reference(self, reference): (source)

Undocumented

def isolate_grid_table(self): (source)

Undocumented

def isolate_simple_table(self): (source)

Undocumented

def line(self, match, context, next_state): (source)
Section title overline or transition marker.
def line_block(self, match, context, next_state): (source)
First line of a line block.
def line_block_line(self, match, lineno): (source)
Return one line element of a line_block.
def list_item(self, indent): (source)

Undocumented

def make_enumerator(self, ordinal, sequence, format): (source)

Construct and return the next enumerated list item marker, and an auto-enumerator ("#" instead of the regular enumerator).

Return None for invalid (out of range) ordinals.

def make_target(self, block, block_text, lineno, target_name): (source)

Undocumented

def malformed_table(self, block, detail='', offset=0): (source)

Undocumented

def nest_line_block_lines(self, block): (source)

Undocumented

def nest_line_block_segment(self, block): (source)

Undocumented

def option_list_item(self, match): (source)

Undocumented

def option_marker(self, match, context, next_state): (source)
Option list item.
def parse_attribution(self, indented, line_offset): (source)

Undocumented

def parse_directive_arguments(self, directive, arg_block): (source)

Undocumented

def parse_directive_block(self, indented, line_offset, directive, option_presets): (source)

Undocumented

def parse_directive_options(self, option_presets, option_spec, arg_block): (source)

Undocumented

def parse_enumerator(self, match, expected_sequence=None): (source)

Analyze an enumerator and return the results.

The enumerator format has already been determined by the regular expression match. If expected_sequence is given, that sequence is tried first. If not, we check for Roman numeral 1. This way, single-character Roman numerals (which are also alphabetical) can be matched. If no sequence has been matched, all sequences are checked in order.

Returns
  • the enumerator format ('period', 'parens', or 'rparen'),
  • the sequence used ('arabic', 'loweralpha', 'upperroman', etc.),
  • the text of the enumerator, stripped of formatting, and
  • the ordinal value of the enumerator ('a' -> 1, 'ii' -> 2, etc.; None is returned for invalid enumerator text).
def parse_extension_options(self, option_spec, datalines): (source)
Parse datalines for a field list containing extension options matching option_spec.
Parameters
option​_speca mapping of option name to conversion function, which should raise an exception on bad input.
datalinesa list of input strings.
Returns
  • Success value, 1 or 0.
  • An option dictionary on success, an error string on failure.
def parse_field_body(self, indented, offset, node): (source)
def parse_field_marker(self, match): (source)
Extract & return field name from a field marker match.
def parse_option_marker(self, match): (source)
Return a list of node.option and node.option_argument objects, parsed from an option marker match.
Unknown Field: exception
MarkupError for invalid option markers.
def parse_target(self, block, block_text, lineno): (source)
Determine the type of reference of a target.
Returns

A 2-tuple, one of:

  • 'refname' and the indirect reference name
  • 'refuri' and the URI
  • 'malformed' and a system_message node
def run_directive(self, directive, match, type_name, option_presets): (source)

Parse a directive then run its directive function.

Parameters:

  • directive: The class implementing the directive. Must be a subclass of rst.Directive.
  • match: A regular expression match object which matched the first line of the directive.
  • type_name: The directive name, as used in the source text.
  • option_presets: A dictionary of preset options, defaults for the directive options. Currently, only an "alt" option is passed by substitution definitions (value: the substitution name), which may be used by an embedded image directive.

Returns a 2-tuple: list of nodes, and a "blank finish" boolean.

def simple_table_top(self, match, context, next_state): (source)
Top border of a simple table.
def split_attribution(self, indented, line_offset): (source)

Check for a block quote attribution and split it off:

  • First line after a blank line must begin with a dash ("--", "---", em-dash; matches self.attribution_pattern).
  • Every line after that must have consistent indentation.
  • Attributions must be preceded by block quote content.

Return a tuple of: (block quote content lines, content offset, attribution lines, attribution offset, remaining indented lines).

def substitution_def(self, match): (source)

Undocumented

def table(self, isolate_function, parser_class): (source)
Parse a table.
def table_top(self, match, context, next_state, isolate_function, parser_class): (source)
Top border of a generic table.
def text(self, match, context, next_state): (source)
def unknown_directive(self, type_name): (source)

Undocumented

attribution_pattern = (source)

Undocumented

enum = (source)
Enumerated list parsing information.
explicit = (source)
Patterns and constants used for explicit markup recognition.
grid_table_top_pat = (source)
Matches the top (& bottom) of a full table).
initial_transitions: tuple[str, ...] = (source)
A list of transitions to initialize when a State is instantiated. Each entry is either a transition name string, or a (transition name, next state name) pair. See make_transitions(). Override in subclasses.
pats: dict = (source)
Fragments of patterns used by transitions.
patterns = (source)
{Name: pattern} mapping, used by make_transition(). Each pattern may be a string or a compiled re pattern. Override in subclasses.
simple_table_border_pat = (source)
Matches the bottom & header bottom of a simple table.
simple_table_top_pat = (source)
Matches the top of a simple table.