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

Class Body

State --+        
        |        
  StateWS --+    
            |    
     RSTState --+
                |
               Body

Known Subclasses:
RFC2822Body, SpecializedBody, SubstitutionDef

Generic classifier of the first line of a block.
Method Summary
  add_target(self, targetname, refuri, target)
  anonymous(self, match, context, next_state)
Anonymous hyperlink targets.
  anonymous_target(self, match)
  block_quote(self, indented, line_offset)
  build_table(self, tabledata, tableline)
  build_table_row(self, rowdata, tableline)
  bullet(self, match, context, next_state)
Bullet list item.
  check_attribution(self, indented, line_offset)
Check for an attribution in the last contiguous block of indented.
  citation(self, match)
  comment(self, match)
  directive(self, match, **option_presets)
  doctest(self, match, context, next_state)
  enumerator(self, match, context, next_state)
Enumerated List Item
  explicit_construct(self, match)
Determine which explicit construct this is, parse & return it.
  explicit_list(self, blank_finish)
Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets).
  explicit_markup(self, match, context, next_state)
Footnotes, hyperlink targets, directives, comments.
  field(self, match)
  field_marker(self, match, context, next_state)
Field list item.
  footnote(self, match)
  grid_table_top(self, match, context, next_state)
Top border of a full table.
  hyperlink_target(self, match)
  indent(self, match, context, next_state)
Block quote.
  is_enumerated_list_item(self, ordinal, sequence, format)
Check validity based on the ordinal value and the second line.
  is_reference(self, reference)
  isolate_grid_table(self)
  isolate_simple_table(self)
  line(self, match, context, next_state)
Section title overline or transition marker.
  list_item(self, indent)
  make_enumerator(self, ordinal, sequence, format)
Construct and return an enumerated list item marker.
  malformed_table(self, block, detail)
  option_list_item(self, match)
  option_marker(self, match, context, next_state)
Option list item.
  parse_attribution(self, indented, line_offset)
  parse_directive(self, directive_fn, match, type_name, option_presets)
Parse a directive then run its directive function.
  parse_directive_arguments(self, argument_spec, arg_block)
  parse_directive_options(self, option_presets, option_spec, arg_block)
  parse_enumerator(self, match, expected_sequence)
Analyze an enumerator and return the results.
  parse_extension_options(self, option_spec, datalines)
Parse datalines for a field list containing extension options matching option_spec.
  parse_field_body(self, indented, offset, node)
  parse_field_marker(self, match)
Extract & return field name from a field marker match.
  parse_option_marker(self, match)
Return a list of node.option and node.option_argument objects, parsed from an option marker match.
  simple_table_top(self, match, context, next_state)
Top border of a simple table.
  substitution_def(self, match)
  table(self, isolate_function, parser_class)
Parse a table.
  table_top(self, match, context, next_state, isolate_function, parser_class)
Top border of a generic table.
  text(self, match, context, next_state)
Titles, definition lists, paragraphs.
  unknown_directive(self, type_name)
    Inherited from RSTState
  __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).
  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
SRE_Pattern attribution_pattern = --(?![-\n]) *(?=[^ \n])
Struct enum = <docutils.parsers.rst.states.Struct instance at 0...
Struct explicit = <docutils.parsers.rst.states.Struct instance ...
str format = 'period'
SRE_Pattern grid_table_top_pat = \+-[-\+]+-\+ *$
tuple initial_transitions = ('bullet', 'enumerator', 'field_ma...
dict pats = {'alphanumplus': '[a-zA-Z0-9_-]', 'parens': '(?P<...
dict patterns = {'enumerator': '((?P<parens>\\(([0-9]+|[a-z]|...
str sequence = 'upperroman'
SRE_Pattern simple_table_border_pat = =+[ =]*$
SRE_Pattern simple_table_top_pat = =+( +=+)+ *$
    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 nested_sm = None                                                                  
NoneType nested_sm_kwargs = None                                                                  

Method Details

anonymous(self, match, context, next_state)

Anonymous hyperlink targets.

bullet(self, match, context, next_state)

Bullet list item.

check_attribution(self, indented, line_offset)

Check for an attribution in the last contiguous block of indented.

  • First line after last blank line must begin with "--" (etc.).
  • Every line after that must have consistent indentation.

Return a 3-tuple: (block quote lines, attribution lines, attribution offset).

enumerator(self, match, context, next_state)

Enumerated List Item

explicit_construct(self, match)

Determine which explicit construct this is, parse & return it.

explicit_list(self, blank_finish)

Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets).

explicit_markup(self, match, context, next_state)

Footnotes, hyperlink targets, directives, comments.

field_marker(self, match, context, next_state)

Field list item.

grid_table_top(self, match, context, next_state)

Top border of a full table.

indent(self, match, context, next_state)

Block quote.
Overrides:
docutils.statemachine.StateWS.indent

is_enumerated_list_item(self, ordinal, sequence, format)

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

Return true iff the ordinal is valid and the second line is blank, indented, or starts with the next enumerator.

line(self, match, context, next_state)

Section title overline or transition marker.

make_enumerator(self, ordinal, sequence, format)

Construct and return an enumerated list item marker.

Return None for invalid (out of range) ordinals.

option_marker(self, match, context, next_state)

Option list item.

parse_directive(self, directive_fn, match, type_name, option_presets)

Parse a directive then run its directive function.

Parameters:

  • directive_fn: The function implementing the directive. Uses function attributes arguments, options, and/or content if present.
  • 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.

parse_enumerator(self, match, expected_sequence=None)

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).

parse_extension_options(self, option_spec, datalines)

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.
Returns:
  • Success value, 1 or 0.
  • An option dictionary on success, an error string on failure.

parse_field_marker(self, match)

Extract & return field name from a field marker match.

parse_option_marker(self, match)

Return a list of node.option and node.option_argument objects, parsed from an option marker match.

simple_table_top(self, match, context, next_state)

Top border of a simple table.

table(self, isolate_function, parser_class)

Parse a table.

table_top(self, match, context, next_state, isolate_function, parser_class)

Top border of a generic table.

text(self, match, context, next_state)

Titles, definition lists, paragraphs.

Class Variable Details

attribution_pattern

Type:
SRE_Pattern
Value:
--(?![-\n]) *(?=[^ \n])                                                

enum

Type:
Struct
Value:
<docutils.parsers.rst.states.Struct instance at 0x8302d5c>             

explicit

Type:
Struct
Value:
<docutils.parsers.rst.states.Struct instance at 0x815ecdc>             

format

Type:
str
Value:
'period'                                                               

grid_table_top_pat

Type:
SRE_Pattern
Value:
\+-[-\+]+-\+ *$                                                        

initial_transitions

Type:
tuple
Value:
('bullet',
 'enumerator',
 'field_marker',
 'option_marker',
 'doctest',
 'grid_table_top',
 'simple_table_top',
 'explicit_markup',
...                                                                    

pats

Type:
dict
Value:
{'alpha': '[a-zA-Z]',
 'alphanum': '[a-zA-Z0-9]',
 'alphanumplus': '[a-zA-Z0-9_-]',
 'enum': '([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+)',
 'nonalphanum7bit': '[!-/:-@[-`{-~]',
 'optarg': '[a-zA-Z][a-zA-Z0-9_-]*',
 'option': '(--?|\\+|/)[a-zA-Z0-9][a-zA-Z0-9_-]*([ =][a-zA-Z][a-zA-Z0-\
9_-]*)?',
...                                                                    

patterns

Type:
dict
Value:
{'anonymous': '__( +|$)',
 'blank': ' *$',
 'bullet': '[-+*]( +|$)',
 'doctest': '>>>( +|$)',
 'enumerator': '((?P<parens>\\(([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM\
]+)\\))|(?P<rparen>([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+)\\))|(?P<\
period>([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+)\\.))( +|$)',
 'explicit_markup': '\\.\\.( +|$)',
...                                                                    

sequence

Type:
str
Value:
'upperroman'                                                           

simple_table_border_pat

Type:
SRE_Pattern
Value:
=+[ =]*$                                                               

simple_table_top_pat

Type:
SRE_Pattern
Value:
=+( +=+)+ *$                                                           

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