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

Module core

source code

Classes [hide private]
  Parser
Instantiates a parser with specified behaviour
Functions [hide private]
 
fill_from_store(text, element_store) source code
 
fragmentize(text, wiki_elements, element_store, remove_escapes=True)
Takes a string of wiki markup and outputs a list of genshi Fragments (Elements and strings).
source code
 
preprocess(text, dialect)
This should generally be called before fragmentize().
source code
 
chunk(text, blank_lines, hard_elements, limit)
Safely breaks large Creole documents into a list of smaller ones (strings)
source code
 
_test() source code
Variables [hide private]
  escape_char = '~'
  esc_neg_look = '(?<!\\~)'
  esc_to_remove = re.compile(r'(?<!~)~(?!([ \n]|$))')
  place_holder_re = re.compile(r'<<<(-?\d+?)>>>')
  max_blank_lines = 250
Function Details [hide private]

fragmentize(text, wiki_elements, element_store, remove_escapes=True)

source code 

Takes a string of wiki markup and outputs a list of genshi Fragments (Elements and strings).

This recursive function, with help from the WikiElement objects, does almost all the parsing.

When no WikiElement objects are supplied, escapes are removed from text (except if remove_escapes=True) and it is returned as-is. This is the only way for recursion to stop.

Parameters:
  • text - the text to be parsed
  • wiki_elements - list of WikiElement objects to be searched for
  • remove_escapes - If False, escapes will not be removed

preprocess(text, dialect)

source code 
This should generally be called before fragmentize().
Parameters:
  • text - text to be processsed.
  • dialect - a Creole object.