abcdefpatch-366make _normalize_text public methodNir Sofferpatch-367fixed failing test wikiutil: good system page namesNir Sofferpatch-368Fixed DeprecationWarning in RandomPage.py and an unused import in twistedmoin.pyAlexander Schremmerpatch-369remove duplicate code in formatter.baseThomas Waldmannpatch-370fixed long int in mig3Thomas Waldmannpatch-371fixed unicode error on eventlogNir Sofferpatch-372fixed util.web.makeQueryString and Page.urlNir Sofferpatch-373fixed again non ascii http_refererNir Sofferpatch-374CSV.py supports different separators nowAlexander Schremmerpatch-375improved searchform behavior on Mozilla/FirefoxNir Sofferpatch-376More correct script for actions menu initNir SofferVersionDate0.112002-03-110.102001-10-280.92001-05-070.82001-01-230.72000-12-060.62000-12-040.52000-11-170.42000-11-010.32000-10-250.22000-08-260.12000-07-29<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>HelpOnParsers</title></articleinfo><para><ulink url="http://wiki.ninux.org/HelpOnParsers/HelpContents#">HelpContents</ulink> &gt; <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpForUsers#">HelpForUsers</ulink> &gt; <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnEditing#">HelpOnEditing</ulink> &gt; HelpOnParsers </para><section><title>Parsers</title><para>Besides the default <ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> wiki markup, different <emphasis role="strong">parsers</emphasis> allow the user to enter content into a page or a page section which is interpreted differently. A <ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> wiki mostly will use the default wiki parser, which is described on <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnFormatting#">HelpOnFormatting</ulink>. </para><section><title>How formats are applied</title><para>Parsers go through the contents of a page to create a sequence of formatter calls which in sequence create some readable output. <ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> will choose the parser for a page using 2 different techniques: </para><orderedlist numeration="arabic"><listitem><para><emphasis role="strong"><ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnProcessingInstructions#format">FORMAT Processing Instruction</ulink></emphasis>  </para><para>A <code>#FORMAT</code> processing instruction can be used to tell <ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> which parser to use for the whole page content. By default this is the <emphasis>wiki</emphasis> parser. Example: </para><screen><![CDATA[#FORMAT cplusplus
... some C++ source ...]]></screen></listitem><listitem><para><emphasis role="strong">Code Display Regions</emphasis> - see <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnFormatting#">HelpOnFormatting</ulink>  </para><para>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 <ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink>). 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. For example, the code </para><screen><![CDATA[{{{#!CSV ,
a,b,c
d,e,f
}}}]]></screen><para>produces the table: </para><!--RAW HTML: <form action="/HelpOnParsers" method="GET" name="dbw.form">--><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row></tbody></tgroup></informaltable><!--RAW HTML: </form>--></listitem></orderedlist><para><inlinemediaobject><imageobject><imagedata depth="16" fileref="http://wiki.ninux.org//moin_static197/ninuxtheme02/img/idea.png" width="16"/></imageobject><textobject><phrase>(!)</phrase></textobject></inlinemediaobject> Note that there are 2 ways to solve <emphasis>nesting problems</emphasis> related to <code>}}}</code>: </para><itemizedlist><listitem><para>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.: </para><screen><![CDATA[{{{{
{{{
...
}}}
}}}}]]></screen></listitem><listitem><para>Use 3 curly braces + some unique string: </para><screen><![CDATA[{{{asdfghj
{{{
...
}}}
asdfghj}}}]]></screen></listitem></itemizedlist><para>For more information on the possible markup, see <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnEditing#">HelpOnEditing</ulink>.  </para></section><section><title>ParserBase</title><para>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. </para><para>A ParserBase colorization parser understands the following arguments to a <code>#FORMAT</code> pi or a hashbang line. Just add those arguments after the name of the parser (<code>#FORMAT python start=10 step=10 numbers=on</code> or <code>#!python numbers=off</code>). </para><glosslist><glossentry><glossterm>numbers</glossterm><glossdef><para>if line numbers should be added. defaults to 'on'. possible values: 'on', 'off' (no line numbers, but javascript to add them), 'disable' (no line numbers at all) </para></glossdef></glossentry><glossentry><glossterm>start</glossterm><glossdef><para>where to start with numbering. defaults to 1 </para></glossdef></glossentry><glossentry><glossterm>step</glossterm><glossdef><para>increment to the linenumber. defaults to 1 </para></glossdef></glossentry></glosslist><para><ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> comes with a few examples from which you can go on: </para></section><section><title>creole</title><para>See <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnCreoleSyntax#">HelpOnCreoleSyntax</ulink>. </para></section><section><title>python</title><para>Colorizes python code. It is not derived from ParserBase, but it allows the same arguments as the ParserBase parsers. </para><programlisting format="linespecific" language="python" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[def]]></token><![CDATA[ ]]><methodname><![CDATA[hello]]></methodname><![CDATA[():]]>
<![CDATA[    ]]><token><![CDATA[print]]></token><![CDATA[ ]]><phrase><![CDATA["]]></phrase><phrase><![CDATA[Hello World!]]></phrase><phrase><![CDATA["]]></phrase>
</programlisting><programlisting format="linespecific" language="python" linenumbering="unnumbered" startinglinenumber="1"><token><![CDATA[def]]></token><![CDATA[ ]]><methodname><![CDATA[hello]]></methodname><![CDATA[():]]>
<![CDATA[    ]]><token><![CDATA[print]]></token><![CDATA[ ]]><phrase><![CDATA["]]></phrase><phrase><![CDATA[Hello World!]]></phrase><phrase><![CDATA["]]></phrase>
</programlisting><programlisting format="linespecific" language="python" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[def]]></token><![CDATA[ ]]><methodname><![CDATA[hello]]></methodname><![CDATA[():]]>
<![CDATA[    ]]><token><![CDATA[print]]></token><![CDATA[ ]]><phrase><![CDATA["]]></phrase><phrase><![CDATA[Hello World!]]></phrase><phrase><![CDATA["]]></phrase>
</programlisting><section><title>cplusplus</title><programlisting format="linespecific" language="cpp" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[int]]></token><![CDATA[ ]]><methodname><![CDATA[main]]></methodname><![CDATA[(]]><token><![CDATA[int]]></token><![CDATA[ ]]><methodname><![CDATA[argc]]></methodname><![CDATA[, ]]><token><![CDATA[char]]></token><![CDATA[ **]]><methodname><![CDATA[argv]]></methodname><![CDATA[) {]]>
<![CDATA[  ]]><token><![CDATA[return]]></token><![CDATA[ 0;]]>
<![CDATA[}]]>
</programlisting></section><section><title>java</title><programlisting format="linespecific" language="java" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[import]]></token><![CDATA[ ]]><methodname><![CDATA[java.util.Date]]></methodname><![CDATA[;]]>
<token><![CDATA[import]]></token><![CDATA[ ]]><methodname><![CDATA[java.util.Calendar]]></methodname><![CDATA[;]]>

<token><![CDATA[public]]></token><![CDATA[ ]]><token><![CDATA[class]]></token><![CDATA[ ]]><methodname><![CDATA[IntDate]]></methodname>
<![CDATA[{]]>
<![CDATA[  ]]><token><![CDATA[public]]></token><![CDATA[ ]]><token><![CDATA[static]]></token><![CDATA[ ]]><methodname><![CDATA[Date]]></methodname><![CDATA[ ]]><methodname><![CDATA[getDate]]></methodname><![CDATA[(]]><methodname><![CDATA[String]]></methodname><![CDATA[ ]]><methodname><![CDATA[year]]></methodname><![CDATA[, ]]><methodname><![CDATA[String]]></methodname><![CDATA[ ]]><methodname><![CDATA[month]]></methodname><![CDATA[, ]]><methodname><![CDATA[String]]></methodname><![CDATA[ ]]><methodname><![CDATA[day]]></methodname><![CDATA[)]]>
<![CDATA[    {]]>
<![CDATA[      ]]><lineannotation><![CDATA[// Date(int, int, int) has been deprecated, so use Calendar to]]></lineannotation>
<lineannotation></lineannotation><![CDATA[      ]]><lineannotation><![CDATA[// set the year, month, and day.]]></lineannotation>
<lineannotation></lineannotation><![CDATA[      ]]><methodname><![CDATA[Calendar]]></methodname><![CDATA[ ]]><methodname><![CDATA[c]]></methodname><![CDATA[ = ]]><methodname><![CDATA[Calendar]]></methodname><![CDATA[.]]><methodname><![CDATA[getInstance]]></methodname><![CDATA[();]]>
<![CDATA[      ]]><lineannotation><![CDATA[// Convert each argument to int.]]></lineannotation>
<lineannotation></lineannotation><![CDATA[      ]]><methodname><![CDATA[c]]></methodname><![CDATA[.]]><methodname><![CDATA[set]]></methodname><![CDATA[(]]><methodname><![CDATA[Integer]]></methodname><![CDATA[.]]><methodname><![CDATA[parseInt]]></methodname><![CDATA[(]]><methodname><![CDATA[year]]></methodname><![CDATA[),]]><methodname><![CDATA[Integer]]></methodname><![CDATA[.]]><methodname><![CDATA[parseInt]]></methodname><![CDATA[(]]><methodname><![CDATA[month]]></methodname><![CDATA[),]]><methodname><![CDATA[Integer]]></methodname><![CDATA[.]]><methodname><![CDATA[parseInt]]></methodname><![CDATA[(]]><methodname><![CDATA[day]]></methodname><![CDATA[));]]>
<![CDATA[      ]]><token><![CDATA[return]]></token><![CDATA[ ]]><methodname><![CDATA[c]]></methodname><![CDATA[.]]><methodname><![CDATA[getTime]]></methodname><![CDATA[();]]>
<![CDATA[    }]]>
<![CDATA[}]]>
</programlisting></section><section><title>pascal</title><programlisting format="linespecific" language="pascal" linenumbering="numbered" startinglinenumber="1"><token><![CDATA[function]]></token><![CDATA[ ]]><methodname><![CDATA[TRegEx]]></methodname><![CDATA[.]]><methodname><![CDATA[Match]]></methodname><![CDATA[(]]><token><![CDATA[const]]></token><![CDATA[ ]]><methodname><![CDATA[s]]></methodname><![CDATA[:]]><token><![CDATA[string]]></token><![CDATA[):]]><token><![CDATA[boolean]]></token><![CDATA[;]]>
<token><![CDATA[var]]></token>
<![CDATA[    ]]><methodname><![CDATA[l]]></methodname><![CDATA[,]]><methodname><![CDATA[i]]></methodname><![CDATA[ : ]]><token><![CDATA[integer]]></token><![CDATA[;]]>
<token><![CDATA[begin]]></token>
<![CDATA[    ]]><token><![CDATA[result]]></token><![CDATA[ := ]]><methodname><![CDATA[MatchPos]]></methodname><![CDATA[(]]><methodname><![CDATA[s]]></methodname><![CDATA[,]]><methodname><![CDATA[l]]></methodname><![CDATA[,]]><methodname><![CDATA[i]]></methodname><![CDATA[);]]>
<token><![CDATA[end]]></token><![CDATA[;]]>
</programlisting></section></section><section><title>IRC</title><para>Puts an IRC log into a table. </para><programlisting format="linespecific" language="irc" linenumbering="numbered" startinglinenumber="1"><![CDATA[(23:18) ]]><methodname><![CDATA[<     jroes> ]]></methodname><![CDATA[ah]]>
<![CDATA[(23:21) ]]><token><![CDATA[-!- ]]></token><phrase><![CDATA[gpciceri ]]></phrase><lineannotation><![CDATA[[~gpciceri@host181-130.pool8248.interbusiness.it] has quit [Read error: 110 (Connection timed out)]]]></lineannotation>
<lineannotation></lineannotation><![CDATA[(23:36) ]]><methodname><![CDATA[< ThomasWal> ]]></methodname><![CDATA[you could also write a parser or processor]]>
<![CDATA[(23:38) ]]><methodname><![CDATA[<     jroes> ]]></methodname><![CDATA[i could?]]>
<![CDATA[(23:38) ]]><methodname><![CDATA[<     jroes> ]]></methodname><![CDATA[would that require modification on the moin end though?]]>
<![CDATA[(23:38) ]]><methodname><![CDATA[<     jroes> ]]></methodname><![CDATA[i cant change the wiki myself :x]]>
</programlisting><para>The format parsed is the log format of IRSSI, a popular console IRC client, but it should also match the log format of quite some other IRC clients. </para><para><anchor id="csvparser"/> </para></section><section><title>CSV</title><para>The CSV parser works on so-called <emphasis>comma separated values</emphasis>, though the comma is now usually and by default a semicolon.  The first line is considered to contain column titles that are rendered in <emphasis role="strong">bold</emphasis>, so when you don't want table headers, leave the first line empty. </para><para>The bang path can contain &quot;<code>-</code><emphasis>index</emphasis>&quot; arguments, each of which hides a certain column from the output; column indices are counted starting from 1. </para><para>Any non-whitespace argument that doesn't start with a <code>-</code> specifies the separator. This allows you to use e.g. commas (<code>,</code>) instead of semicolons (<code>;</code>). If you do not supply a separator, <code>;</code> will be used. </para><itemizedlist><listitem override="none"><para><inlinemediaobject><imageobject><imagedata depth="15" fileref="http://wiki.ninux.org//moin_static197/ninuxtheme02/img/alert.png" width="15"/></imageobject><textobject><phrase>/!\</phrase></textobject></inlinemediaobject> The currently included CSV parser code is <emphasis>very</emphasis> simple. </para></listitem></itemizedlist><para>Example tables (please see the raw text of this page for the markup used):  </para><para>MoinMoin 1.3 - clipping of the patch history: </para><!--RAW HTML: <form action="/HelpOnParsers" method="GET" name="dbw.form">--><informaltable><tgroup cols="3"><colspec colname="col_0"/><colspec colname="col_1"/><colspec colname="col_2"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row></tbody></tgroup></informaltable><!--RAW HTML: </form>--><para><ulink url="http://wiki.ninux.org/HelpOnParsers/MoinMoin#">MoinMoin</ulink> Version History: </para><!--RAW HTML: <form action="/HelpOnParsers" method="GET" name="dbw.form">--><informaltable><tgroup cols="2"><colspec colname="col_0"/><colspec colname="col_1"/><tbody><row rowsep="1"><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry><entry colsep="1" rowsep="1"><emphasis role="strong"/></entry></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row><row rowsep="1"><entry colsep="1" rowsep="1"/><entry colsep="1" rowsep="1"/></row></tbody></tgroup></informaltable><!--RAW HTML: </form>--></section><section><title>reStructuredText</title><para>See <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnParsers/ReStructuredText#">/ReStructuredText</ulink> </para></section><section><title>XML/XSLT/DocBook</title><para>See <ulink url="http://wiki.ninux.org/HelpOnParsers/HelpOnXmlPages#">HelpOnXmlPages</ulink>. </para></section><section><title>Additional Parsers</title><para>For many more parsers and installation instructions, see <ulink url="http://moinmoin.wikiwikiweb.de/ParserMarket#">ParserMarket</ulink> </para></section></section></article>