如果接触开源软件比较多的话,你就可能经常会看到一种大致样式相似、更加注重内容、简单样式但亲和力好的文档,比如:
- 深入 Python :Dive Into Python 中文版
- 使用Subversion进行版本控制
- GNU Image Manipulation Program 用户手册
- 简明 Python 教程
- PHP 手册
- FreeBSD 使用手册
- MPlayer – 电影播放器
- Zend Framework手册 中文版
等等这些这些文档都是DocBook生成的。
DocBook基于XML、XSL,主要用来创建文档,目前使用DocBook驱动的文档大多是开源软件技术文档。Docbook文档是标准XML格式,通过XSL可以生成HTML文件、HTMLs(带分页的超文本格式)、TEXT、RTF(Word兼容)、CHM,使用FOP可以生成PDF文件。
DocBook适合大型文档的管理,输出形式很丰富,可是DocBook的标签很多,需要一些学习,以下是DocBook文档事例:
<?xml version=’1.0′ encoding=”UTF-8″?>
<!DOCTYPE article
PUBLIC “-//OASIS//DTD DocBook XML V4.5/zh_cn” “http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd”>
<article>
<info>
<title>文章</title>
<author>作者</author>
<address>地址</address>
<copyright><year>2008</year><holder>所有者</holder></copyright>
</info>
<sect1>
<title>标题</title>
<para>
内容
</para>
</sect1>
</article>
reStructured和DocBook类似,reStructured的书写方式更加简单、简易理解,但管理大型文档很麻烦,以下是reStructured文档形式:
A ReStructuredText Primer ========================= :Author: Richard Jones :Version: $Revision: 5801 $ :Copyright: This document has been placed in the public domain. .. contents:: The text below contains links that look like "(quickref__)". These are relative links that point to the `Quick reStructuredText`_ user reference. If these links don't work, please refer to the `master quick reference`_ document. __ .. _Quick reStructuredText: quickref.html .. _master quick reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html .. Note:: This document is an informal introduction to reStructuredText. The `What Next?`_ section below has links to further resources, including a formal reference.
看上去reStructured更接近我们阅读时看到的文档。
如果对reStructured有兴趣,同时喜欢VIM的话,可以看看VST(Vim reStructured Text)簡介。
这方面软件还有txt2tags(轻量级)、Sphinx(python官方文档使用)。
我在学习中。