class documentation

reStructuredText State superclass. Contains methods used by all State subclasses.

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:

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 indent Handle an indented text block. Extend or override in subclasses.
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.
Instance Variable patterns {Name: pattern} mapping, used by `make_transition()`. Each pattern may be a string or a compiled `re` pattern. Override in subclasses.

Inherited from State (via 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.
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.
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 __init__(self, state_machine, debug=False): (source)

Initialize a `StateSM` object; extends `State.__init__()`. Check for indent state machine attributes, set defaults if not set.

def bof(self, context): (source)

Called at beginning of file.

def check_subsection(self, source, style, lineno): (source)

Check for a valid subsection header. Return True or False. When a new section is reached that isn't a subsection of the current section, back up the line count (use ``previous_line(-x)``), then ``raise EOFError``. The current StateMachine will finish, then the calling StateMachine can re-examine the title. This will work its way back up the calling chain until the correct section level isreached. @@@ Alternative: Evaluate the title, store the title info & level, and back up the chain until that level is reached. Store in memo? Or return in results? :Exception: `EOFError` when a sibling or supersection encountered.

def goto_line(self, abs_line_offset): (source)

Jump to input line `abs_line_offset`, ignoring jumps past the end.

def inline_text(self, text, lineno): (source)

Return 2 lists: nodes (text and inline elements), and system_messages.

def nested_list_parse(self, block, input_offset, node, initial_state, blank_finish, blank_finish_state=None, extra_settings={}, match_titles=False, state_machine_class=None, state_machine_kwargs=None): (source)

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.

def nested_parse(self, block, input_offset, node, match_titles=False, state_machine_class=None, state_machine_kwargs=None): (source)

Create a new StateMachine rooted at `node` and run it over the input `block`.

def new_subsection(self, title, lineno, messages): (source)

Append new subsection to document tree. On return, check level.

def no_match(self, context, transitions): (source)

Override `StateWS.no_match` to generate a system message. This code should never be run.

def paragraph(self, lines, lineno): (source)

Return a list (paragraph & messages) & a boolean: literal_block next?

def runtime_init(self): (source)

Initialize this `State` before running the state machine; called from `self.state_machine.run()`.

def section(self, title, source, style, lineno, messages): (source)

Check for a valid subsection and create one if it checks out.

def title_inconsistent(self, sourcetext, lineno): (source)

Undocumented

def unindent_warning(self, node_name): (source)

Undocumented

nested_sm_cache: list = (source)

Undocumented

document = (source)

Undocumented

inliner = (source)

Undocumented

memo = (source)

Undocumented

nested_sm_kwargs = (source)

Keyword arguments dictionary, passed to the `nested_sm` constructor. Two keys must have entries in the dictionary: - Key 'state_classes' must be set to a list of `State` classes. - Key 'initial_state' must be set to the name of the initial state class. If `nested_sm_kwargs` is left as ``None``, 'state_classes' defaults to the class of the current state, and 'initial_state' defaults to the name of the class of the current state. Override in subclasses to avoid the defaults.

parent = (source)

Undocumented

reporter = (source)

Undocumented