• Immutable Page
  • Info
  • Attachments

帮助-分析插件

  1. 分析插件
    1. 分析器数据库
      1. cplusplus
      2. java
      3. pascal
    2. python
    3. CSV

分析插件

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

一个“#FORMAT” pi 可以告诉Moin使用什么样的分析器去分析整个文章。默认为WIKI分析器。示例:

#FORMAT cplusplus 
... 一些 c++ 代码 ...

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. 示例:

{ { {#!CSV
a,b,c
d,e,f
} } }

For more information on the possible markup, 请参阅帮助-编辑

分析器数据库

分析器数据库是一个用于对源程序进行语法加亮显示的分析工具类。它非常容易扩展。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

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

start

where to start with numbering. defaults to 1

step

increment to the linenumber. defaults to 1

Moin comes with a few examples from which you can go on:

cplusplus

   1 int main(int argc, char **argv) {
   2   return 0;
   3 }

java

   1 import java.util.Date;
   2 import java.util.Calendar;
   3 
   4 public class IntDate
   5 {
   6   public static Date getDate(String year, String month, String day)
   7     {
   8       // Date(int, int, int) has been deprecated, so use Calendar to
   9       // set the year, month, and day.
  10       Calendar c = Calendar.getInstance();
  11       // Convert each argument to int.
  12       c.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day));
  13       return c.getTime();
  14     }
  15 }

pascal

   1 function TRegEx.Match(const s:string):boolean;
   2 var
   3     l,i : integer;
   4 begin
   5     result := MatchPos(s,l,i);
   6 end;

python

Colorizes python code. It allows the same arguments as the ParserBase parsers.

   1 def hello():
   2     print "Hello World!"

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.

  • /!\ The current code contains a very simple CSV parser.

MoinMoin版本历史:

版本 日期
0.11 2002-03-11
0.10 2001-10-28
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

此页的英文版本:HelpOnParsers

Tell others about this page:

last modified 2005-11-13 13:36:04