Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 1434

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<HTML
><HEAD
><TITLE
>Using DocBook</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.63
"><LINK
REL="HOME"
TITLE="DocBook Install mini-HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Install the Packages"
HREF="install.html"><LINK
REL="NEXT"
TITLE="Legal"
HREF="legal.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>DocBook Install mini-HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="install.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="legal.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="USING"
>4. Using DocBook</A
></H1
><P
>	Now that everything is installed, it's time to test it out
	and see how to use <B
CLASS="COMMAND"
>openjade</B
> and the other tools.
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN449"
></A
><P
><B
>Figure 1. Example DocBook SGML file - <TT
CLASS="FILENAME"
>test.sgml</TT
></B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>&#60;!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN"&#62;

&#60;article lang="en"&#62;
&#60;articleinfo&#62;
	&#60;title&#62;This is a Test&#60;/title&#62;

	&#60;author&#62;
		&#60;firstname&#62;John&#60;/firstname&#62;
		&#60;surname&#62;Doe&#60;/surname&#62;
		&#60;othername role="mi"&#62;L&#60;/othername&#62;
		&#60;affiliation&#62;
			&#60;address&#62;
			&#60;email&#62;j.doe@jdoe dot com&#60;/email&#62;
			&#60;/address&#62;
		&#60;/affiliation&#62;
	&#60;/author&#62;

	&#60;revhistory&#62;
		&#60;revision&#62;
		&#60;revnumber&#62;v1.0&#60;/revnumber&#62;
		&#60;date&#62;2000-12-30&#60;/date&#62;
		&#60;authorinitials&#62;jld&#60;/authorinitials&#62;
		&#60;/revision&#62;
	&#60;/revhistory&#62;

	&#60;abstract&#62;
	&#60;para&#62;
	This is a test DocBook document.
	&#60;/para&#62;
	&#60;/abstract&#62;

&#60;/articleinfo&#62;

&#60;sect1 id="test1"&#62;
&#60;title&#62;Test 1&#60;/title&#62;
&#60;para&#62;
Test section 1.
&#60;/para&#62;
	&#60;sect2&#62;
	&#60;title&#62;Test 1.1&#60;/title&#62;
	&#60;para&#62;
	Test section 1.1
	&#60;/para&#62;
	&#60;/sect2&#62;

	&#60;sect2&#62;
	&#60;title&#62;Test 1.2&#60;/title&#62;
	&#60;para&#62;
	&#60;screen&#62;
		-- Test section 1.2
		openjade -t sgml -d $DSLFILE test.sgml
	&#60;/screen&#62;
	&#60;/para&#62;
	&#60;/sect2&#62;

&#60;/sect1&#62;

&#60;sect1 id="test2"&#62;
&#60;title&#62;Test 2&#60;/title&#62;
&#60;para&#62;
Test section 2.
&#60;/para&#62;

	&#60;sect2&#62;
	&#60;title&#62;Test 2.1&#60;/title&#62;
	&#60;para&#62;
	Test section 2.1
	&#60;/para&#62;
	&#60;/sect2&#62;

	&#60;sect2&#62;
	&#60;title&#62;Test 2.2&#60;/title&#62;
	&#60;para&#62;
	Test section 2.2
	&#60;/para&#62;
	&#60;/sect2&#62;

&#60;/sect1&#62;
&#60;/article&#62;
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	For a guide to DocBook and a reference of DocBook elements, see:
	</P
><DIV
CLASS="FORMALPARA"
><P
><B
>DocBook: The Definitive Guide. </B
>	<A
HREF="http://www.docbook.org/tdg/en/"
TARGET="_top"
>http://www.docbook.org/tdg/en/</A
>
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN457"
>4.1. Generating HTML</A
></H2
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN459"
>4.1.1. <TT
CLASS="FILENAME"
>docbook.dsl</TT
></A
></H3
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN463"
></A
><P
><B
>Figure 2. Generating HTML output using <TT
CLASS="FILENAME"
>docbook.dsl</TT
></B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
total 4
-rw-r--r--   1 reaster  users        1077 Dec 31 16:25 test.sgml
bash$ echo $SGML_SHARE
/usr/local/share/sgml
bash$ openjade -t sgml -d $SGML_SHARE/dsssl/docbook/html/docbook.dsl test.sgml
[snip - DTDDECL catalog entries are not supported, repeats]
bash$ ls -l
total 12
-rw-r--r--   1 reaster  users        1885 Dec 31 17:34 t1.htm
-rw-r--r--   1 reaster  users        1077 Dec 31 16:25 test.sgml
-rw-r--r--   1 reaster  users        1544 Dec 31 17:34 x27.htm
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	The warnings about <TT
CLASS="VARNAME"
>DTDDECL</TT
> can be ignored. They might be a little annoying,
	but these warnings are normal when using <B
CLASS="COMMAND"
>openjade</B
>.  Other warnings and errors
	should be looked at and often indicate syntax errors that you should fix.
	</P
><P
>	Two <TT
CLASS="FILENAME"
>htm</TT
> files are generated, one for each <TT
CLASS="SGMLTAG"
>&#60;sect1&#62;</TT
>.
	The filenames are not very descriptive.  Section one appears on the same page as the article information.
	These are the results of using the default stylesheet that comes with the
	<EM
>Modular DocBook Stylesheets</EM
>, <TT
CLASS="FILENAME"
>docbook.dsl</TT
>.
	</P
><P
>	Stylesheets can be customized to improve on these defaults. If you
	downloaded the
	<A
HREF="http://www.linuxdoc.org/"
TARGET="_top"
>Linux Documentation Project</A
>'s
	<TT
CLASS="FILENAME"
>ldp.dsl</TT
> file and installed it as shown in Section 3.3,
	then you already have a customized style available.
	</P
></DIV
><DIV
CLASS="SECT3"
><H3
CLASS="SECT3"
><A
NAME="AEN477"
>4.1.2. <TT
CLASS="FILENAME"
>ldp.dsl</TT
></A
></H3
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN481"
></A
><P
><B
>Figure 3. Generating HTML output using <TT
CLASS="FILENAME"
>ldp.dsl</TT
></B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ openjade -t sgml -d $SGML_SHARE/dsssl/docbook/html/ldp.dsl#html test.sgml
bash$ ls -l
total 16
-rw-r--r--   1 reaster  users        2006 Dec 31 18:00 index.html
-rw-r--r--   1 reaster  users        1077 Dec 31 16:25 test.sgml
-rw-r--r--   1 reaster  users        1677 Dec 31 18:00 test1.html
-rw-r--r--   1 reaster  users        1598 Dec 31 18:00 test2.html
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	Using <TT
CLASS="FILENAME"
>ldp.dsl</TT
>, the output looks better:
	<P
></P
><UL
><LI
><P
>		An index file has been created that contains the article information.
		</P
></LI
><LI
><P
>		A table of contents has been automatically generated.
		</P
></LI
><LI
><P
>		Each <TT
CLASS="SGMLTAG"
>&#60;sect1&#62;</TT
> is in its own file.
		</P
></LI
><LI
><P
>		Filenames are derived from ID attributes of the <TT
CLASS="SGMLTAG"
>&#60;sect1&#62;</TT
> elements.
		</P
></LI
><LI
><P
>		The file extension has changed to <TT
CLASS="FILENAME"
>html</TT
>.
		</P
></LI
><LI
><P
>		The <TT
CLASS="SGMLTAG"
>&#60;screen&#62;</TT
> elements are shaded.
		</P
></LI
></UL
>
	</P
><P
>	Note how the <TT
CLASS="FILENAME"
>ldp.dsl</TT
> file is written in the command line:
	it has "<TT
CLASS="FILENAME"
>#html</TT
>" appended.  <TT
CLASS="FILENAME"
>ldp.dsl</TT
>
	contains two <TT
CLASS="SGMLTAG"
>&#60;STYLE-SPECIFICATION&#62;</TT
> elements, one with
	ID="html" and another with ID="print".  This selects the <TT
CLASS="FILENAME"
>html</TT
> style from within
	ldp.dsl.  The DocBook DSSSL contains support for converting DocBook
	files into <TT
CLASS="FILENAME"
>html</TT
> and print formats.  In Section 3.3, we copied <TT
CLASS="FILENAME"
>ldp.dsl</TT
>
	into both the print and <TT
CLASS="FILENAME"
>html</TT
> directories.  When generating <TT
CLASS="FILENAME"
>html</TT
> output,
	the <TT
CLASS="FILENAME"
>html</TT
> style should be selected like above.  When generating other types of
	files, such as <TT
CLASS="FILENAME"
>rtf</TT
> and <TT
CLASS="FILENAME"
>tex</TT
>, they fall under the print style and so
	the print style should be selected from <TT
CLASS="FILENAME"
>ldp.dsl</TT
>.  The alternative is
	to comment out or delete the print or <TT
CLASS="FILENAME"
>html</TT
> style in the copy of
	<TT
CLASS="FILENAME"
>ldp.dsl</TT
> in the respective directory.  If a <TT
CLASS="FILENAME"
>dsl</TT
> file has more than one style-spec
	in it and none is selected like in the example above, then the first
	style encountered in the file is selected.  For <TT
CLASS="FILENAME"
>ldp.dsl</TT
>, the print style-spec
	is first in the file, so it gets selected by default.  So in the example above,
	without appending "<TT
CLASS="FILENAME"
>#html</TT
>" when specifying <TT
CLASS="FILENAME"
>ldp.dsl</TT
> as the dsssl stylesheet,
	the "print" style-spec would be selected and used when generating the <TT
CLASS="FILENAME"
>html</TT
>
	output.  It will work, but is intended for when selecting the <TT
CLASS="FILENAME"
>print/ldp.dsl</TT
>
	and the formatting will be different.
	</P
><P
>	To learn more about how the stylesheet customization files are made, read the
	<A
HREF="http://nwalsh.com/docbook/dsssl/doc/"
TARGET="_top"
>documentation for the Modular DocBook Stylesheets</A
>.
	Customization mainly involves setting boolean option parameters to toggle style
	features on and off.  Completely new style logic can be programmed using the
	the <A
HREF="http://www.cs.berkeley.edu/~wilensky/CS294/dsssl/html/index.htm"
TARGET="_top"
>DSSSL</A
>
	language.
	</P
><P
>	The <B
CLASS="COMMAND"
>openjade</B
> option "-t output_type" specifies the output type.  The "-d dsssl_spec" option is the path
	to the dsssl stylesheet to use.  In the example above, the output type specified is sgml, which
	is for SGML to SGML transformations.  HTML, defined by the
	<A
HREF="http://www.w3.org/TR/html4/sgml/dtd.html"
TARGET="_top"
>HTML Document Type Definition (DTD)</A
>,
	is an SGML document type just as DocBook is, so "sgml" is the correct output_type option.  The
	other two output types commonly used are "rtf" and "tex".  The tex output_type will be used
	later as an intermediate format for the generation of <TT
CLASS="FILENAME"
>pdf</TT
> and <TT
CLASS="FILENAME"
>ps</TT
>
	formats.  The dsssl_spec must specify a <TT
CLASS="FILENAME"
>dsl</TT
> file, not a directory.
	</P
></DIV
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN535"
>4.2. Generating rtf and tex</A
></H2
><P
>	<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
bash$ openjade -t rtf -d $SGML_SHARE/dsssl/docbook/print/ldp.dsl#print test.sgml
bash$ openjade -t tex -d $SGML_SHARE/dsssl/docbook/print/ldp.dsl#print test.sgml
bash$ ls -l
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
	</PRE
></FONT
></TD
></TR
></TABLE
>
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN539"
>4.3. Generating dvi and ps</A
></H2
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN542"
></A
><P
><B
>Figure 4. Running jadetex to generate a Device Independent (dvi) file.</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$ jadetex test.tex
This is TeX, Version 3.14159 (Web2C 7.3.1)
(test.tex
JadeTeX 1999/06/29: 2.7
(/usr/share/texmf/tex/latex/psnfss/t1ptm.fd)
(/usr/share/texmf/tex/jadetex/isoents.tex)
Elements will be labelled
Jade begin document sequence at 19
No file test.aux.
(/usr/share/texmf/tex/latex/cyrillic/ot2cmr.fd)
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf/tex/latex/lucidabr/lmrhlcm.fd)
(/usr/share/texmf/tex/latex/hyperref/nameref.sty)
(/usr/share/texmf/tex/latex/psnfss/t1phv.fd)

LaTeX Warning: Reference `TEST1' on page 1 undefined on input line 238.


LaTeX Warning: Reference `20' on page 1 undefined on input line 262.


LaTeX Warning: Reference `23' on page 1 undefined on input line 285.


LaTeX Warning: Reference `TEST2' on page 1 undefined on input line 316.


LaTeX Warning: Reference `30' on page 1 undefined on input line 340.


LaTeX Warning: Reference `33' on page 1 undefined on input line 363.

[1.0.46] (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) [2.0.46] [3.0.46]
(test.aux)

LaTeX Warning: There were undefined references.

 )
Output written on test.dvi (3 pages, 34984 bytes).
Transcript written on test.log.
bash$ ls -l
total 80
-rw-r--r--   1 reaster  users         771 Dec 31 20:55 test.aux
-rw-r--r--   1 reaster  users       34984 Dec 31 20:55 test.dvi
-rw-r--r--   1 reaster  users        5072 Dec 31 20:55 test.log
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$ jadetex test.tex
This is TeX, Version 3.14159 (Web2C 7.3.1)
(test.tex
JadeTeX 1999/06/29: 2.7
(/usr/share/texmf/tex/latex/psnfss/t1ptm.fd)
(/usr/share/texmf/tex/jadetex/isoents.tex)
Elements will be labelled
Jade begin document sequence at 19
(test.aux) (/usr/share/texmf/tex/latex/cyrillic/ot2cmr.fd)
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf/tex/latex/lucidabr/lmrhlcm.fd)
(/usr/share/texmf/tex/latex/hyperref/nameref.sty)
(/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1.0.46]
(/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) [2.0.46] [3.0.46] (test.aux) )
Output written on test.dvi (3 pages, 34148 bytes).
Transcript written on test.log.
You have new mail in /var/spool/mail/reaster
bash$ ls -l
total 80
-rw-r--r--   1 reaster  users         753 Dec 31 20:58 test.aux
-rw-r--r--   1 reaster  users       34148 Dec 31 20:58 test.dvi
-rw-r--r--   1 reaster  users        4433 Dec 31 20:58 test.log
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	The first time <B
CLASS="COMMAND"
>jadetex</B
> is run, warnings are printed.  They can
	be ignored.  Running it a second time, they do not appear again.
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN548"
></A
><P
><B
>Figure 5. Running <B
CLASS="COMMAND"
>dvips</B
> to generate a <SPAN
CLASS="PRODUCTNAME"
>PostScript</SPAN
> (ps) file.</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
total 80
-rw-r--r--   1 reaster  users         753 Dec 31 20:58 test.aux
-rw-r--r--   1 reaster  users       34148 Dec 31 20:58 test.dvi
-rw-r--r--   1 reaster  users        4433 Dec 31 20:58 test.log
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$ dvips test.dvi
This is dvips(k) 5.86 Copyright 1999 Radical Eye Software (www.radicaleye.com)
' TeX output 2000.12.31:2058' -&#62; test.ps
&#60;texc.pro&#62;&#60;8r.enc&#62;&#60;texps.pro&#62;&#60;special.pro&#62;&#60;color.pro&#62;. [1] [2] [3]
bash$ ls -l
total 116
-rw-r--r--   1 reaster  users         753 Dec 31 20:58 test.aux
-rw-r--r--   1 reaster  users       34148 Dec 31 20:58 test.dvi
-rw-r--r--   1 reaster  users        4433 Dec 31 20:58 test.log
-rw-r--r--   1 reaster  users       34817 Dec 31 21:06 test.ps
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN554"
></A
><P
><B
>Figure 6. Running <B
CLASS="COMMAND"
>htmldoc</B
> to generate a <SPAN
CLASS="PRODUCTNAME"
>PostScript</SPAN
> (<TT
CLASS="FILENAME"
>ps</TT
>) file.</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
bash$ export DSL_HTML=$SGML_SHARE/dsssl/docbook/html/ldp.dsl\#html
bash$ openjade -t sgml -V nochunks -d $DSL_HTML test.sgml | htmldoc -f test-htmldoc.ps -
bash$ ls -l
-rw-r--r--   1 reaster  users        9050 Jan  1 00:44 test-htmldoc.ps
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	If the <TT
CLASS="FILENAME"
>ps</TT
> file doesn't appear as expected, it may be due
	to bugs in <B
CLASS="COMMAND"
>htmldoc</B
>. Look inside the <B
CLASS="COMMAND"
>ldp_print</B
>
	script if you want to use it to make <TT
CLASS="FILENAME"
>ps</TT
>.
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN564"
>4.4. Generating pdf</A
></H2
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN567"
></A
><P
><B
>Figure 7. Running <B
CLASS="COMMAND"
>pdfjadetex</B
> to generate a Portable Document Format (<TT
CLASS="FILENAME"
>pdf</TT
>) file.</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
-rw-r--r--   1 reaster  users         753 Dec 31 20:58 test.aux
-rw-r--r--   1 reaster  users       34148 Dec 31 20:58 test.dvi
-rw-r--r--   1 reaster  users        4433 Dec 31 20:58 test.log
-rw-r--r--   1 reaster  users       34817 Dec 31 21:06 test.ps
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$ pdfjadetex test.tex
This is pdfTeX, Version 3.14159-13d (Web2C 7.3.1)
(test.tex[/usr/share/texmf/pdftex/config/pdftex.cfg]
JadeTeX 1999/06/29: 2.7
(/usr/share/texmf/tex/latex/psnfss/t1ptm.fd)
(/usr/share/texmf/tex/jadetex/isoents.tex)
Elements will be labelled
Jade begin document sequence at 19
(test.aux) (/usr/share/texmf/tex/latex/cyrillic/ot2cmr.fd)
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf/tex/latex/lucidabr/lmrhlcm.fd)
(/usr/share/texmf/tex/context/base/supp-pdf.tex
(/usr/share/texmf/tex/context/base/supp-mis.tex
loading : Context Support Macros / Missing
)
loading : Context Support Macros / PDF
) (/usr/share/texmf/tex/latex/hyperref/nameref.sty)
(/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1.0.46[/usr/share/texmf/dvips/con
fig/pdftex.map]] (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) [2.0.46] [3.0.46]
 (test.aux) )&#60;8r.enc&#62;
Output written on test.pdf (3 pages, 9912 bytes).
Transcript written on test.log.
bash$ ls -l
total 128
-rw-r--r--   1 reaster  users         753 Dec 31 21:13 test.aux
-rw-r--r--   1 reaster  users       34148 Dec 31 20:58 test.dvi
-rw-r--r--   1 reaster  users        5075 Dec 31 21:13 test.log
-rw-r--r--   1 reaster  users        9912 Dec 31 21:13 test.pdf
-rw-r--r--   1 reaster  users       34817 Dec 31 21:06 test.ps
-rw-r--r--   1 reaster  users        4584 Dec 31 20:51 test.rtf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
-rw-r--r--   1 reaster  users       18719 Dec 31 20:51 test.tex
bash$
bash$ pdfjadetex test.tex
[snip]
bash$ pdfjadetex test.tex
[snip]
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	<B
CLASS="COMMAND"
>pdfjadetex</B
> must be run up to three times to resolve all
	internal references for things such as TOC page numbers.
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN574"
></A
><P
><B
>Figure 8. Running <B
CLASS="COMMAND"
>htmldoc</B
> to generate a Portable Document Format (<TT
CLASS="FILENAME"
>pdf</TT
>) file.</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
bash$ export DSL_HTML=$SGML_SHARE/dsssl/docbook/html/ldp.dsl\#html
bash$ openjade -t sgml -V nochunks -d $DSL_HTML test.sgml &#62; test-htmldoc.htm
bash$ ldp_print test-htmldoc.htm
bash$ ls -l
-rw-r--r--   1 reaster  users        9050 Jan  1 01:17 test-htmldoc.pdf
-rw-r--r--   1 reaster  users        1143 Dec 31 18:18 test.sgml
bash$
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	If enabled in the <B
CLASS="COMMAND"
>ldp_print</B
> script, this would generate a <TT
CLASS="FILENAME"
>ps</TT
> file
	also.
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN581"
>4.5. Using <B
CLASS="COMMAND"
>make</B
></A
></H2
><P
>	Repeating the commands to generate the output files is tedious.
	The <B
CLASS="COMMAND"
>make</B
> command works perfectly to automate the process.
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN587"
></A
><P
><B
>Figure 9. Filename: <TT
CLASS="FILENAME"
>Makefile</TT
> - automates document generation.</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
># Generates online and print versions of SGML source file.

BASENAME=DocBook-Install

# SGML source file.
SGML_FILE=$(BASENAME).sgml

# Stylesheets
DSL_PRINT=$(SGML_SHARE)/dsssl/docbook/print/ldp.dsl\#print
DSL_HTML=$(SGML_SHARE)/dsssl/docbook/html/ldp.dsl\#html

# Generated files.
HTML_FILE=index.html
HTM_FILE=$(BASENAME).htm
TEX_FILE=$(BASENAME).tex
RTF_FILE=$(BASENAME).rtf
PDF_FILE=$(BASENAME).pdf
DVI_FILE=$(BASENAME).dvi
PS_FILE=$(BASENAME).ps


# Build rules.

html: $(HTML_FILE)

htm: $(HTM_FILE)

tex: $(TEX_FILE)

rtf: $(RTF_FILE)

pdf: $(PDF_FILE)

dvi: $(DVI_FILE)

ps: $(PS_FILE)

all: html htm tex rtf pdf dvi ps

clean:
	rm -f $(BASENAME).{htm,log,aux,ps,pdf,tex,dvi,rtf,fot}
	rm -f *.html

distclean: clean
	rm -f $(BASENAME).tgz

package:
	rm -f $(BASENAME).tgz
	tar -C .. -czf /tmp/$(BASENAME).tgz $(BASENAME)
	mv /tmp/$(BASENAME).tgz .

dist: clean package

distall: all package


# Compile rules.

$(HTML_FILE): $(SGML_FILE)
	openjade -t sgml -d $(DSL_HTML) $(SGML_FILE)

$(HTM_FILE): $(SGML_FILE)
	openjade -t sgml -V nochunks -d $(DSL_HTML) \
	$(SGML_FILE) &#62; $(HTM_FILE)

$(TEX_FILE): $(SGML_FILE)
	openjade -t tex -d $(DSL_PRINT) $(SGML_FILE)

$(RTF_FILE): $(SGML_FILE)
	openjade -t rtf -d $(DSL_PRINT) $(SGML_FILE)

# [pdf]jadetex is run 3 times to resolve references.
#$(PDF_FILE): $(TEX_FILE)
#	pdfjadetex $(TEX_FILE)
#	pdfjadetex $(TEX_FILE)
#	pdfjadetex $(TEX_FILE)

# This *should* work, but htmldoc has bugs ...
#$(PDF_FILE): $(SGML_FILE)
#	openjade -t sgml -V nochunks -d $(DSL_HTML) \
#	$(SGML_FILE) | htmldoc -f $(PDF_FILE) -

# Have to use ldp_print to work around htmldoc bugs
# ldp_print can also do the ps file - see script
$(PDF_FILE): $(HTM_FILE)
	ldp_print $(HTM_FILE)

$(DVI_FILE): $(TEX_FILE)
	jadetex $(TEX_FILE)
	jadetex $(TEX_FILE)
	jadetex $(TEX_FILE)

$(PS_FILE): $(DVI_FILE)
	dvips $(DVI_FILE)

#$(PS_FILE): $(SGML_FILE)
#	openjade -t sgml -V nochunks -d $(DSL_HTML) \
#	$(SGML_FILE) | htmldoc -f $(PS_FILE) -
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	Usage is just like for most projects:
	<DIV
CLASS="FIGURE"
><A
NAME="AEN592"
></A
><P
><B
>Figure 10. Invoking <B
CLASS="COMMAND"
>make</B
> to run <TT
CLASS="FILENAME"
>Makefile</TT
></B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>		-- generate html (default)
		make
		-- generate just pdf
		make pdf
		-- generate all files
		make all
		-- delete all generated files
		make clean
		-- create tgz distribution
		-- with no generated files
		make dist
		-- create tgz distribution
		-- containing all generated files
		make distall
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	Notice the commented compile rules for <TT
CLASS="FILENAME"
>pdf</TT
> and <TT
CLASS="FILENAME"
>ps</TT
> which
	provide alternative means of generating those files.
	</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN600"
>4.6. Generating a <B
CLASS="COMMAND"
>man</B
> page</A
></H2
><P
>	During the section on installing everything, we installed
	the <B
CLASS="COMMAND"
>perl</B
> version 5 module <TT
CLASS="FILENAME"
>SGMLS.pm</TT
>.
	Then we installed Docbook2X which provides the <TT
CLASS="FILENAME"
>spec.pl</TT
> files for transforming
	DocBook <TT
CLASS="SGMLTAG"
>&#60;refentry&#62;</TT
> documents into
	<B
CLASS="COMMAND"
>nroff</B
> (<B
CLASS="COMMAND"
>man</B
> page) format
	with <B
CLASS="COMMAND"
>sgmlspl</B
>.
	</P
><P
>	An example Docbook <TT
CLASS="SGMLTAG"
>&#60;refentry&#62;</TT
> document, for the
	<B
CLASS="COMMAND"
>foo</B
> command, is given below.
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN615"
></A
><P
><B
>Figure 11. <B
CLASS="COMMAND"
>foo</B
> command <B
CLASS="COMMAND"
>man</B
> page, docbook <TT
CLASS="SGMLTAG"
>&#60;refentry&#62;</TT
> source (<TT
CLASS="FILENAME"
>foo-ref.sgml</TT
>)</B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>&#60;!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN"&#62;
&#60;refentry&#62;
&#60;refentryinfo&#62;
	&#60;date&#62;2001-01-01&#60;/date&#62;
&#60;/refentryinfo&#62;
&#60;refmeta&#62;
	&#60;refentrytitle&#62;
		&#60;application&#62;foo&#60;/application&#62;
	&#60;/refentrytitle&#62;
	&#60;manvolnum&#62;1&#60;/manvolnum&#62;
	&#60;refmiscinfo&#62;foo 1.0&#60;/refmiscinfo&#62;
&#60;/refmeta&#62;
&#60;refnamediv&#62;
	&#60;refname&#62;
		&#60;application&#62;foo&#60;/application&#62;
	&#60;/refname&#62;
	&#60;refpurpose&#62;
	Does nothing useful.
	&#60;/refpurpose&#62;
&#60;/refnamediv&#62;
&#60;refsynopsisdiv&#62;
	&#60;refsynopsisdivinfo&#62;
		&#60;date&#62;2001-01-01&#60;/date&#62;
	&#60;/refsynopsisdivinfo&#62;
	&#60;cmdsynopsis&#62;
	&#60;command&#62;foo&#60;/command&#62;
&#60;arg&#62;&#60;option&#62;-f &#60;/option&#62;&#60;replaceable class="parameter"&#62;bar&#60;/replaceable&#62;&#60;/arg&#62;
&#60;arg&#62;&#60;option&#62;-d&#60;replaceable class="parameter"&#62;n&#60;/replaceable&#62;&#60;/option&#62;&#60;/arg&#62;
&#60;arg rep="repeat"&#62;&#60;replaceable class="parameter"&#62;file&#60;/replaceable&#62;&#60;/arg&#62;
	&#60;/cmdsynopsis&#62;
&#60;/refsynopsisdiv&#62;
&#60;refsect1&#62;
	&#60;refsect1info&#62;
		&#60;date&#62;2001-01-01&#60;/date&#62;
	&#60;/refsect1info&#62;
	&#60;title&#62;DESCRIPTION&#60;/title&#62;
	&#60;para&#62;
	&#60;command&#62;foo&#60;/command&#62; does nothing useful.
	&#60;/para&#62;
&#60;/refsect1&#62;
&#60;refsect1&#62;
	&#60;title&#62;OPTIONS&#60;/title&#62;
	&#60;variablelist&#62;
	&#60;varlistentry&#62;
		&#60;term&#62;-f &#60;replaceable class="parameter"&#62;bar&#60;/replaceable&#62;&#60;/term&#62;
		&#60;listitem&#62;
			&#60;para&#62;
			Takes &#60;filename&#62;bar&#60;/filename&#62; as it's run
			control file. If this were a real program,
			there might be more to say here about what
			bar is and how it will be used.
			&#60;/para&#62;
		&#60;/listitem&#62;
	&#60;/varlistentry&#62;
	&#60;varlistentry&#62;
		&#60;term&#62;-d&#60;replaceable class="parameter"&#62;n&#60;/replaceable&#62;&#60;/term&#62;
		&#60;listitem&#62;
			&#60;para&#62;
			Do something, where integer
			&#60;replaceable class="parameter"&#62;n&#60;/replaceable&#62;
			specifies how many times.
			&#60;/para&#62;
		&#60;/listitem&#62;
	&#60;/varlistentry&#62;
	&#60;varlistentry&#62;
		&#60;term&#62;&#60;replaceable class="parameter"&#62;file...&#60;/replaceable&#62;&#60;/term&#62;
		&#60;listitem&#62;
			&#60;para&#62;
			Processes the files in the order listed,
			sending all output to stdout.
			&#60;/para&#62;
		&#60;/listitem&#62;
	&#60;/varlistentry&#62;
	&#60;/variablelist&#62;
&#60;/refsect1&#62;
&#60;refsect1&#62;
	&#60;title&#62;USAGE&#60;/title&#62;
	&#60;para&#62;
	&#60;command&#62;foo&#60;/command&#62; -f foo.conf -d2 foodata.foo
	&#60;/para&#62;
&#60;/refsect1&#62;
&#60;refsect1&#62;
	&#60;title&#62;CAVEATS&#60;/title&#62;
	&#60;para&#62;
	Other programs named &#60;command&#62;foo&#60;/command&#62; may exist and actually
	do something!
	&#60;/para&#62;
&#60;/refsect1&#62;
&#60;refsect1&#62;
	&#60;title&#62;BUGS&#60;/title&#62;
	&#60;para&#62;
	None.  Program does nothing.
	&#60;/para&#62;
&#60;/refsect1&#62;
&#60;refsect1&#62;
	&#60;title&#62;AUTHOR&#60;/title&#62;
	&#60;para&#62;
	&#60;author&#62;
		&#60;firstname&#62;Foo&#60;/firstname&#62;
		&#60;othername role="mi"&#62;E&#60;/othername&#62;
		&#60;surname&#62;Bar&#60;/surname&#62;
		&#60;contrib&#62;Original author&#60;/contrib&#62;
	&#60;/author&#62;
	&#60;/para&#62;
&#60;/refsect1&#62;
&#60;/refentry&#62;
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	<DIV
CLASS="FIGURE"
><A
NAME="AEN623"
></A
><P
><B
>Figure 12. Generating a <B
CLASS="COMMAND"
>man</B
> page with <B
CLASS="COMMAND"
>onsgmls</B
>, <B
CLASS="COMMAND"
>sgmlspl</B
>, and <TT
CLASS="FILENAME"
>docbook2man-spec.pl</TT
></B
></P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>bash$ ls -l
-rw-r--r--   1 reaster  users        2434 Jan  3 03:51 foo-ref.sgml
bash$ onsgmls foo-ref.sgml | sgmlspl $SGML_SHARE/docbook2X/docbook2man-spec.pl
bash$ ls -l
-rw-r--r--   1 reaster  users        2434 Jan  3 03:51 foo-ref.sgml
-rw-r--r--   1 reaster  users        1129 Jan  3 04:03 foo.1
-rw-r--r--   1 reaster  users           0 Jan  3 04:03 manpage.links
-rw-r--r--   1 reaster  users           0 Jan  3 04:03 manpage.log
-rw-r--r--   1 reaster  users          15 Jan  3 04:03 manpage.refs
bash$ groff -mandoc -Tascii foo.1

FOO(1)                                                     FOO(1)


NAME
       foo - Does nothing useful.

SYNOPSIS
       foo [ -f bar ]  [ -dn ]  [ file... ]

DESCRIPTION
       foo does nothing useful.

OPTIONS
       -f bar Takes  bar as its run control file. If this were a
              real program, there might be more to say here about
              what bar is and how it will be used.

       -dn    Do  something,  where  integer n specifies how many
              times.

       file...
              Processes the files in the  order  listed,  sending
              all output to stdout.

USAGE
       foo -f foo.conf -d2 foodata.foo

CAVEATS
       Other  programs  named foo may exist and actually do some-
       thing!

BUGS
       None. Program does nothing.

AUTHOR
       Foo E Bar (Original author)

[snip - several extra blank lines that man would not show]
foo 1.0                     2001-01-01                          1
bash$ groff -mandoc -Tascii foo.1 | less
bash$ less foo.1
	</PRE
></FONT
></TD
></TR
></TABLE
></DIV
>
	</P
><P
>	The <B
CLASS="COMMAND"
>man</B
> page, <TT
CLASS="FILENAME"
>foo.1</TT
>, is generated as a Section 1 page. The
	<B
CLASS="COMMAND"
>groff</B
> command is used to give a quick look at its formatted
	appearance.
	</P
><P
>	To <B
CLASS="COMMAND"
>install</B
> this <B
CLASS="COMMAND"
>man</B
> page, it belongs in any <TT
CLASS="FILENAME"
>man/man1</TT
> directory,
	where the directory <TT
CLASS="FILENAME"
>man/</TT
> is added to <TT
CLASS="ENVAR"
>$MANPATH</TT
>
	in the environment. The standard location is
	<TT
CLASS="FILENAME"
>/usr/local/man/man1</TT
>.
	The standard sections in the <B
CLASS="COMMAND"
>man</B
> pages system are 1 though 9.
	Each is for holding specific catagories of documentation.
	</P
><DIV
CLASS="TABLE"
><A
NAME="AEN642"
></A
><P
><B
>Table 1. Manual Pages Sections</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><THEAD
><TR
><TH
ALIGN="CENTER"
VALIGN="TOP"
>Section</TH
><TH
ALIGN="CENTER"
VALIGN="TOP"
>Purpose</TH
></TR
></THEAD
><TBODY
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man1</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>User programs</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man2</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>System calls</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man3</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>Library functions and subroutines</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man4</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>Devices</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man5</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>File formats</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man6</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>Games</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man7</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>Miscellaneous</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man8</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>System administration</TD
></TR
><TR
><TD
ALIGN="CENTER"
VALIGN="TOP"
>man9</TD
><TD
ALIGN="CENTER"
VALIGN="TOP"
>Kernel internal variables and functions</TD
></TR
></TBODY
></TABLE
></DIV
><DIV
CLASS="TIP"
><P
></P
><TABLE
CLASS="TIP"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/tip.gif"
HSPACE="5"
ALT="Tip"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>	The source file for a <B
CLASS="COMMAND"
>man</B
> page, like <TT
CLASS="FILENAME"
>foo-ref.sgml</TT
>,
	can be processed into all the other formats just like any other
	DocBook file.  So using the same commands discussed earlier to generate
	<TT
CLASS="FILENAME"
>html</TT
> and print output types, a <B
CLASS="COMMAND"
>man</B
> page can
	be made into <TT
CLASS="FILENAME"
>html</TT
> and <TT
CLASS="FILENAME"
>rtf</TT
>, <TT
CLASS="FILENAME"
>tex</TT
>,
	<TT
CLASS="FILENAME"
>pdf</TT
>, <TT
CLASS="FILENAME"
>dvi</TT
>, and <TT
CLASS="FILENAME"
>ps</TT
>.
	This can really save a lot of conversion work!
	</P
></TD
></TR
></TABLE
></DIV
><P
>	Have fun <EM
>!</EM
>
	</P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="install.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="legal.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Install the Packages</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Legal</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>