Package creoleparser :: Module dialects :: Class Creole10
[hide private]
[frames] | no frames]

Class Creole10

source code

object --+
         |
        Creole10

This class contains most of the logic and specification of the markup.
Instance Methods [hide private]
 
__init__(self, wiki_links_base_url='', wiki_links_space_char='_', interwiki_links_base_urls={}, no_wiki_monospace=True, use_additions=False, wiki_links_class_func=None, macro_func=None, wiki_links_path_func=None, interwiki_links_funcs={}, interwiki_links_space_chars={})
Constructor for Creole10 oblects.
source code

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

Instance Variables [hide private]
  block_elements
These are the wiki elements that are searched at the top level of text to be processed.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, wiki_links_base_url='', wiki_links_space_char='_', interwiki_links_base_urls={}, no_wiki_monospace=True, use_additions=False, wiki_links_class_func=None, macro_func=None, wiki_links_path_func=None, interwiki_links_funcs={}, interwiki_links_space_chars={})
(Constructor)

source code 

Constructor for Creole10 oblects.

Most attributes of new Creole objects are derived from the WikiElement class. Please see the constructor of that class and other specific element classes for details.

Parameters:
  • wiki_links_base_url - self explanitory
  • wiki_links_space_char - When wiki_links have spaces, this character replaces those spaces in the url.
  • interwiki_links_base_urls - Dictionary of urls for interwiki links.
  • interwiki_links_space_chars - Dictionary of characters that that will be used to replace spaces that occur in interwiki_links. If no key is present for an interwiki name, the wiki_links_space_char will be used.
  • interwiki_links_funcs - Dictionary of functions that will be called for interwiki link names. Works like wiki_links_path_func
  • no_wiki_monospace - If True, inline no_wiki will be rendered as <tt> not <span>
  • use_additions - If True, markup beyond the Creole 1.0 spec will be allowed. Including monospace (##).
  • wiki_links_class_func - If supplied, this fuction will be called when a wiki link is found and the return value (should be a string) will be added as a class attribute of the cooresponding link. The function must accept the page name (any spaces will have been replaced THIS IS NEW IN 0.3.3) as it's only argument. If no class attribute is to be added, return no value (or None).
  • wiki_links_path_func - If supplied, this fuction will be called when a wiki link is found and the return value (should be a string) will be joined to the base_url to form the url for href. The function must accept the page name (any spaces will have been replaced) as it's only argument. Returning the unaltered page name is equivalent to not supplying this function at all.
  • macro_func - If supplied, this fuction will be called when macro markup is found. The function must accept the macro name as its first argument, the argument string (including any delimter) as the second, the macro body as its third (will be None for a macro without a body), and a Boolean as the fourth (True for Block type macros, False for normal macros). The function may return a string (which will be subject to further wiki processing) or a Genshi Stream object. If None is returned, the markup will be rendered unchanged. The macro name must start with a letter and can include letters, numbers, and non-repeating periods and hyphens. Examples:

    These are regular macros:

    <<macro-name arg_string>>the body<</macro-name>>
    <<macro-name2 I have no body, just this argument string>>
    

    These are "block" macros. The won't be enclosed automatically in paragraphs like those above:

    <<note-blank-lines-before-and-after>>
    
    
    <<macro-name-alone>>
    nor does this onu
    <</macro-name-alone>>
    
Overrides: object.__init__

Instance Variable Details [hide private]

block_elements

These are the wiki elements that are searched at the top level of text to be processed. The order matters because elements later in the list need not have any knowledge of those before (as those were parsed out already). This makes the regular expression patterns for later elements very simple.