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.
  NormalizeSpaces(self, text)
Return 'text' with spaces normalized.
  __call__(self, text)
Process structured text 'text'.
  End(self)
Stop processing text, and do any necessary cleanup.
  __PushType(self, type, indentation)
Start a new environment.
  __PopType(self)
End and remove the innermost environment.
  __SetType(self, type, indentation, label=None)
Set the environment type and indentation level.
  __WriteText(self, text)
Write paragraph text.

Class Variables [hide private]
__punctuation  
__bullet_regex  
__sequence_regex  
__definition_regex  
__collapse_regex  
__indent_regex  
__literal_regex  
__strong_regex  
__emph_regex  
__underline_regex  
__link_regex  
__link_footnote_regex  
__non_nestable_types  

Method Details [hide private]

__init__(self, formatter)
(Constructor)

source code 

Create a new structured text processor.

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

NormalizeSpaces(self, text)

source code 
Return 'text' with spaces normalized.

__call__(self, text)
(Call operator)

source code 
Process structured text 'text'.

End(self)

source code 
Stop processing text, and do any necessary cleanup.

__PushType(self, type, indentation)

source code 
Start a new environment.

__PopType(self)

source code 
End and remove the innermost environment.

__SetType(self, type, indentation, label=None)

source code 
Set the environment type and indentation level.

__WriteText(self, text)

source code 
Write paragraph text.

Class Variable Details [hide private]

__punctuation

Value:
'[][)(.,!?;:\'" ]'                                                     
      

__bullet_regex

Value:
^[-o\*] +                                                              
      

__sequence_regex

Value:
^([A-Za-z]+\.|[0-9]+\.?)+ +                                            
      

__definition_regex

Value:
^(.*) +-- +                                                            
      

__collapse_regex

Value:
 *\n *                                                                 
      

__indent_regex

Value:
^ *                                                                    
      

__literal_regex

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

__strong_regex

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

__emph_regex

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

__underline_regex

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

__link_regex

Value:
"([^"]*)"                                                              
      

__link_footnote_regex

Value:
\n\.\. *"([^"]*)" *([^ \n]*)[^\n]*                                     
      

__non_nestable_types

Value:
['paragraph']