class documentation

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 True or 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 A mapping of transition names to 3-tuples containing (compiled_pattern, transition_method, next_state_name). Initialized as an instance attribute dynamically (instead of as a class attribute) because it may make forward references to patterns and methods in this or other classes.
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. :Return: - 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). 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.

def parse_extension_options(self, option_spec, datalines): (source)

Parse `datalines` for a field list containing extension options matching `option_spec`. :Parameters: - `option_spec`: a mapping of option name to conversion function, which should raise an exception on bad input. - `datalines`: a list of input strings. :Return: - 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. :Exception: `MarkupError` for invalid option markers.

def parse_target(self, block, block_text, lineno): (source)

Determine the type of reference of a target. :Return: 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, attribution lines, attribution offset, remaining indented lines, remaining lines offset).

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.

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.