This web page is no longer maintained. Information presented here exists only to avoid breaking historical links.The Project stays maintained, and lives on: see the Linux-HA Reference Documentation.To get rid of this notice, you may want to browse the old wiki instead.

Parsers

Parsers go through the contents of a page to create a sequence of formatter calls which in sequence create some readable output. MoinMoin will choose the parser for a page using different techniques: FORMAT Processing Instruction (see HelpOnProcessingInstructions) and code display regions (see HelpOnFormatting).

A #FORMAT pi can be used to tell MoinMoin which parser to use for the whole page content. By default this is the wiki parser. Example:

#FORMAT cplusplus
... some C++ source ...

With the use of code display regions, a parser can be applied to only a part of a page (this was a processor region in earlier versions of Moin). You specify which parser to call by using a bang path-like construct in the first line. A bang path is a concept known from Unix command line scripts, where they serve the exact same purpose: the first line tells the shell what program to start to process the remaining lines of the script. Example:

ParserBase

ParserBase is a parser utility class used to produce colorized source displays. It is easily extended. The HTML Formatter will render such code displays with switchable linenumbers, if the browser supports DOM and JavaScript.

A ParserBase colorization parser understands the following arguments to a #FORMAT pi or a hashbang line. Just add those arguments after the name of the parser (#FORMAT python start=10 step=10 numbering=on or #!python numbering=off).

numbers

if line numbering should be added. defaults to 'on'. possible values: 'on', 'off' (no linenumbers, but javascript to add them), 'disable' (no line numbers at all)

pascal

python

Colorizes python code. It is not derived from ParserBasem, but it allows the same arguments as the ParserBase parsers.

1 defhello(): 2 print"Hello World!"

IRC

Puts an IRC log into a table.

23:18

jroes

ah

23:19

jroes

hm, i like the way {{{ works, but i was hoping the lines would wrap

23:36

ThomasWal

you could also write a parser or processor

23:38

jroes

i could?

23:38

jroes

would that require modification on the moin end though?

23:38

jroes

i cant change the wiki myself :x

CSV

The CSV parser works on so-called comma separated values, though the comma is now usually a semicolon. The first line is considered to contain column titles that are rendered in bold, so when you don't want table headers, leave the first line empty.

The bang path can contain "-index" arguments, to hide certain columns from the output; column indices are counted starting from 1.

Any other argument is treated as the seperator. This allows you to use e.g. commas (,) instead of semicolons (;). If you do not supply a separator, ; will be used. See the examples below.

The current code contains a very simple CSV parser.

MoinMoin 1.3 - clipping of the patch history:

patch-366

make _normalize_text public method

Nir Soffer

patch-367

fixed failing test wikiutil: good system page names

Nir Soffer

patch-368

Fixed DeprecationWarning in RandomPage.py and an unused import in twistedmoin.py