DokuWiki 的基本使用
DokuWiki 语法
用 wiki 语法编辑,参见 DokuWiki 语法 或DokuWiki Syntax, 或安装后自带的 语法页面。
语法加亮
DokuWiki 可以将源代码作语法高亮以增加可读性。DokuWiki 使用 GeSHi 通用语法高亮工具(Generic Syntax Highlighter)—— 所有被 GeSHi 支持的语言都可以在 DokuWiki 中得到高亮。使用 code 标记时需要指定使用的语言,例如: <code java>。
/** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); //Display the string. } }
当前 DokuWiki 可以支持的语言有: abap actionscript-french, actionscript, ada, apache, applescript, asm, asp, autoit, bash, basic4gl, blitzbasic, bnf, caddcl, cadlisp, cfdg, cfm, c_mac, c, cpp, cpp-qt, csharp, css, delphi, diff, div, dos, dot, d, eiffel, fortran, freebasic, genero, gml, groovy, haskell, html, idl, ini, inno, io, java5, java, javascript, latex, lisp, lua, m68k, matlab, mirc, mpasm, mysql, nsis, objc, ocaml-brief, ocaml, oobas, oracle8, pascal, perl, per, php-brief, php, plsql, python, qbasic, rails, reg, robots, ruby, sas, scheme, sdlbasic, smalltalk, smarty, sql, tcl, text, thinbasic, tsql, vbnet, vb, vhdl, visualfoxpro, winbatch, xml, xpp, z80
RSS/ATOM Feed Aggregation
DokuWiki 能使用外部 XML feeds 整合数据。 为了解析 XML feeds,使用了 SimplePie。 SimplePie 能认知的所有格式都能被 DokuWiki 使用。 你可以添加多个以空格间隔的参数来影响 SimplePie 的解析输出。
| 参数 | 说明 |
|---|---|
| any number | 指定显示条目的最大值, 默认值为 8 |
| reverse | 逆序输出,即将 XML feeds 中的第一个条目显示为最后一个 |
| author | 显示条目的作者名 |
| date | 显示条目的日期 |
| description | 显示条目的描述信息。若 HTML 没有开启,则 所有的 HTML 标签将被删除 |
| n[dhm] | 刷新周期,单位为 d=days, h=hours, m=minutes. (e.g. 12h = 12 hours)。 |
默认的说新周期是 4 小时。所有低于 10 分钟的周期均视为 10 分钟。DokuWiki 一般会生成页面的缓存版本。很明显,当页面包含外部动态内容时,缓存版本就不适用了。 此处指定的参数会告知 DokuWiki 重新生成页面——如果访问页面的时间与上一次页面生成的时间间隔大于指定的刷新周期。
Example:
{{rss>http://slashdot.org/index.rss 5 author date 1d }}
- DTV Coupon Program Out of Money 由 timothy (2009/01/06 08:46)
- Using Your BlackBerry As a Modem On Linux 由 timothy (2009/01/06 08:01)
- FreeBSD 7.1 Released 由 CmdrTaco (2009/01/06 07:10)
- Apple Introduces "MacBook Wheel" 由 CmdrTaco (2009/01/06 06:27)
- A TV Show Based On MAKE Magazine 由 kdawson (2009/01/06 05:14)
使用页面模版
DokuWiki 支持每个命名空间(namespace)的页面模版。namespace 映射到文件系统上就是目录,所以可以在 data/pages 下的每个目录中分别创建该 namespace 下所有页面的模版。页面模版的文件名称约定为 _template.txt。
_ 开头的文件,所以要在本地编辑该文件然后上传。
_template.txt 除了可以使用 wiki 语法之外,还支持如下的变量:
| @ID@ | full ID of the page |
|---|---|
| @NS@ | namespace of the page |
| @PAGE@ | page name (ID without namespace and underscores replaced by spaces) |
| @USER@ | ID of user who is creating the page |
| @NAME@ | name of user who is creating the page |
| @MAIL@ | mail address of user who is creating the page |
| @DATE@ | date and time when edit session started |
屏蔽默认特性
- 默认情况下,DokuWiki 将在系统的
data/cache目录下缓存页面。 若不缓存某页面,则需在编辑页面时将 ~~NOCACHE~~ 写入页首 - 默认情况下,DokuWiki 将显示每页的目录。若不显示某页的目录,则需在编辑页面时将 ~~NOTOC~~ 写入页首
- 有些字符或字符串是 Wiki 的语法字符,若只想显示其本身而不被 Wiki 引擎解析,有两种方法
- 两端使用
%%将内容括起来 - 使用 <nowiki> 和 </nowiki> 将内容括起来







