CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
2
4 AutoDoc
3
4
5
4.1 The AutoDoc() function
6
7
4.1-1 AutoDoc
8
9
AutoDoc( [package[, optrec]] )  function
10
Returns: nothing
11
12
This is the main function of the AutoDoc package. It can perform any
13
combination of the following three tasks:
14
15
1 It can (re)generate a scaffold for your package manual. That is, it
16
can produce two XML files in GAPDoc format to be used as part of your
17
manual: First, a file named doc/PACKAGENAME.xml (with your package's
18
name substituted) which is used as main XML file for the package
19
manual, i.e. this file sets the XML doctype and defines various XML
20
entities, includes other XML files (both those generated by AutoDoc as
21
well as additional files created by other means), tells GAPDoc to
22
generate a table of content and an index, and more. Secondly, it
23
creates a file doc/title.xml containing a title page for your
24
documentation, with information about your package (name, description,
25
version), its authors and more, based on the data in your
26
PackageInfo.g.
27
28
2 It can scan your package for AutoDoc based documentation (by using
29
AutoDoc tags and the Autodoc command. This will produce further XML
30
files to be used as part of the package manual.
31
32
3 It can use GAPDoc to generate PDF, text and HTML (with MathJaX
33
enabled) documentation from the GAPDoc XML files it generated as well
34
as additional such files provided by you. For this, it invokes
35
MakeGAPDocDoc (GAPDoc: MakeGAPDocDoc) to convert the XML sources, and
36
it also instructs GAPDoc to copy supplementary files (such as CSS
37
style files) into your doc directory (see CopyHTMLStyleFiles (GAPDoc:
38
CopyHTMLStyleFiles)).
39
40
For more information and some examples, please refer to Chapter 1.
41
42
The parameters have the following meanings:
43
44
package
45
This is either the name of package, or an IsDirectory object. In the
46
former case, AutoDoc uses the metadata of the first package with that
47
name known to GAP. In the latter case, it checks whether the given
48
directory contains a PackageInfo.g file, and extracts all needed
49
metadata from that. This is for example useful if you have multiple
50
versions of the package around and want to make sure the documentation
51
of the correct version is built.
52
53
If this argument is omitted, AutoDoc uses the DirectoryCurrent().
54
55
optrec
56
optrec can be a record with some additional options. The following are
57
currently supported:
58
59
dir
60
This should be a string containing a (relative) path or a
61
Directory() object specifying where the package documentation
62
(i.e. the GAPDoc XML files) are stored.
63
Default value: "doc/".
64
65
scaffold
66
This controls whether and how to generate scaffold XML files for
67
the package documentation.
68
69
The value should be either true, false or a record. If it is a
70
record or true (the latter is equivalent to specifying an empty
71
record), then this feature is enabled. It is also enabled if
72
opt.scaffold is missing but the package's info record in
73
PackageInfo.g has an AutoDoc entry. In all other cases (in
74
particular if opt.scaffold is false), scaffolding is disabled.
75
76
If scaffolding is enabled, and PackageInfo.AutoDoc exists, then
77
it is assumed to be a record, and its contents are used as
78
default values for the scaffold settings.
79
80
If opt.scaffold is a record, it may contain the following
81
entries.
82
83
includes
84
A list of XML files to be included in the body of the main
85
XML file. If you specify this list and also are using
86
AutoDoc to document your operations with AutoDoc comments,
87
you can add _AutoDocMainFile.xml to this list to control
88
at which point the documentation produced by AutoDoc is
89
inserted. If you do not do this, it will be added after
90
the last of your own XML files.
91
92
index
93
By default, the scaffold creates an index. If you do not
94
want an index, set this to false.
95
96
appendix
97
This entry is similar to opt.scaffold.includes but is used
98
to specify files to include after the main body of the
99
manual, i.e. typically appendices.
100
101
bib
102
The name of a bibliography file, in BibTeX or XML format.
103
If this key is not set, but there is a file
104
doc/PACKAGENAME.bib then it is assumed that you want to
105
use this as your bibliography.
106
107
entities
108
A record whose keys are taken as entity names, set to the
109
corresponding (string) values. For example, if you pass
110
the record SomePackage,
111
112
 
113
rec( SomePackage := "<Package>SomePackage</Package>",
114
RELEASEYEAR := "2015" )
115

116
117
then the following entity definitions are added to the XML
118
preamble:
119
120
 
121
<!ENTITY SomePackage '<Package>SomePackage</Package>'>
122
<!ENTITY RELEASEYEAR '2015'>
123

124
125
This allows you to write &SomePackage; and &RELEASEYEAR;
126
in your documentation, which will be replaced by
127
respective values specified in the entities definition.
128
129
TitlePage
130
A record whose entries are used to embellish the generated
131
title page for the package manual with extra information,
132
such as a copyright statement or acknowledgments. To this
133
end, the names of the record components are used as XML
134
element names, and the values of the components are
135
outputted as content of these XML elements. For example,
136
you could pass the following record to set a custom
137
acknowledgements text:
138
139
 
140
rec( Acknowledgements := "Many thanks to ..." )
141

142
143
For a list of valid entries in the title page, please
144
refer to the GAPDoc manual, specifically section 'GAPDoc:
145
TitlePage'.
146
147
MainPage
148
If scaffolding is enabled, by default a main XML file is
149
generated (this is the file which contains the XML doctype
150
and more). If you do not want this (e.g. because you have
151
a handwritten main XML file), but still want AutoDoc to
152
generate a title page for you, you can set this option to
153
false
154
155
document_class
156
Sets the document class of the resulting PDF. The value
157
can either be a string which has to be the name of the new
158
document class, a list containing this string, or a list
159
of two strings. Then the first one has to be the document
160
class name, the second one the option string ( contained
161
in [ ] ) in LaTeX.
162
163
latex_header_file
164
Replaces the standard header from GAPDoc completely with
165
the header in this LaTeX file. Please be careful here, and
166
look at GAPDoc's latexheader.tex file for an example.
167
168
gapdoc_latex_options
169
Must be a record with entries which can be understood by
170
SetGapDocLaTeXOptions. Each entry can be a string, which
171
will be given to GAPDoc directly, or a list containing of
172
two entries: The first one must be the string "file", the
173
second one a filename. This file will be read and then its
174
content is passed to GAPDoc as option with the name of the
175
entry.
176
177
autodoc
178
This controls whether and how to generate addition XML
179
documentation files by scanning for AutoDoc documentation
180
comments.
181
182
The value should be either true, false or a record. If it is a
183
record or true (the latter is equivalent to specifying an empty
184
record), then this feature is enabled. It is also enabled if
185
opt.autodoc is missing but the package depends (directly) on the
186
AutoDoc package. In all other cases (in particular if
187
opt.autodoc is false), this feature is disabled.
188
189
If opt.autodoc is a record, it may contain the following
190
entries.
191
192
files
193
A list of files (given by paths relative to the package
194
directory) to be scanned for AutoDoc documentation
195
comments. Usually it is more convenient to use
196
autodoc.scan_dirs, see below.
197
198
scan_dirs
199
A list of subdirectories of the package directory (given
200
as relative paths) which AutoDoc then scans for .gi, .gd,
201
.g, and .autodoc files; all of these files are then
202
scanned for AutoDoc documentation comments.
203
Default value: [ ".", "gap", "lib", "examples",
204
"examples/doc" ].
205
206
level
207
This defines the level of the created documentation. The
208
default value is 0. When parts of the manual are declared
209
with a higher value they will not be printed into the
210
manual.
211
212
gapdoc
213
This controls whether and how to invoke GAPDoc to create HTML,
214
PDF and text files from your various XML files.
215
216
The value should be either true, false or a record. If it is a
217
record or true (the latter is equivalent to specifying an empty
218
record), then this feature is enabled. It is also enabled if
219
opt.gapdoc is missing. In all other cases (in particular if
220
opt.gapdoc is false), this feature is disabled.
221
222
If opt.gapdoc is a record, it may contain the following entries.
223
224
main
225
The name of the main XML file of the package manual. This
226
exists primarily to support packages with existing manual
227
which use a filename here which differs from the default.
228
In particular, specifying this is unnecessary when using
229
scaffolding.
230
Default value: PACKAGENAME.xml.
231
232
files
233
A list of files (given by paths relative to the package
234
directory) to be scanned for GAPDoc documentation
235
comments. Usually it is more convenient to use
236
gapdoc.scan_dirs, see below.
237
238
scan_dirs
239
A list of subdirectories of the package directory (given
240
as relative paths) which AutoDoc then scans for .gi, .gd
241
and .g files; all of these files are then scanned for
242
GAPDoc documentation comments.
243
Default value: [ ".", "gap", "lib", "examples",
244
"examples/doc" ].
245
246
gap_root_relative_path
247
Either a boolean, or a string containing a relative path.
248
By default (if this option is not set, or is set to
249
false), references in the generated documentation
250
referring to external documentation (such as the GAP
251
manual) are encoded using absolute paths. This is fine as
252
long as the documentation stays on only a single computer,
253
but is problematic when preparing documentation that
254
should be used on multiple computers, e.g., when creating
255
a distribution archive of a GAP package.
256
Thus, if a relative path is provided via this option (or
257
if it is set to true, in which case the relative path
258
../../.. is used), then AutoDoc and GAPDoc attempt to
259
replace all absolute paths in references to GAP manuals by
260
paths based on this relative path.
261
262
On a technical level, AutoDoc passes the relative path to
263
the gaproot parameter of MakeGAPDocDoc (GAPDoc:
264
MakeGAPDocDoc)
265
266
maketest
267
The maketest item can be true or a record. When it is true, a
268
simple maketest.g is created in the main package directory,
269
which can be used to test the examples from the manual. As a
270
record, the entry can have the following entries itself, to
271
specify some options.
272
273
filename
274
Sets the name of the test file.
275
276
commands
277
A list of strings, each one a command, which will be
278
executed at the beginning of the test file.
279
280
281
4.2 Examples
282
283
Some basic examples for using AutoDoc were already shown in Chapter 1.
284
285
286