Flag:

# Parsers

Besides the default MoinMoin wiki markup, different parsers allow the user to enter content into a page or a page section which is interpreted differently.

Additionally to the built-in parsers, you can find more of them on ParserMarket.

## How Parsers are applied

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:

1. 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

2. 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.

### Example: Processing instruction

This is the complete page contents:

#format creole
... **bold** ...

### Example: Parser section

This is a part of a wiki page:

• {{{#!csv ,
a,b,c
d,e,f
}}}

It renders as:

•  a b c d e f

### Parser sections and nesting

Please note that there are 2 ways to solve nesting problems related to }}}:

• Use more than 3 curly braces for beginning / ending of the parser section (what you use must not be contained in the section you are enclosing). E.g.:
{{{{
{{{
...
}}}
}}}}
• Use 3 curly braces + some unique string:
{{{asdfghj
{{{
...
}}}
asdfghj}}}

## Parsers for writing text content

Some of the parsers are intended for writing normal page text (like e.g. a document):

## csv parser

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.

 MoinMoin Version Date 0.9 2001-05-07 0.8 2001-01-23 0.7 2000-12-06 0.6 2000-12-04 0.5 2000-11-17 0.4 2000-11-01 0.3 2000-10-25 0.2 2000-08-26 0.1 2000-07-29

{{{#!csv delimiter=, link=Server quotechar="
Type,Server
wiki,http://moinmo.in MoinMoin
translation,http://master19.moinmo.in master19
}}}

It renders as:

 Type Server wiki MoinMoin translation master19

## diff, cplusplus, python, java, pascal, irc/irssi parsers

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).

## highlight parser

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

### Arguments

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.

Usage:

• {{{#!highlight python numbers=disable
class FooBar:
""" doc string """
}}}

renders as:

class FooBar:
""" doc string """


### Available highlight lexers

Use value in "Lexer names" column as argument for the highlight parser: