Package qm :: Module structured_text :: Class StructuredTextProcessor
[hide private]
[frames] | no frames]

Class StructuredTextProcessor

source code

Parser and formatter for Python structured text.

Instance Methods [hide private]
 
__init__(self, formatter)
Create a new structured text processor.
source code
 
NormalizeSpaces(self, text)
Return 'text' with spaces normalized.
source code
 
__call__(self, text)
Process structured text 'text'.
source code
 
End(self)
Stop processing text, and do any necessary cleanup.
source code
 
__PushType(self, type, indentation)
Start a new environment.
source code
 
__PopType(self)
End and remove the innermost environment.
source code
 
__SetType(self, type, indentation, label=None)
Set the environment type and indentation level.
source code
 
__WriteText(self, text)
Write paragraph text.
source code
Class Variables [hide private]
  __punctuation = '[][)(.,!?;:\'" ]'
  __bullet_regex = re.compile(r'^[-o\*] +')
  __sequence_regex = re.compile(r'^([A-Za-z]+\.|[0-9]+\.?)+ +')
  __definition_regex = re.compile(r'^(.*) +-- +')
  __collapse_regex = re.compile(r'(?m) *\n *')
  __indent_regex = re.compile(r'^ *')
  __literal_regex = re.compile(r'( +|^)\'([^\']+)\'([\]\[\)\(\.,...
  __strong_regex = re.compile(r'( +|^)\*\*([^\*]+)\*\*([\]\[\)\(...
  __emph_regex = re.compile(r'( +|^)\*([^\*]+)\*([\]\[\)\(\.,!\?...
  __underline_regex = re.compile(r'( +|^)_([^_]+)_([\]\[\)\(\.,!...
  __link_regex = re.compile(r'"([^"]*)"')
  __link_footnote_regex = re.compile(r'\n\.\. *"([^"]*)" *([^ \n...
  __non_nestable_types = ['paragraph']
Method Details [hide private]

__init__(self, formatter)
(Constructor)

source code 

Create a new structured text processor.

'formatter' -- The formatter to use to generate output.


Class Variable Details [hide private]

__literal_regex

Value:
re.compile(r'( +|^)\'([^\']+)\'([\]\[\)\(\.,!\?;:\'" ]+|$)')

__strong_regex

Value:
re.compile(r'( +|^)\*\*([^\*]+)\*\*([\]\[\)\(\.,!\?;:\'" ]+|$)')

__emph_regex

Value:
re.compile(r'( +|^)\*([^\*]+)\*([\]\[\)\(\.,!\?;:\'" ]+|$)')

__underline_regex

Value:
re.compile(r'( +|^)_([^_]+)_([\]\[\)\(\.,!\?;:\'" ]+|$)')

__link_footnote_regex

Value:
re.compile(r'\n\.\. *"([^"]*)" *([^ \n]*)[^\n]*')