分析插件

分析插件(parser)对页面的内容进行处理,调用一系列排版工具,然后输出结果。MoinMoin 使用不同的方法来选择分析器:FORMAT处理指令 (请看帮助-处理指令) 和代码显示区域 (请看帮助-排版)

#FORMAT pi 告诉Moin使用什么分析器去分析整个文章。默认为WIKI分析器。示例

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

使用代码显示区域时,分析器只用于处理页面的某一部分 (在Moin早期的版本中相当于 processor region)。通过在第一行加入 #! 和分析器名字来调用相应的分析器。#! 来源于 Unix 命令行脚本概念,他们的作用是就是告诉 shell 使用什么程序来执行脚本中剩下的命令。示例:

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

关于标记的更多信息,请参阅帮助-编辑

ParserBase

ParserBase 是一个对源程序进行语法加亮显示的分析工具类 (parser utility class)。它非常容易扩展。如果浏览器支持 DOM 和 JavaScript,那么这些代码经过 HTML 排版之后可以显示出来,并且带有可开关的行号。

ParserBase 语法加亮分析器可以在 `#FORMAT` 或者 `#!` 之后接受参数,比如 `#FORMAT python start=10 step=10 numbering=on` 或者 `#!python numbering=off`。

numbering
行号是否显示。默认为 'on'。可选项: 'on', 'off' (没有行号,但是用javascript可以添加行号), 'disable' (不会有行号显示出来)
start
行号计数初值。 默认为 1
step
行号增量步长. 默认为 1

Moin 自带了一些例子:

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

高亮显示python代码。其参数与 ParserBase 一样。

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

IRC

将 IRC 日志放入表格。

   1 (23:18) <     jroes> ah
   2 (23:19) <     jroes> hm, i like the way {{{ works, but i was hoping the lines would wrap
   3 (23:21) -!- gpciceri [~gpciceri@host181-130.pool8248.interbusiness.it] has quit [Read error: 110 (Connection timed out)]
   4 (23:36) < ThomasWal> you could also write a parser or processor
   5 (23:38) <     jroes> i could?
   6 (23:38) <     jroes> would that require modification on the moin end though?
   7 (23:38) <     jroes> i cant change the wiki myself :x

CSV

CSV 分析器可处理所谓的 用逗号分隔的值,不过现在一般使用分号。

第一行应该包含各列的标题,它们以粗体显示。如果不想要表格标题,把第一行留空即可。

#!CSV 的后面可以带有 "`-`index" 参数,来隐藏某一列; 列索引从1开始计数。

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 Alexander Schremmer
patch-369 remove duplicate code in formatter.base Thomas Waldmann
patch-370 fixed long int in mig3 Thomas Waldmann
patch-371 fixed unicode error on eventlog Nir Soffer
patch-372 fixed util.web.makeQueryString and Page.url Nir Soffer
patch-373 fixed again non ascii http_referer Nir Soffer
patch-374 CSV.py supports different separators now Alexander Schremmer
patch-375 improved searchform behavior on Mozilla/Firefox Nir Soffer
patch-376 More correct script for actions menu init Nir Soffer

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

reStructuredText

请看 /ReStructuredText

XML/XSLT/DocBook

请看 帮助-XML网页

此页的英文版本:HelpOnParsers