Skip to content
JensDiemer edited this page Apr 5, 2015 · 1 revision

New api for python-creole => v1.0

With python-creole v1.0 we change the API. The old API is still supported a limited time and creates !PendingDeprecationWarning

new

v1.x API for: creole -> html

def creole2html(markup_string, debug=False,
        block_rules=None, blog_line_breaks=True,
        macros=None, verbose=None, stderr=None,
    ):

creole2html arguments:

  • Default block_rules are: BlockRules class from /creole/creole2html/rules.py
  • blog_line_breaks (see also: [- if == True: every line break would be convertet into {{{
    }}}.
    • if == False: use wiki style line breaks and seperate lines with one space.
  • Available macros see: CreoleMacros
  • if verbose is None: verbose = 1
  • if stderr is None: stderr = sys.stderr

v1.x API: for html -> markup

def html2creole(html_string, debug=False, unknown_emit=None):
...

def html2textile(html_string, debug=False, unknown_emit=None):
...

def html2rest(html_string, debug=False, unknown_emit=None):
...

The defaults for in html2creole, html2textile and html2rest are: if unknown_emit is None: use UnknownHtmlTags#Remove_all_unknown_tags transparent_unknown_nodes:).

old

old API for: creole -> html

def creole2html(markup_string, debug=False, parser_kwargs={}, emitter_kwargs={}):

default values for creole2html parser_kwargs are:

    parser_kwargs = {
        "block_rules": None,
        "blog_line_breaks": True,
    }

defaults for creole2html emitter_kwargs are:

    emitter_kwargs2 = {
        "macros": None,
        "verbose": 1,
        "stderr": sys.stderr,
    }

old API: for html -> markup

def html2creole(html_string, debug=False, parser_kwargs={}, emitter_kwargs={}):
...

def html2textile(html_string, debug=False, parser_kwargs={}, emitter_kwargs={}):
...

def html2rest(html_string, debug=False, parser_kwargs={}, emitter_kwargs={}):
...

The defaults for in html2creole, html2textile and html2rest are:

    parser_kwargs = {"debug": False}
    emitter_kwargs = {"unknown_emit": transparent_unknown_nodes}

see also: transparent_unknown_nodes