Difference between revisions of "Docbook"

From ArchWiki
Jump to: navigation, search
m (Added categories)
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category:Desktop]]
+
[[Category:Office]]
[[Category:Devel]]
+
{{Stub}}
 +
 
 +
We will assume that our docbook document is in <code>File.xml</code>
  
 
==Setting up Docbook in Arch==
 
==Setting up Docbook in Arch==
 
 
To set up docbook running on arch:
 
To set up docbook running on arch:
 
  $ pacman -S docbook-xml docbook-xsl libxslt libxml2
 
  $ pacman -S docbook-xml docbook-xsl libxslt libxml2
  
Assuming our docbook document is in <code>File.xml</code>. To validate the XML file use:
+
==Validating XML file==
 +
To validate the XML file use:
 
  $ xmllint --valid --noout File.xml
 
  $ xmllint --valid --noout File.xml
  
 
This will generate no output if the file is proper XML.  
 
This will generate no output if the file is proper XML.  
  
Then, to convert into a XHTML file (single file) use:
+
==Converting into XHTML==
  xsltproc /usr/share/xml/docbook/xhtml/docbook.xsl File.xml > Output.html
+
===Single file===
 
+
To convert into a XHTML file (single file) use:
 +
  xsltproc /usr/share/xml/docbook/`pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1`/xhtml/docbook.xsl File.xml > Output.html
 +
===Segmented===
 
To convert into a a segmented XHTML file (each section in its own file) use:
 
To convert into a a segmented XHTML file (each section in its own file) use:
  xsltproc /usr/share/xml/docbook/xhtml/chunk.xsl File.xml
+
  xsltproc /usr/share/xml/docbook/`pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1`/xhtml/chunk.xsl File.xml
  
And, of course, you can add these to <code>~/.bashrc</code>(or similar shell startup file):
+
==Automating==
 +
You can add these to <code>~/.bashrc</code>(or similar shell startup file):
 
<pre>
 
<pre>
 
alias doc2html1="xsltproc /usr/share/xml/docbook/xhtml/docbook.xsl"
 
alias doc2html1="xsltproc /usr/share/xml/docbook/xhtml/docbook.xsl"

Revision as of 18:16, 23 April 2012

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Docbook#)

We will assume that our docbook document is in File.xml

Setting up Docbook in Arch

To set up docbook running on arch:

$ pacman -S docbook-xml docbook-xsl libxslt libxml2

Validating XML file

To validate the XML file use:

$ xmllint --valid --noout File.xml

This will generate no output if the file is proper XML.

Converting into XHTML

Single file

To convert into a XHTML file (single file) use:

xsltproc /usr/share/xml/docbook/`pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1`/xhtml/docbook.xsl File.xml > Output.html

Segmented

To convert into a a segmented XHTML file (each section in its own file) use:

xsltproc /usr/share/xml/docbook/`pacman -Q docbook-xsl | cut -d ' ' -f 2 | cut -d '-' -f 1`/xhtml/chunk.xsl File.xml

Automating

You can add these to ~/.bashrc(or similar shell startup file):

alias doc2html1="xsltproc /usr/share/xml/docbook/xhtml/docbook.xsl"
alias doc2multihtml="xsltproc /usr/share/xml/docbook/xhtml/chunk.xsl"
alias docvalidate="xmllint --valid --noout"