logo4 Evolution is progress—                          
progress is creativity.        
vline

Adding Creole Macros

I use Creole as Markup language. Although the documentation revealed a considerable flexibility, I was unable to google reliable example until today.

Macros in Creole

Simple Creole Macros

Today I found this macro documentation page. The quote macro is easily implemented, and the spreadsheet will be implemented here on this page for the first time.

"This is a test quotation"

Complex Creole Macros

A nice collection of Creole macros can be found here.

The dialect initializing the macros is given by this code macro.

dialect = create_dialect(
    creole11_base,
    no_wiki_monospace=False,
    blog_style_endings=True,
    custom_markup=[('(c)','©'),('(R)','®')],
    non_bodied_macros= macros.non_bodied_macros,
    bodied_macros= macros.bodied_macros,
    add_heading_ids=True
    )

And the code that transforms the table of content tag.

@register.filter
def wikihtml(value):
    stream = text2html.generate(value,environ=env)
    if 'toc' in env:
        stream = Stream(list(stream))
        stream = stream.filter(Replacer('toc', stream.filter(TOCMaker(env['toc']))))            
    
    return stream.render(method='xhtml', strip_whitespace=False, encoding='utf-8')

The table of content macro needs some additional files to be installed. The file toc.py is downloadable from that website too.

  1. Macros in Creole
    1. Simple Creole Macros
    2. Complex Creole Macros
  2. Todo

Todo

The following tasks remain to become implemented:

  • Inclusion of sub pages in order to structure this website as a real living fauceir.
  • Implementing a reference database and to include those reference in a wiki style

Tags: Software

 
   

(c) Mato Nagel, Weißwasser 2004-2013, Disclaimer