Contents
Additionally to the built-in parsers, you can find more of them on ParserMarket.
A parser reads some portion of text, analyzes it and creates some specially formatted output from it. You can choose the parser to use using 2 different techniques:
A #format processing instruction
A #format processing instruction can be used to tell MoinMoin which parser to use for the whole page content. By default this is the wiki parser (for moin wiki markup). For details see: The #format Processing Instruction
A Parser section - see HelpOnFormatting With the use of a parser section, a parser can be applied to only a part of a page. You specify which parser to call by using a shebang-like construct in the first line. A shebang 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.
This is the complete page contents:
#format creole ... **bold** ...
This is a part of a wiki page:
{{{#!csv , a,b,c d,e,f }}}
It renders as:
Please note that there are 2 ways to solve nesting problems related to }}}:
{{{{ {{{ ... }}} }}}}
{{{asdfghj {{{ ... }}} asdfghj}}}
For more information on the possible markup, see HelpOnEditing.
Some of the parsers are intended for writing normal page text (like e.g. a document):
wiki – the standard moin wiki parser, see HelpOnMoinWikiSyntax
creole – the creole wiki markup parser, see HelpOnCreoleSyntax
ReST (reStructuredText) – see /ReStructuredText
XML/XSLT/DocBook – see HelpOnXmlPages
The CSV parser works on so-called comma separated values, though the comma is now usually and by default 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 shebang can contain the following arguments:
delimiter or separator: delimiter=, will set the delimiter to a comma
quotechar: quotechar=" will allow quoting values with a double-quote
show: comma-separated list of columns to show only
hide: comma-separated list of columns to hide
autofilter: comma-separated list of columns to add auto-filters on
name: name of the dataset
link: comma-separated list of columns consisting of http://example.com/link description text rather than just text
static_cols, static_vals: columns (and respective values) added to each record
-N (where N is a number): hide column N (useful when column names are omitted)
The parser also supports the old, deprecated syntax for the shebang.
Example (please see the raw text of this page for the markup used):
Another example, utilizes link option to have links in some column:
{{{#!csv delimiter=, link=Server quotechar=" Type,Server wiki,http://moinmo.in MoinMoin translation,http://master19.moinmo.in master19 }}}
These parsers were provided with MoinMoin versions < 1.9 using a moin-specific parsing / syntax highlighting implementation. Since MoinMoin 1.9 these parsers are just shortcuts, calling the highlight parser (see below).
MoinMoin comes with a special parser called highlight that uses Pygments internally.
You can use it to highlight many sorts of programming source code, configuration files and other sorts of text files used on computers (just use the corresponding Lexer name from the table below).
Usage:
{{{#!highlight python class FooBar: """ doc string """ }}}
renders as:
1 class FooBar: 2 """ doc string """
Of course you can also use it for a complete page as a processing instruction, e.g.: #format highlight python
The highlight parser accepts arguments for line numbering:
numbers= might be on, off, or disable and defaults to on. on or off means that line numbers are switchable via JavaScript (html formatter). disabled means that line numbers are disabled completely.
start= must be a non negative number and defaults to 1,
step= must be a non negative number and defaults to 1.
{{{#!highlight python numbers=disable class FooBar: """ doc string """ }}}
class FooBar: """ doc string """
Use value in "Lexer names" column as argument for the highlight parser: