logo4 Evolution is progress—                          
progress is creativity.        
vline

Creole Macro to Include Pages

As already outlined there exist some macros quite helpful to start off.

The Initial Code Fragment

[Error: Macro 'code' error: code() missing 1 required positional argument: 'ext']

First Problem Solved

Even if adapting the page to my system this piece of code yields an error, which is caused because the variables environ['wiki.metadata_page'] and environ['wiki.page'] are initially not defined. I found a work around which allows to set the variable to the current page value if empty.

[Error: Macro 'code' error: code() missing 1 required positional argument: 'ext']

A much better solution is excluding the recursive test from the first page.

[Error: Macro 'code' error: code() missing 1 required positional argument: 'ext']

Downscaling The Included Text

Next I wanted my included text to fit the structure of the parent page. That is all subheadings have to be downgraded, so I created another parameter that signals the level at which the included page resides.

<<include slug=WaddingtonExperiment headerlevel=2>>

My include routine receives the parameter accordingly.

[Error: Macro 'code' error: code() missing 1 required positional argument: 'ext']

Finally for this Genshi filter to work I had to create a new class.

[Error: Macro 'code' error: code() missing 1 required positional argument: 'ext']

Probably this piece of code looks a bit awkward to those more experienced in python programming but it works. Unfortunately I didn't find any documentation how to create a filter and how the data structure in that filter look like.


Tags: Software

 
   

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