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

Class HtmlFormatter

source code

Formatter --+
            |
           HtmlFormatter

Formatter for generating HTML from structured text.

Instance Methods [hide private]
 
__init__(self, output_file=sys.stdout)
Create a new HTML formatter.
source code
 
End(self)
End the processed text document.
source code
 
WriteText(self, text)
Write ordinary text.
source code
 
StartList(self, type)
Start a list environment of type 'type'.
source code
 
EndList(self, type)
End a list environment of type 'type'.
source code
 
StartItem(self, type, label=None)
Begin an element to the environment of type 'type'.
source code
 
FinishDefinedTerm(self)
Finish the definition of a term in a definition list.
source code
 
EndItem(self, type)
End an element in the environment of type 'type'.
source code
 
StartStyle(self, style)
Start a new text style 'style'.
source code
 
EndStyle(self, style)
End the text style 'style'.
source code
 
StartLink(self, target)
Being a hyperlink to 'target'.
source code
 
EndLink(self)
End a hyperlink.
source code
 
__Write(self, text) source code
Class Variables [hide private]
  __start_list_tags = {'definition list': '<dl>\n', 'ordered lis...
  __end_list_tags = {'definition list': '</dl>\n', 'ordered list...
  __start_item_tags = {'definition list': '<dt>', 'ordered list'...
  __end_item_tags = {'definition list': '</dd>\n', 'ordered list...
  __start_style_tags = {'emphasized': '<em>', 'literal': '<tt>',...
  __end_style_tags = {'emphasized': '</em>', 'literal': '</tt>',...
Method Details [hide private]

__init__(self, output_file=sys.stdout)
(Constructor)

source code 

Create a new HTML formatter.

'output_file' -- A file object to which HTML source is written.

StartItem(self, type, label=None)

source code 

Begin an element to the environment of type 'type'.

'label' -- If type is "ordered list", this is the label for this list element.


Class Variable Details [hide private]

__start_list_tags

Value:
{'definition list': '''<dl>
''',
 'ordered list': '''<ol>
''',
 'paragraph': '',
 'unordered list': '''<ul>
''',
 'verbatim': ''}

__end_list_tags

Value:
{'definition list': '''</dl>
''',
 'ordered list': '''</ol>
''',
 'paragraph': '',
 'unordered list': '''</ul>
''',
 'verbatim': ''}

__start_item_tags

Value:
{'definition list': '<dt>',
 'ordered list': '''<li>
''',
 'paragraph': '<p>',
 'unordered list': '''<li>
''',
 'verbatim': ''}

__end_item_tags

Value:
{'definition list': '''</dd>
''',
 'ordered list': '''</li>
''',
 'paragraph': '''</p>
''',
 'unordered list': '''</li>
''',
...

__start_style_tags

Value:
{'emphasized': '<em>',
 'literal': '<tt>',
 'strong': '<strong>',
 'underlined': '<u>',
 'verbatim': '<pre>\'<span class="verbatim">'}

__end_style_tags

Value:
{'emphasized': '</em>',
 'literal': '</tt>',
 'strong': '</strong>',
 'underlined': '</u>',
 'verbatim': '</span>\'</pre>'}