Package creoleparser :: Module core :: Class Parser
[hide private]
[frames] | no frames]

Class Parser

source code

object --+
         |
        Parser

Instantiates a parser with specified behaviour
Instance Methods [hide private]
 
__init__(self, dialect, method='xhtml', strip_whitespace=False, encoding='utf-8')
Constructor for Parser objects.
source code
 
generate(self, text, element_store=None, context='block')
Returns a Genshi Stream.
source code
 
render(self, text, element_store=None, context='block', **kwargs)
Returns final output string (e.g., xhtml)
source code
 
__call__(self, text, element_store=None, context='block')
Wrapper for the render method.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dialect, method='xhtml', strip_whitespace=False, encoding='utf-8')
(Constructor)

source code 
Constructor for Parser objects.
Parameters:
  • dialect - A Creole instance
  • method - This value is passed to genshies Steam.render(). Possible values include xhtml, html, and xml.
  • strip_whitespace - This value is passed Genshies Steam.render().
  • encoding - This value is passed Genshies Steam.render().
Overrides: object.__init__

generate(self, text, element_store=None, context='block')

source code 

Returns a Genshi Stream.

See Genshi documentation for additional keyword arguments.

Parameters:
  • text - The text to be parsed.
  • context - This is useful for marco development where (for example) supression of paragraph tags is desired. Can be 'inline', 'block', or a list of WikiElement objects (use with caution).
  • element_store - Internal dictionary that's passed around a lot ;)

render(self, text, element_store=None, context='block', **kwargs)

source code 

Returns final output string (e.g., xhtml)

See generate() (above) and Genshi documentation for keyword arguments.

__call__(self, text, element_store=None, context='block')
(Call operator)

source code 

Wrapper for the render method. Returns final output string.

See generate() (above) and Genshi documentation for keyword arguments.