1
<?xml version="1.0" encoding="iso-8859-1" ?>
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
7
<year>1997</year><year>2011</year>
8
<holder>Ericsson AB. All Rights Reserved.</holder>
11
The contents of this file are subject to the Erlang Public License,
12
Version 1.1, (the "License"); you may not use this file except in
13
compliance with the License. You should have received a copy of the
14
Erlang Public License along with this software. If not, it can be
15
retrieved online at http://www.erlang.org/.
17
Software distributed under the License is distributed on an "AS IS"
18
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
19
the License for the specific language governing rights and limitations
23
<title>How to Build OTP like documentation</title>
28
<file>doc-build.xml</file>
32
<title>Utilities to prepare XML files</title>
34
<title>Create XML files from code</title>
36
If there are EDoc comments in a module, the escript <c>xml_from_edoc.escript</c>
37
can be used to generate an XML file according to the <c>erlref</c> DTD
45
1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/xml_from_edoc.escript ex1.erl
49
<title>Include code in XML</title>
50
<p>If there are OTP DTD <i>codeinclude</i> tags in the source XML file, the escript
51
<c>codeline_preprocessing.escript</c> can be used to include the code and produce
52
an XML file according to the OTP DTDs.
59
1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/codeline_preprocessing.escript ex1.xmlsrc ex1.xml
65
<title>Use xsltproc to generate different output formats</title>
68
<title>Parameters used in all the the XSL transformations</title>
70
These parameters to <c>xsltproc</c> are used for all the supported output formats.
73
<tag><c>docgen</c></tag>
75
Path to erl_docgen's top directory.
77
<tag><c>gendate</c></tag>
79
The date string that will be used in the documentation.
81
<tag><c>appname</c></tag>
83
The name of the application.>
85
<tag><c>appver</c></tag>
87
The version of the application.
93
<title>Generate HTML output</title>
95
When generating HTML one also needs these three pramaters to <c>xsltproc</c>.
98
<tag><c>outdir</c></tag>
100
Output directory for the produced html files.
102
<tag><c>topdocdir</c></tag>
104
If one builds a standalone documentation for an application this should be set to ".".
106
<tag><c>pdfdir</c></tag>
108
Relative path from the html directory to where the pdf file are placed.
116
1> xsltproc --noout --stringparam outdir /tmp/myhtmldoc \
117
--stringparam docgen $(ERL_TOP)/lib/erl_docgen \
118
--stringparam topdocdir . \
119
--stringparam pdfdir "$(PDFDIR)" \
121
--stringparam gendate "December 5 2011" \
122
--stringparam appname MyApp \
123
--stringparam appver 0.1 \
124
-path $ERL_TOP/lib/erl_docgen/priv/dtd \
125
-path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
126
$ERL_TOP/lib/erl_docgen/priv/xsl/db_html.xsl mybook.xml
131
<title>Generate PDF</title>
133
The generation of the PDF file is done in two steps. First is <c>xsltproc</c> used to generate a <c>.fo</c> file
134
which is used as input to the <c>fop</c> command to produce th PDF file.
141
1> xsltproc --output MyApp.fo \
142
--stringparam docgen $ERL_TOP/lib/erl_docgen \
143
--stringparam gendate "December 5 2011" \
144
--stringparam appname MyApp \
145
--stringparam appver 0.1 \
147
-path $ERL_TOP/lib/erl_docgen/priv/dtd \
148
-path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
149
$ERL_TOP/lib/erl_docgen/priv/xsl/db_pdf.xsl mybook.xml
152
2> fop -fo MyApp.fo -pdf MyApp.pdf
157
<title>Generate man pages</title>
159
Unix man pages can be generated with <c>xsltproc</c> from XML files written according to
160
the different OTP ref type DTDs.
167
1> xsltproc --output my_module.3\
168
--stringparam docgen $ERL_TOP/lib/erl_docgen \
169
--stringparam gendate "December 5 2011" \
170
--stringparam appname MyApp \
171
--stringparam appver 0.1 \
172
--xinclude -path $ERL_TOP/lib/erl_docgen/priv/dtd \
173
-path $ERL_TOP/lib/erl_docgen/priv/dtd_man_entities \
174
$ERL_TOP/lib/erl_docgen/priv/xsl/db_man.xsl my_refpage.xml
179
<title>Upcomming changes</title>
181
The output from the <c>erl_docgen</c> documentation build process is now just the OTP style.
182
But in a near future we will for example add the possibility to change logo, color in the PDF and
183
style sheet for the HTML.