## Please edit system and help pages ONLY in the master wiki! ## For more information, please see MoinMoin:MoinDev/Translation. ##master-page:HelpOnParsers ##master-date:2006-08-05 12:28:57 #acl -All:write Default #format wiki #language zh <> = 分析插件 = 分析插件(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 === {{{#!cplusplus int main(int argc, char **argv) { return 0; } }}} === java === {{{#!java import java.util.Date; import java.util.Calendar; public class IntDate { public static Date getDate(String year, String month, String day) { // Date(int, int, int) has been deprecated, so use Calendar to // set the year, month, and day. Calendar c = Calendar.getInstance(); // Convert each argument to int. c.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day)); return c.getTime(); } } }}} === pascal === {{{#!pascal function TRegEx.Match(const s:string):boolean; var l,i : integer; begin result := MatchPos(s,l,i); end; }}} == python == 高亮显示python代码。其参数与 !ParserBase 一样。 {{{#!python def hello(): print "Hello World!" }}} == IRC == 将 IRC 日志放入表格。 {{{#!irc (23:18) < jroes> ah (23:19) < jroes> hm, i like the way {{{ works, but i was hoping the lines would wrap (23:21) -!- gpciceri [~gpciceri@host181-130.pool8248.interbusiness.it] has quit [Read error: 110 (Connection timed out)] (23:36) < ThomasWal> you could also write a parser or processor (23:38) < jroes> i could? (23:38) < jroes> would that require modification on the moin end though? (23:38) < jroes> i cant change the wiki myself :x }}} <> == CSV == CSV 分析器可处理所谓的 ''用逗号分隔的值'',不过现在一般使用分号。 第一行应该包含各列的标题,它们以粗体显示。如果不想要表格标题,把第一行留空即可。 ''#!CSV'' 的后面可以带有 "`-`''index''" 参数,来隐藏某一列; 列索引从1开始计数。 /!\ 现在的代码包含'''非常'''简单的 CSV 分析插件。 !MoinMoin 1.3 - clipping of the patch history: {{{#!CSV , -4 patch-366,make _normalize_text public method,Nir Soffer,2004-11-30 19:11:51 GMT patch-367,fixed failing test wikiutil: good system page names,Nir Soffer,2004-11-30 19:15:52 GMT patch-368,Fixed DeprecationWarning in RandomPage.py and an unused import in twistedmoin.py,Alexander Schremmer,2004-11-30 22:58:44 GMT patch-369,remove duplicate code in formatter.base,Thomas Waldmann,2004-12-01 00:14:21 GMT patch-370,fixed long int in mig3,Thomas Waldmann,2004-12-01 01:51:50 GMT patch-371,fixed unicode error on eventlog,Nir Soffer,2004-12-01 14:46:29 GMT patch-372,fixed util.web.makeQueryString and Page.url,Nir Soffer,2004-12-01 15:48:55 GMT patch-373,fixed again non ascii http_referer,Nir Soffer,2004-12-01 18:55:28 GMT patch-374,CSV.py supports different separators now,Alexander Schremmer,2004-12-01 23:46:17 GMT patch-375,improved searchform behavior on Mozilla/Firefox,Nir Soffer,2004-12-02 04:57:06 GMT patch-376,More correct script for actions menu init,Nir Soffer,2004-12-02 05:07:58 GMT }}} MoinMoin版本历史:{{{#!CSV -3 版本;日期;HIDDEN! 0.11;2002-03-11;Revision 1.151 0.10;2001-10-28;Revision 1.134 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