Parser for the contents of a substitution_definition element.
There are no implemented interfaces.
attribution_pattern
(type: SRE_Pattern
)
<_sre.SRE_Pattern object at 0x8d5db20>
double_width_pad_char
(type:
str
)
'\x00'
enum
(type: instance
)
<docutils.parsers.rst.states.Struct instance at 0x41f7f1ac>
explicit
(type: instance
)
<docutils.parsers.rst.states.Struct instance at 0x41fa1dec>
format
(type:
str
)
'period'
grid_table_top_pat
(type: SRE_Pattern
)
<_sre.SRE_Pattern object at 0x41fa91a0>
indent_sm
(type: NoneType
)
None
indent_sm_kwargs
(type: NoneType
)
None
initial_transitions
(type:
list
)
['embedded_directive', 'text']
known_indent_sm
(type: NoneType
)
None
known_indent_sm_kwargs
(type: NoneType
)
None
nested_sm
(type: classobj
)
<class docutils.parsers.rst.states.NestedStateMachine at 0x4137fb3c>
nested_sm_kwargs
(type: NoneType
)
None
pats
(type:
dict
)
{'alphanumplus': '[a-zA-Z0-9_-]', 'parens': '(?P<parens>\\(([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+|#)\\))', 'nonalphanum7bit': '[!-/:-@[-`{-~]', 'rparen': '(?P<rparen>([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+|#)\\))', 'option': '((-|\\+)[a-zA-Z0-9]( ?([a-zA-Z][a-zA-Z0-9_-]*|<[^<>]+>))?|(--|/)[a-zA-Z0-9][a-zA-Z0-9_-]*([ =]([a-zA-Z][a-zA-Z0-9_-]*|<[^<>]+>))?)', 'shortopt': '(-|\\+)[a-zA-Z0-9]( ?([a-zA-Z][a-zA-Z0-9_-]*|<[^<>]+>))?', 'enum': '([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+|#)', 'period': '(?P<period>([0-9]+|[a-z]|[A-Z]|[ivxlcdm]+|[IVXLCDM]+|#)\\.)', 'optname': '[a-zA-Z0-9][a-zA-Z0-9_-]*', 'alphanum': '[a-zA-Z0-9]', 'alpha': '[a-zA-Z]', 'longopt': '(--|/)[a-zA-Z0-9][a-zA-Z0-9_-]*([ =]([a-zA-Z][a-zA-Z0-9_-]*|<[^<>]+>))?', 'optarg': '([a-zA-Z][a-zA-Z0-9_-]*|<[^<>]+>)'}
patterns
(type:
dict
)
{'indent': ' +', 'embedded_directive': <_sre.SRE_Pattern object at 0x41f8bab0>, 'blank': ' *$', 'text': ''}
sequence
(type:
str
)
'upperroman'
simple_table_border_pat
(type: SRE_Pattern
)
<_sre.SRE_Pattern object at 0x41f89ab0>
simple_table_top_pat
(type: SRE_Pattern
)
<_sre.SRE_Pattern object at 0x41fb58a0>
ws_initial_transitions
(type:
tuple
)
('blank', 'indent')
ws_patterns
(type:
dict
)
{'indent': ' +', 'blank': ' *$'}
add_initial_transitions()
Add whitespace-specific transitions before those defined in subclass.
Extends State.add_initial_transitions().
add_target(targetname, refuri, target, lineno)
add_transition(name, transition)
Add a transition to the start of the transition list.
Parameter transition: a ready-made transition 3-tuple.
Exception: DuplicateTransitionError.
add_transitions(names, transitions)
Add a list of transitions to the start of the transition list.
Parameters:
Exceptions: DuplicateTransitionError, UnknownTransitionError.
anonymous(match, context, next_state)
Anonymous hyperlink targets.
anonymous_target(match)
blank(match, context, next_state)
Handle blank lines. Does nothing. Override in subclasses.
block_quote(indented, line_offset)
bof(context)
Called at beginning of file.
build_table(tabledata, tableline, stub_columns=0)
build_table_row(rowdata, tableline)
bullet(match, context, next_state)
Bullet list item.
check_attribution(indented, line_offset)
Check for an attribution in the last contiguous block of indented.
Return a 3-tuple: (block quote lines, attribution lines, attribution offset).
check_subsection(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?
Exception: | EOFError when a sibling or supersection encountered. |
---|
citation(match)
comment(match)
directive(match, **option_presets)
Returns a 2-tuple: list of nodes, and a "blank finish" boolean.
disallowed_inside_substitution_definitions(node)
doctest(match, context, next_state)
embedded_directive(match, context, next_state)
enumerator(match, context, next_state)
Enumerated List Item
eof(context)
Handle end-of-file. Return empty result.
Override in subclasses.
Parameter context: application-defined storage.
explicit_construct(match)
Determine which explicit construct this is, parse & return it.
explicit_list(blank_finish)
Create a nested state machine for a series of explicit markup constructs (including anonymous hyperlink targets).
explicit_markup(match, context, next_state)
Footnotes, hyperlink targets, directives, comments.
field(match)
field_marker(match, context, next_state)
Field list item.
first_known_indent(match, context, next_state)
Handle an indented text block (first line's indent known).
Extend or override in subclasses.
Recursively run the registered state machine for known-indent indented blocks (self.known_indent_sm). The indent is the length of the match, match.end().
footnote(match)
goto_line(abs_line_offset)
Jump to input line abs_line_offset, ignoring jumps past the end.
grid_table_top(match, context, next_state)
Top border of a full table.
hyperlink_target(match)
indent(match, context, next_state)
Block quote.
inline_text(text, lineno)
Return 2 lists: nodes (text and inline elements), and system_messages.
is_enumerated_list_item(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 or an auto-enumerator.
is_reference(reference)
isolate_grid_table()
isolate_simple_table()
known_indent(match, context, next_state)
Handle a known-indent text block. Extend or override in subclasses.
Recursively run the registered state machine for known-indent indented blocks (self.known_indent_sm). The indent is the length of the match, match.end().
line(match, context, next_state)
Section title overline or transition marker.
line_block(match, context, next_state)
First line of a line block.
line_block_line(match, lineno)
Return one line element of a line_block.
list_item(indent)
make_enumerator(ordinal, sequence, format)
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.
make_target(block, block_text, lineno, target_name)
make_transition(name, next_state=None)
Make & return a transition tuple based on name.
This is a convenience function to simplify transition creation.
Parameters:
Exceptions: TransitionPatternNotFound, TransitionMethodNotFound.
make_transitions(name_list)
Return a list of transition names and a transition mapping.
Parameter name_list: a list, where each entry is either a transition name string, or a 1- or 2-tuple (transition name, optional next state name).
malformed_table(block, detail='')
nest_line_block_lines(block)
nest_line_block_segment(block)
nested_list_parse(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 intermediate blank lines and the required final one.
nested_parse(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(title, lineno, messages)
Append new subsection to document tree. On return, check level.
no_match(context, transitions)
Override StateWS.no_match to generate a system message.
This code should never be run.
nop(match, context, next_state)
A "do nothing" transition method.
Return unchanged context & next_state, empty result. Useful for simple state changes (actionless transitions).
option_list_item(match)
option_marker(match, context, next_state)
Option list item.
paragraph(lines, lineno)
Return a list (paragraph & messages) & a boolean: literal_block next?
parse_attribution(indented, line_offset)
parse_directive_arguments(argument_spec, arg_block)
parse_directive_block(indented, line_offset, directive_fn, option_presets)
parse_directive_options(option_presets, option_spec, arg_block)
parse_enumerator(match, expected_sequence=None)
Analyze an enumerator and return the results.
Return: |
|
---|
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.
parse_extension_options(option_spec, datalines)
Parse datalines for a field list containing extension options matching option_spec.
Parameters: |
|
---|---|
Return: |
|
parse_field_body(indented, offset, node)
parse_field_marker(match)
Extract & return field name from a field marker match.
parse_option_marker(match)
Return a list of node.option and node.option_argument objects, parsed from an option marker match.
Exception: | MarkupError for invalid option markers. |
---|
parse_target(block, block_text, lineno)
Determine the type of reference of a target.
Return: | A 2-tuple, one of:
|
---|
remove_transition(name)
Remove a transition by name.
Exception: UnknownTransitionError.
run_directive(directive_fn, match, type_name, option_presets)
Parse a directive then run its directive function.
Parameters:
Returns a 2-tuple: list of nodes, and a "blank finish" boolean.
runtime_init()
section(title, source, style, lineno, messages)
Check for a valid subsection and create one if it checks out.
simple_table_top(match, context, next_state)
Top border of a simple table.
substitution_def(match)
table(isolate_function, parser_class)
Parse a table.
table_top(match, context, next_state, isolate_function, parser_class)
Top border of a generic table.
text(match, context, next_state)
title_inconsistent(sourcetext, lineno)
unindent_warning(node_name)
unknown_directive(type_name)
unlink()
Remove circular references to objects no longer required.
There are no known subclasses.