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.
  End(self)
End the processed text document.
  WriteText(self, text)
Write ordinary text.
  StartList(self, type)
Start a list environment of type 'type'.
  EndList(self, type)
End a list environment of type 'type'.
  StartItem(self, type, label=None)
Begin an element to the environment of type 'type'.
  FinishDefinedTerm(self)
Finish the definition of a term in a definition list.
  EndItem(self, type)
End an element in the environment of type 'type'.
  StartStyle(self, style)
Start a new text style 'style'.
  EndStyle(self, style)
End the text style 'style'.
  StartLink(self, target)
Being a hyperlink to 'target'.
  EndLink(self)
End a hyperlink.
  __Write(self, text)

Class Variables [hide private]
__start_list_tags  
__end_list_tags  
__start_item_tags  
__end_item_tags  
__start_style_tags  
__end_style_tags  

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.

End(self)

source code 
End the processed text document.

WriteText(self, text)

source code 
Write ordinary text.

StartList(self, type)

source code 
Start a list environment of type 'type'.

EndList(self, type)

source code 
End a list environment of type 'type'.

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.

FinishDefinedTerm(self)

source code 
Finish the definition of a term in a definition list.

EndItem(self, type)

source code 
End an element in the environment of type 'type'.

StartStyle(self, style)

source code 
Start a new text style 'style'.

EndStyle(self, style)

source code 
End the text style 'style'.

StartLink(self, target)

source code 
Being a hyperlink to 'target'.

EndLink(self)

source code 
End a hyperlink.

__Write(self, text)

source code 

Class Variable Details [hide private]

__start_list_tags

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

__end_list_tags

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

__start_item_tags

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

__end_item_tags

Value:
{'definition list': '</dd>\n',
 'ordered list': '</li>\n',
 'paragraph': '</p>\n',
 'unordered list': '</li>\n',
 'verbatim': ''}                                                       
      

__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>"}