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

Class Inliner

Known Subclasses:
Inliner

Parse inline markup; call the parse() method.
Method Summary
  __init__(self, roles)
roles is a mapping of canonical role name to role function or bound method, which enables additional interpreted text roles.
  adjust_uri(self, uri)
  anonymous_reference(self, match, lineno)
  emphasis(self, match, lineno)
  footnote_reference(self, match, lineno)
Handles nodes.footnote_reference and nodes.citation_reference elements.
  generic_interpreted_role(self, role, rawtext, text, lineno)
  get_role_function(self, role, lineno)
  implicit_inline(self, text, lineno)
Check each of the patterns in self.implicit_dispatch for a match, and dispatch to the stored method for the pattern.
  init_customizations(self, settings)
Setting-based customizations; run when parsing begins.
  inline_internal_target(self, match, lineno)
  inline_obj(self, match, lineno, end_pattern, nodeclass, restore_backslashes)
  interpreted(self, before, after, rawsource, text, role, lineno)
  interpreted_or_phrase_ref(self, match, lineno)
  literal(self, match, lineno)
  parse(self, text, lineno, memo, parent)
Return 2 lists: nodes (text and inline elements), and system_messages.
  pep_reference(self, match, lineno)
  pep_reference_role(self, role, rawtext, text, lineno)
  phrase_ref(self, before, after, rawsource, escaped, text)
  problematic(self, text, rawsource, message)
  quoted_start(self, match)
Return 1 if inline markup start-string is 'quoted', 0 if not.
  reference(self, match, lineno, anonymous)
  rfc_reference(self, match, lineno)
  rfc_reference_role(self, role, rawtext, text, lineno)
  standalone_uri(self, match, lineno)
  strong(self, match, lineno)
  substitution_reference(self, match, lineno)

Class Variable Summary
str closers = '\'")]}>'
str default_interpreted_role = 'title-reference'
dict dispatch = {'__': <function anonymous_reference at 0x82e...
str email_pattern = '\n          %(emailc)s+(?:\\.%(emailc)s...
str emailc = "[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9]"
str end_string_suffix = '((?=$)|(?=[-/:.,;!? \\n\\x00\\\'\\"...
dict generic_roles = {'abbreviation': <class docutils.nodes.a...
str non_whitespace_after = '(?![ \\n])'
str non_whitespace_before = '(?<![ \\n])'
str non_whitespace_escape_before = '(?<![ \\n\\x00])'
str openers = '\'"([{<'
tuple parts = ('initial_inline', '((?<=^)|(?<=[-/: \\n\\\'\\"\...
Struct patterns = <docutils.parsers.rst.states.Struct instance ...
str pep_url = 'http://www.python.org/peps/pep-%04d.html'
str pep_url_absolute = 'http://www.python.org/peps/pep-%04d....
str pep_url_local = 'pep-%04d.html'
str rfc_url = 'http://www.faqs.org/rfcs/rfc%d.html'
str simplename = '(?:(?!_)\\w)+(?:[-._](?:(?!_)\\w)+)*'
str start_string_prefix = '((?<=^)|(?<=[-/: \\n\\\'\\"\\(\\[...
str uric = "[-_.!~*'()[\\];/:@&=+$,%a-zA-Z0-9]"
str urilast = '[_~/a-zA-Z0-9]'

Method Details

__init__(self, roles=None)
(Constructor)

roles is a mapping of canonical role name to role function or bound method, which enables additional interpreted text roles.

footnote_reference(self, match, lineno)

Handles nodes.footnote_reference and nodes.citation_reference elements.

implicit_inline(self, text, lineno)

Check each of the patterns in self.implicit_dispatch for a match, and dispatch to the stored method for the pattern. Recursively check the text before and after the match. Return a list of nodes.Text and inline element nodes.

init_customizations(self, settings)

Setting-based customizations; run when parsing begins.

parse(self, text, lineno, memo, parent)

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

Using self.patterns.initial, a pattern which matches start-strings (emphasis, strong, interpreted, phrase reference, literal, substitution reference, and inline target) and complete constructs (simple reference, footnote reference), search for a candidate. When one is found, check for validity (e.g., not a quoted '*' character). If valid, search for the corresponding end string if applicable, and check it for validity. If not found or invalid, generate a warning and ignore the start-string. Implicit inline markup (e.g. standalone URIs) is found last.

quoted_start(self, match)

Return 1 if inline markup start-string is 'quoted', 0 if not.

Class Variable Details

closers

Type:
str
Value:
'\'")]}>'                                                              

default_interpreted_role

Type:
str
Value:
'title-reference'                                                      

dispatch

Type:
dict
Value:
{'*': <function emphasis at 0x82ffd54>,
 '**': <function strong at 0x8303efc>,
 ']_': <function footnote_reference at 0x830239c>,
 '_': <function reference at 0x82ed824>,
 '__': <function anonymous_reference at 0x82ef5a4>,
 '_`': <function inline_internal_target at 0x83000fc>,
 '`': <function interpreted_or_phrase_ref at 0x82e9f0c>,
 '``': <function literal at 0x82f84c4>,
...                                                                    

email_pattern

Type:
str
Value:
'''
          %(emailc)s+(?:\\.%(emailc)s+)*   # name
          @                               # at
          %(emailc)s+(?:\\.%(emailc)s*)*   # host
          %(urilast)s                     # final URI char
          '''                                                          

emailc

Type:
str
Value:
"[-_!~*'{|}/#?^`&=+$%a-zA-Z0-9]"                                       

end_string_suffix

Type:
str
Value:
'''((?=$)|(?=[-/:.,;!? \
\\x00\\\'\\"\\)\\]\\}\\>]))'''                                         

generic_roles

Type:
dict
Value:
{'abbreviation': <class docutils.nodes.abbreviation at 0x82db6e4>,
 'acronym': <class docutils.nodes.acronym at 0x82db7d4>,
 'emphasis': <class docutils.nodes.emphasis at 0x82daf4c>,
 'literal': <class docutils.nodes.literal at 0x82db12c>,
 'strong': <class docutils.nodes.strong at 0x82db03c>,
 'subscript': <class docutils.nodes.subscript at 0x82db9b4>,
 'superscript': <class docutils.nodes.superscript at 0x82db8c4>,
 'title-reference': <class docutils.nodes.title_reference at 0x82db5f4\
...                                                                    

non_whitespace_after

Type:
str
Value:
'''(?![ \
])'''                                                                  

non_whitespace_before

Type:
str
Value:
'''(?<![ \
])'''                                                                  

non_whitespace_escape_before

Type:
str
Value:
'''(?<![ \
\\x00])'''                                                             

openers

Type:
str
Value:
'\'"([{<'                                                              

parts

Type:
tuple
Value:
('initial_inline',
 '((?<=^)|(?<=[-/: \\n\\\'\\"\\(\\[\\{\\<]))',
 '',
 [('start',
   '',
   '(?![ \\n])',
   ['\\*\\*', '\\*(?!\\*)', '``', '_`', '\\|(?!\\|)']),
  ('whole',
...                                                                    

patterns

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

pep_url

Type:
str
Value:
'http://www.python.org/peps/pep-%04d.html'                             

pep_url_absolute

Type:
str
Value:
'http://www.python.org/peps/pep-%04d.html'                             

pep_url_local

Type:
str
Value:
'pep-%04d.html'                                                        

rfc_url

Type:
str
Value:
'http://www.faqs.org/rfcs/rfc%d.html'                                  

simplename

Type:
str
Value:
'(?:(?!_)\\w)+(?:[-._](?:(?!_)\\w)+)*'                                 

start_string_prefix

Type:
str
Value:
'''((?<=^)|(?<=[-/: \
\\\'\\"\\(\\[\\{\\<]))'''                                              

uric

Type:
str
Value:
"[-_.!~*'()[\\];/:@&=+$,%a-zA-Z0-9]"                                   

urilast

Type:
str
Value:
'[_~/a-zA-Z0-9]'                                                       

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