aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_docgen/doc/src/doc-build.xml
blob: ae1b17dff5032eef3ca25d5cee8627d8fdc7e731 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>1997</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
     </legalnotice>
    <title>How to Build OTP like documentation</title>
    <prepared></prepared>
    <docno></docno>
    <date></date>
    <rev></rev>
    <file>doc-build.xml</file>
  </header>

  <section>
    <title>Utilities to prepare XML files</title>
    <section>
      <title>Create XML files from code</title>
      <p>
	If there are EDoc comments in a module, the escript <c>xml_from_edoc.escript</c>
	can be used to generate an XML file according to the <c>erlref</c> DTD 
	for this module.
      </p>
      <p>
	Example:
      </p>
      <code>

	1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/xml_from_edoc.escript ex1.erl
      </code>
    </section>
    <section>
      <title>Include code in XML</title>
      <p>If there are OTP DTD <i>codeinclude</i> tags in the source XML file, the escript
          <c>codeline_preprocessing.escript</c> can be used to include the code and produce
	  an XML file according to the OTP DTDs. 
      </p>
      <p>
	Example:
      </p>
      <code>

	1> escript $(ERL_TOP)/lib/erl_docgen/priv/bin/codeline_preprocessing.escript \
	   ex1.xmlsrc ex1.xml
      </code>
    </section>
  </section>

  <section>
    <title>Use xsltproc to generate different output formats</title>

    <section>
      <title>Parameters used in all the the XSL transformations</title>
      <p>
	These parameters to <c>xsltproc</c> are used for all the supported output formats.
      </p>
      <taglist>
	<tag><c>docgen</c></tag>
	<item>
	  Path to erl_docgen's top directory.
	</item>
	<tag><c>gendate</c></tag>
	<item>
	  The date string that will be used in the documentation.
	</item>
	<tag><c>appname</c></tag>
	<item>
	  The name of the application.>
	</item> 
	<tag><c>appver</c></tag>
	<item>
	  The version of the application.
	</item>
     </taglist>
    </section>

    <section>
      <title>Generate HTML output</title>
      <p>
	When generating HTML one also needs these three pramaters to <c>xsltproc</c>.
      </p> 
      <taglist>
	<tag><c>outdir</c></tag>
	<item>
	  Output directory for the produced html files.
	</item>
 	<tag><c>topdocdir</c></tag>
	<item>
	  If one builds a standalone documentation for an application this should be set to ".".
	</item>
	<tag><c>pdfdir</c></tag>
	<item>
	  Relative path from the html directory to where the pdf file are placed.
	</item>
      </taglist>
      <p>
	Example:
      </p>
      <code>
	
	1> xsltproc --noout --stringparam outdir /tmp/myhtmldoc \
	      --stringparam docgen $(ERL_TOP)/lib/erl_docgen \
              --stringparam topdocdir . \
              --stringparam pdfdir "$(PDFDIR)" \
              --xinclude \
	      --stringparam gendate "December 5 2011" \
              --stringparam appname MyApp \
              --stringparam appver 0.1 \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
	      $ERL_TOP/lib/erl_docgen/priv/xsl/db_html.xsl mybook.xml
      </code>
    </section>

    <section>
      <title>Generate PDF</title>
      <p>
	The generation of the PDF file is done in two steps. First is <c>xsltproc</c> used to generate a <c>.fo</c> file 
	which is used as input to the <c>fop</c> command to produce th PDF file.
      </p>
      <p>
	Example:
      </p>
      <code>

	1> xsltproc --output MyApp.fo \
             --stringparam docgen $ERL_TOP/lib/erl_docgen \
	     --stringparam gendate  "December 5 2011" \
             --stringparam appname MyApp \
             --stringparam appver 0.1 \
             --xinclude \
             -path $ERL_TOP/lib/erl_docgen/priv/dtd \
             -path $ERL_TOP/lib/erl_docgen/priv/dtd_html_entities \
	     $ERL_TOP/lib/erl_docgen/priv/xsl/db_pdf.xsl mybook.xml


        2> fop -fo MyApp.fo -pdf MyApp.pdf
      </code>
    </section>

    <section>
      <title>Generate man pages</title>
      <p>
	Unix man pages can be generated with <c>xsltproc</c> from XML files written according to 
	the different OTP ref type DTDs. 
      </p>
      <p>
	Example:
      </p>
      <code>

	1> xsltproc --output  my_module.3\
	      --stringparam docgen $ERL_TOP/lib/erl_docgen \
	      --stringparam gendate  "December 5 2011" \
	      --stringparam appname MyApp \
	      --stringparam appver 0.1 \
	      --xinclude -path $ERL_TOP/lib/erl_docgen/priv/dtd  \
              -path $ERL_TOP/lib/erl_docgen/priv/dtd_man_entities \
              $ERL_TOP/lib/erl_docgen/priv/xsl/db_man.xsl my_refpage.xml
      </code>
    </section>

    <section>
      <title>Upcomming changes</title>
      <p>
	The output from the <c>erl_docgen</c> documentation build process is now just the OTP style. 
	But in a near future we will for example add the possibility to change logo, color in the PDF and 
	style sheet for the HTML.
      </p>
    </section>

  </section>
</chapter>