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

Module structured_text

source code

Functions for parsing, processing, and formatting Python structured text.

See "Structured Text Formatting Rules":http://www.python.org/sigs/doc-sig/stext.html for more information.

Classes [hide private]
  Formatter
Interface for output formatters for the 'StructuredTextProcessor'.
  TextFormatter
Formatter for generating plain text from structured text.
  HtmlFormatter
Formatter for generating HTML from structured text.
  StructuredTextProcessor
Parser and formatter for Python structured text.
Functions [hide private]
 
escape_html_entities(text)
Return 'text' with special characters converted to HTML entities.
source code
 
__format(text, formatter)
Process structured text 'text' with 'formatter'.
source code
 
to_html(structured_text)
Return 'structured_text' formatted as HTML.
source code
 
to_text(structured_text, width=78, indent=0)
Return 'structured_text' formatted as plain text.
source code
 
get_first(structured_text)
Return the first line of 'structured_text'.
source code
 
get_rest(structured_text)
Return the contents of 'structured_text' minus the first line.
source code
 
get_paragraphs(structured_text)
Split 'structured_text' into paragraphs.
source code
 
get_first_paragraph(structured_text)
Return the first paragraph of 'structured_text'.
source code
 
__entity_char_replacement(match, replacement_map={'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;', '\xa0'...) source code
Variables [hide private]
  html_help_text = '\n<h4>Structured Text</h4>\n\n<p>Structured ...
  __entity_char_regex = re.compile(r'[\xe5>\xa5\xf2\xd1\xdd\xc3\...
  __paragraph_regexp = re.compile(r'(?:\n *)+\n')
  _verbatim_regexp = re.compile(r'(?s)(\'\'\'.*\'\'\')(?:(?:\n *...
  __package__ = 'qm'
  character = '\xf3'
  entity = 'oacute'
Function Details [hide private]

to_text(structured_text, width=78, indent=0)

source code 

Return 'structured_text' formatted as plain text.

'width' -- The width of the text (including the indentation).

'indent' -- The width of the block indentation of the formatted output.

get_first(structured_text)

source code 

Return the first line of 'structured_text'.

By convention, the first line of a structured text description is a short summary.

get_paragraphs(structured_text)

source code 

Split 'structured_text' into paragraphs.

'structured_text' -- A string consisting of structured text.

returns -- A sequence of pagraphs of structured text. Each element in the sequence corresponds to a successive pagraph in the 'structured_text'. If 'structured_text' is the empty string, the sequence returned will consist of a single paragraph, itself empty.

get_first_paragraph(structured_text)

source code 

Return the first paragraph of 'structured_text'.

'structured_text' -- A string consisting of structured text.

returns -- A string of structured text that is the first paragraph of the 'structured_text'.


Variables Details [hide private]

html_help_text

Value:
'''
<h4>Structured Text</h4>

<p>Structured text is a simple set of conventions for formatting
ordinary text.  Usually, you can simply type ordinary text where QM
expects structured text; the resulting output will be line-wrapped, wi\
th
paragraph breaks indicated by blank lines.</p>
...

__entity_char_regex

Value:
re.compile(r'[\xe5>\xa5\xf2\xd1\xdd\xc3\xe6\xe4\xc2\xf5<\xce\xc9\xd3\x\
f8\xb4\xfa\xb8\xa8\xac\xc6\xbf\xab\xcc\xae\xb5\xad\xa0\xc4\xa6\xd5\xdf\
\xe0\xd4\xe8\xa1\xbd\xaa\xbc\xdc\xf1\xd8\xde\xff\xea\xc5\xbe\xd9\xc0\x\
b9\xf0\xef\xc8\xf7\xd6\xec\xd0\xb1\xb2\xb3\xc1\xa2\xcd\xca\xeb\xb6\xfc\
\xee\xa9\xcf\xe7\xdb\xf4\xb0\xa3\xa4\xfb\xf9\xd7\xe3\xed\xcb\xbb"\xda\\
xe9\xfd\xe2\xaf\xc7\xba\xe1\xb7&\xfe\xf6\xd2\xa7\xf3]')

_verbatim_regexp

Value:
re.compile(r'(?s)(\'\'\'.*\'\'\')(?:(?:\n *)+\n|\n?$)')