知乎專欄 | 多維度架構 | | | 微信號 netkiller-ebook | | | QQ群:128659835 請註明“讀者” |
前提條件: subversion 伺服器一台,或者使用sf.net, github.com, code.google.com 等等提供的服務,團隊人員需要懂得docbook以及配置docbook環境
# pkg_add -r vim # pkg_add -r git # pkg_add -r libxml2 libxslt # pkg_add -r docbook-xsl
創建 book.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE subject SYSTEM "/usr/local/share/xml/docbook/5.0/dtd/docbook.dtd"> <book> <bookinfo> <title>An Example Book</title> <author> <firstname>Your first name</firstname> <surname>Your surname</surname> <affiliation> <address> <email>foo@example.com</email> </address> </affiliation> </author> <copyright> <year>2000</year> <holder>Copyright string here</holder> </copyright> <abstract> <para>If your book has an abstract then it should go here.</para> </abstract> </bookinfo> <preface> <title>Preface</title> <para>Your book may have a preface, in which case it should be placed here.</para> </preface> <chapter> <title>My first chapter</title> <para>This is the first chapter in my book.</para> <section> <title>My first section</title> <para>This is the first section in my book.</para> </section> </chapter> </book>
生成文檔
$ xsltproc /usr/local/share/xsl/docbook/xhtml/docbook.xsl book.xml > book.html
$ sudo apt-get install docbook-xsl $ sudo apt-get install xsltproc xmlto $ sudo apt-get install make $ sudo apt-get install git
創建 book.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE subject SYSTEM "/usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd"> <book> <bookinfo> <title>An Example Book</title> <author> <firstname>Your first name</firstname> <surname>Your surname</surname> <affiliation> <address> <email>foo@example.com</email> </address> </affiliation> </author> <copyright> <year>2000</year> <holder>Copyright string here</holder> </copyright> <abstract> <para>If your book has an abstract then it should go here.</para> </abstract> </bookinfo> <preface> <title>Preface</title> <para>Your book may have a preface, in which case it should be placed here.</para> </preface> <chapter> <title>My first chapter</title> <para>This is the first chapter in my book.</para> <section> <title>My first section</title> <para>This is the first section in my book.</para> </section> </chapter> </book>
生成文檔
$ xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml/docbook.xsl book.xml > book.html