Package docutils :: Package parsers :: Package rst :: Module states :: Class RSTState
[show private | hide private]
[frames | no frames]

Class RSTState

State --+    
        |    
  StateWS --+
            |
           RSTState

Known Subclasses:
Body, Text

reStructuredText State superclass.

Contains methods used by all State subclasses.


Method Summary
  __init__(self, state_machine, debug)
Initialize a StateSM object; extends State.__init__().
  bof(self, context)
Called at beginning of file.
  check_section(self, section)
Check for illegal structure: empty section, misplaced transitions.
  check_subsection(self, source, style, lineno)
Check for a valid subsection header.
  goto_line(self, abs_line_offset)
Jump to input line abs_line_offset, ignoring jumps past the end.
  inline_text(self, text, lineno)
Return 2 lists: nodes (text and inline elements), and system_messages.
  nested_list_parse(self, block, input_offset, node, initial_state, blank_finish, blank_finish_state, extra_settings, match_titles, state_machine_class, state_machine_kwargs)
Create a new StateMachine rooted at node and run it over the input block.
  nested_parse(self, block, input_offset, node, match_titles, state_machine_class, state_machine_kwargs)
Create a new StateMachine rooted at node and run it over the input block.
  new_subsection(self, title, lineno, messages)
Append new subsection to document tree.
  no_match(self, context, transitions)
Override StateWS.no_match to generate a system message.
  paragraph(self, lines, lineno)
Return a list (paragraph & messages) & a boolean: literal_block next?
  runtime_init(self)
Initialize this State before running the state machine; called from self.state_machine.run().
  section(self, title, source, style, lineno, messages)
Check for a valid subsection and create one if it checks out.
  title_inconsistent(self, sourcetext, lineno)
  unindent_warning(self, node_name)
    Inherited from StateWS
  add_initial_transitions(self)
Add whitespace-specific transitions before those defined in subclass.
  blank(self, match, context, next_state)
Handle blank lines.
  first_known_indent(self, match, context, next_state)
Handle an indented text block (first line's indent known).
  indent(self, match, context, next_state)
Handle an indented text block.
  known_indent(self, match, context, next_state)
Handle a known-indent text block.
    Inherited from State
  add_transition(self, name, transition)
Add a transition to the start of the transition list.
  add_transitions(self, names, transitions)
Add a list of transitions to the start of the transition list.
  eof(self, context)
Handle end-of-file.
  make_transition(self, name, next_state)
Make & return a transition tuple based on name.
  make_transitions(self, name_list)
Return a list of transition names and a transition mapping.
  nop(self, match, context, next_state)
A "do nothing" transition method.
  remove_transition(self, name)
Remove a transition by name.
  unlink(self)
Remove circular references to objects no longer required.

Class Variable Summary
class nested_sm = docutils.parsers.rst.states.NestedStateMachine
    Inherited from StateWS
NoneType indent_sm = None                                                                  
NoneType indent_sm_kwargs = None                                                                  
NoneType known_indent_sm = None                                                                  
NoneType known_indent_sm_kwargs = None                                                                  
tuple ws_initial_transitions = ('blank', 'indent')
dict ws_patterns = {'indent': ' +', 'blank': ' *$'}
    Inherited from State
NoneType initial_transitions = None                                                                  
NoneType nested_sm_kwargs = None                                                                  
NoneType patterns = None                                                                  

Method Details

__init__(self, state_machine, debug=0)
(Constructor)

Initialize a StateSM object; extends State.__init__().

Check for indent state machine attributes, set defaults if not set.

Overrides:
docutils.statemachine.StateWS.__init__ (inherited documentation)

bof(self, context)

Called at beginning of file.
Overrides:
docutils.statemachine.State.bof

check_section(self, section)

Check for illegal structure: empty section, misplaced transitions.

check_subsection(self, source, style, lineno)

Check for a valid subsection header. Return 1 (true) or None (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?

goto_line(self, abs_line_offset)

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

inline_text(self, text, lineno)

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

nested_list_parse(self, block, input_offset, node, initial_state, blank_finish, blank_finish_state=None, extra_settings={}, match_titles=0, state_machine_class=None, state_machine_kwargs=None)

Create a new StateMachine rooted at node and run it over the input block. Also keep track of optional intermdediate blank lines and the required final one.

nested_parse(self, block, input_offset, node, match_titles=0, state_machine_class=None, state_machine_kwargs=None)

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

new_subsection(self, title, lineno, messages)

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

no_match(self, context, transitions)

Override StateWS.no_match to generate a system message.

This code should never be run.

Overrides:
docutils.statemachine.State.no_match

paragraph(self, lines, lineno)

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

runtime_init(self)

Initialize this State before running the state machine; called from self.state_machine.run().
Overrides:
docutils.statemachine.State.runtime_init (inherited documentation)

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

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

Generated by Epydoc 2.0 on Tue Jul 22 05:31:19 2003 http://epydoc.sf.net