You can document declarations of global functions and variables, operations,
attributes etc. by inserting <E>&AutoDoc;</E> comments into your sources before these declaration.
An &AutoDoc; comment always starts with <C>#!</C>.
This is also the smallest possible &AutoDoc; command.
If you want your declaration documented, just write
<C>#!</C> at the line before the documentation. For example:
In the bare form above, the manual entry for <C>AnOperation</C> will not
contain much more than the name of the operation. In order to change
this, there are several commands you can put into the &AutoDoc; comment
before the declaration. Currently, the following commands are provided:
<Subsection Label="@Description">
<Index Key="@Description"><C>@Description <A>descr</A></C></Index>
<Heading><C>@Description <A>descr</A></C></Heading>
Adds the text in the following lines of the &AutoDoc; to the description
of the declaration in the manual. Lines are until the next &AutoDoc; command
or until the declaration is reached.
</Subsection>
<Subsection Label="@Returns">
<Index Key="@Returns"><C>@Returns <A>ret_val</A></C></Index>
<Heading><C>@Returns <A>ret_val</A></C></Heading>
The string <A>ret_val</A> is added to the documentation, with the text <Q>Returns: </Q>
put in front of it. This should usually give a brief hint about the type or meaning
of the value returned by the documented function.
</Subsection>
<Subsection Label="@Arguments">
<Index Key="@Arguments"><C>@Arguments <A>args</A></C></Index>
<Heading><C>@Arguments <A>args</A></C></Heading>
The string <A>args</A> contains a description of the arguments the
function expects, including optional parts, which are denoted by square
brackets. The argument names can be separated by whitespace, commas or
square brackets for the optional arguments, like <Q>grp[, elm]</Q> or
<Q>xx[y[z] ]</Q>. If &GAP; options are used, this can be followed by a colon :
and one or more assignments, like <Q>n[, r]: tries := 100</Q>.
</Subsection>
<Subsection Label="@Group">
<Index Key="@Group"><C>@Group <A>grpname</A></C></Index>
<Heading><C>@Group <A>grpname</A></C></Heading>
Adds the following method to a group with the given name.
See section <Ref Sect="Groups"/> for more information about groups.
</Subsection>
<Subsection Label="@Label">
<Index Key="@Label"><C>@Label <A>label</A></C></Index>
<Heading><C>@Label <A>label</A></C></Heading>
Adds label to the function as label.
If this is not specified, then for declarations that involve a list of input filters
(as is the case for <C>DeclareOperation</C>, <C>DeclareAttribute</C>, etc.),
a default label is generated from this filter list.
</Subsection>
<Listing><![CDATA[
#! @Label testlabel
DeclareProperty( "AProperty",
IsObject );
]]></Listing>
leads to this:
<ManSection>
<Prop Arg="arg" Name="AProperty" Label="testlabel"/>
<Returns> <K>true</K> or <K>false</K>
</Returns>
<Description>
</Description>
</ManSection>
while
<Listing><![CDATA[
#!
DeclareProperty( "AProperty",
IsObject );
]]></Listing>
leads to this:
<ManSection>
<Prop Arg="arg" Name="AProperty" Label="for IsObject"/>
<Returns> <K>true</K> or <K>false</K>
</Returns>
<Description>
</Description>
</ManSection>
<Subsection Label="@ChapterInfo">
<Index Key="@ChapterInfo"><C>@ChapterInfo</C></Index>
<Heading><C>@ChapterInfo <A>chapter</A>, <A>section</A></C></Heading>
Adds the entry to the given chapter and section. Here,
<A>chapter</A> and <A>section</A> are the respective
titles.
</Subsection>
As an example, a full &AutoDoc; comment with all options could look like this:
<Listing><![CDATA[
#! @Description
#! Computes the list of lists of degrees of ordinary characters
#! associated to the $p$-blocks of the group $G$
#! with $p$-modular character table <A>modtbl</A>
#! and underlying ordinary character table `ordtbl`.
#! @Returns a list
#! @Arguments modtbl
#! @Group CharacterDegreesOfBlocks
#! @Label chardegblocks
#! @ChapterInfo Blocks, Attributes
DeclareAttribute( "CharacterDegreesOfBlocks",
IsBrauerTable );
]]></Listing>
There are also some commands which can be used in &AutoDoc; comments
that are not associated to any declaration. This is useful for additional
text in your documentation, examples, mathematical chapters, etc..
<Subsection Label="@Chapter">
<Index Key="@Chapter"><C>@Chapter</C></Index>
<Index Key="@ChapterLabel"><C>@ChapterLabel</C></Index>
<Index Key="@ChapterTitle"><C>@ChapterTitle</C></Index>
<Heading><C>@Chapter <A>name</A></C></Heading>
Sets the active chapter, all subsequent functions which do not have an explicit chapter
declared in their &AutoDoc; comment via <C>@ChapterInfo</C> will be added to this chapter.
Also all text comments, i.e. lines that begin with #! without a command, and which do not
follow after <C>@Description</C>, will be added to the chapter as regular text. Additionally,
the chapters label will be set to <C>Chapter_</C><A>name</A>.
Example:
<Listing><![CDATA[
#! @Chapter My chapter
#! This is my chapter.
#! I document my stuff in it.
]]></Listing>
The <C>@ChapterLabel</C> <A>label</A> command
can be used to set the label of the chapter to <C>Chapter_</C><A>label</A> instead of
<C>Chapter_</C><A>name</A>.
Additionally, the chapter will be stored as <C>_Chapter_</C><A>label</A><C>.xml</C>.
The <C>@ChapterTitle</C> <A>title</A> command
can be used to set a heading for the chapter that is different from <A>name</A>.
Note that the title does not affect the label.
If you use all three commands, i.e.,
<Listing><![CDATA[
#! @Chapter name
#! @ChapterLabel label
#! @ChapterTitle title
]]></Listing>
<C>title</C> is used for the headline, <C>label</C> for cross-referencing, and <C>name</C>
for setting the same chapter as active chapter again.
</Subsection>
<Subsection Label="@Section">
<Index Key="@Section"><C>@Section</C></Index>
<Index Key="@SectionLabel"><C>@SectionLabel</C></Index>
<Index Key="@SectionTitle"><C>@SectionTitle</C></Index>
<Heading><C>@Section <A>name</A></C></Heading>
Sets an active section like <C>@Chapter</C> sets an active chapter.
The section automatically ends with the next <C>@Section</C> or <C>@Chapter</C> command.
<Listing><![CDATA[
#! @Section My first manual section
#! In this section I am going to document my first method.
]]></Listing>
The <C>@SectionLabel</C> <A>label</A> command
can be used to set the label of the section to <C>Section_</C><A>label</A> instead of
<C>Chapter_chaptername_Section_</C><A>name</A>.
The <C>@SectionTitle</C> <A>title</A> command
can be used to set a heading for the section that is different from <A>name</A>.
</Subsection>
<Subsection Label="@Subsection">
<Index Key="@Subsection"><C>@Subsection</C></Index>
<Index Key="@SubsectionLabel"><C>@SubsectionLabel</C></Index>
<Index Key="@SubsectionTitle"><C>@SubsectionTitle</C></Index>
<Heading><C>@Subsection <A>name</A></C></Heading>
Sets an active subsection like <C>@Section</C> sets an active section.
The subsection automatically ends with the next <C>@Subsection</C>,
<C>@Section</C> or <C>@Chapter</C> command. It also ends with the
next documented function. Indeed, internally each function <Q>manpage</Q>
is treated like a subsection.
<Listing><![CDATA[
#! @Subsection My first manual subsection
#! In this subsection I am going to document my first example.
]]></Listing>
The <C>@SubsectionLabel</C> <A>label</A> command
can be used to set the label of the subsection to <C>Subsection_</C><A>label</A> instead of
<C>Chapter_chaptername_Section_sectionname_Subsection_</C><A>name</A>.
The <C>@SubsectionTitle</C> <A>title</A> command
can be used to set a heading for the subsection that is different from <A>name</A>.
</Subsection>
<Subsection Label="@BeginGroup">
<Index Key="@BeginGroup"><C>@BeginGroup</C></Index>
<Heading><C>@BeginGroup <A>[grpname]</A></C></Heading>
Starts a group. All following documented declarations without an
explicit <C>@Group</C> command are grouped together in the same group
with the given name. If no name is given, then a new nameless group is
generated.
The effect of this command is ended when an <C>@EndGroup</C> command
is reached.
<P/>
See section <Ref Sect="Groups"/> for more information about groups.
</Subsection>
<Subsection Label="@EndGroup">
<Index Key="@EndGroup"><C>@EndGroup</C></Index>
<Heading><C>@EndGroup</C></Heading>
Ends the current group.
<Subsection Label="@GroupTitle">
<Index Key="@GroupTitle"><C>@GroupTitle</C></Index>
<Heading>@GroupTitle <A>title</A></Heading>
Sets the subsection heading for the current group to <A>title</A>. In the
absence of any <C>@GroupTitle</C> command, the heading will be the name of the
first entry in the group. See <Ref Sect="Groups" /> for more information.
</Subsection>
<Subsection Label="@Level">
<Index Key="@Level"><C>@Level</C></Index>
<Heading><C>@Level <A>lvl</A></C></Heading>
Sets the current level of the documentation. All items created after this,
chapters, sections, and items, are given the level <A>lvl</A>,
until the <C>@ResetLevel</C> command resets the level to 0 or another level
is set.
<P/>
See section <Ref Sect="Level"/> for more information about levels.
</Subsection>
<Subsection Label="@ResetLevel">
<Index Key="@ResetLevel"><C>@ResetLevel</C></Index>
<Heading><C>@ResetLevel</C></Heading>
Resets the current level to 0.
<P/>
</Subsection>
<Subsection Label="@BeginExample">
<Index Key="@BeginExample"><C>@BeginExample</C></Index>
<Index Key="@EndExample"><C>@EndExample</C></Index>
<Heading><C>@BeginExample</C> and <C>@EndExample</C></Heading>
<C>@BeginExample</C> marks the start of an example to be put into the manual.
It differs from &GAPDoc;'s <Example> (see ),
in that it expects actual code (not in a comment) interspersed with comments,
to allow for examples files that can be both executed by &GAP;, and parsed
by &AutoDoc;. To achieve this, &GAP; commands are not preceded by a comment,
while output has to be preceded by an &AutoDoc; comment.
The <C>gap></C> prompt for the display in the manual is added by &AutoDoc;.
<C>@EndExample</C> ends the example block.
<P/>
To illustrate this command, consider this input:
<Listing><![CDATA[
#! @BeginExample
S5 := SymmetricGroup(5);
#! Sym( [ 1 .. 5 ] )
Order(S5);
#! 120
#! @EndExample
]]></Listing>
This results in the following output:
<Example>
gap> S5 := SymmetricGroup(5);
Sym( [ 1 .. 5 ] )
gap> Order(S5);
120
</Example>
The &AutoDoc; command <C>@Example</C> is an alias of <C>@BeginExample</C>.
</Subsection>
<Subsection Label="@BeginExampleSession">
<Index Key="@BeginExampleSession"><C>@BeginExampleSession</C></Index>
<Index Key="@EndExampleSession"><C>@EndExampleSession</C></Index>
<Heading><C>@BeginExampleSession</C> and <C>@EndExampleSession</C></Heading>
<C>@BeginExampleSession</C> marks the start of an example to be put into the manual,
while <C>@EndExampleSession</C> ends the example block.
It is the direct analog of &GAPDoc;'s <Example> (see ).
<P/>
To illustrate this command, consider this input:
<Listing><![CDATA[
#! @BeginExampleSession
#! gap> S5 := SymmetricGroup(5);
#! Sym( [ 1 .. 5 ] )
#! gap> Order(S5);
#! 120
#! @EndExampleSession
]]></Listing>
This results in the following output:
<Example>
gap> S5 := SymmetricGroup(5);
Sym( [ 1 .. 5 ] )
gap> Order(S5);
120
</Example>
It inserts an example into the manual just as <C>@Example</C> would do, but all lines are commented
and therefore not executed when the file is read.
All lines that should be part of the example displayed in the manual
have to start with an &AutoDoc; comment (<C>#!</C>).
The comment will be removed, and, if the following character is a space,
this space will also be removed. There is never more than one space removed.
To ensure examples are correctly colored in the manual,
there should be exactly one space between <C>#!</C> and the <C>gap></C> prompt.
The &AutoDoc; command <C>@ExampleSession</C> is an alias of <C>@BeginExampleSession</C>.
</Subsection>
<Subsection Label="@BeginLog">
<Index Key="@BeginLog"><C>@BeginLog</C></Index>
<Index Key="@EndLog"><C>@EndLog</C></Index>
<Heading><C>@BeginLog</C> and <C>@EndLog</C></Heading>
Works just like the <C>@BeginExample</C> command, but the example
will not be tested. See the &GAPDoc; manual for more information.
The &AutoDoc; command <C>@Log</C> is an alias of <C>@BeginLog</C>.
</Subsection>
<Subsection Label="@BeginLogSession">
<Index Key="@BeginLogSession"><C>@BeginLogSession</C></Index>
<Index Key="@EndLogSession"><C>@EndLogSession</C></Index>
<Heading><C>@BeginLogSession</C> and <C>@EndLogSession</C></Heading>
Works just like the <C>@BeginExampleSession</C> command, but the example
will not be tested if manual examples are run. It is the direct analog of
&GAPDoc;'s <Log> (see ).
The &AutoDoc; command <C>@LogSession</C> is an alias of <C>@BeginLogSession</C>.
</Subsection>
<Subsection Label="@DoNotReadRestOfFile">
<Index Key="@DoNotReadRestOfFile"><C>@DoNotReadRestOfFile</C></Index>
<Heading><C>@DoNotReadRestOfFile</C></Heading>
Prevents the rest of the file from being read by the parser. Useful for
unfinished or temporary files.
<Listing><![CDATA[
#! This will appear in the manual
#! @DoNotReadRestOfFile
#! This will not appear in the manual.
]]></Listing>
</Subsection>
<Subsection Label="@BeginChunk">
<Index Key="@BeginChunk"><C>@BeginChunk <A>name</A></C></Index>
<Index Key="@EndChunk"><C>@EndChunk</C></Index>
<Index Key="@EndChunk"><C>@InsertChunk <A>name</A></C></Index>
<Heading><C>@BeginChunk <A>name</A></C>, <C>@EndChunk</C>, and <C>@InsertChunk <A>name</A></C></Heading>
Text inside a <C>@BeginChunk</C> / <C>@EndChunk</C> part will not be inserted into
the final documentation directly. Instead, the text is stored in an internal buffer.
That chunk of text can then later on be inserted in any other place by using the
<C>@InsertChunk <A>name</A></C> command.
If you do not provide an <C>@EndChunk</C>, the chunk ends at the end of the file.
<Listing><![CDATA[
#! @BeginChunk MyChunk
#! Hello, world.
#! @EndChunk
#! @InsertChunk MyChunk
## The text "Hello, world." is inserted right before this.
]]></Listing>
You can use this to define an example like this in one file:
<Subsection Label="@BeginCode">
<Index Key="@BeginCode"><C>@BeginCode <A>name</A></C></Index>
<Index Key="@EndCode"><C>@EndCode</C></Index>
<Index Key="@InsertCode"><C>@InsertCode <A>name</A></C></Index>
<Heading><C>@BeginCode <A>name</A></C>, @EndCode, and <C>@InsertCode <A>name</A></C></Heading>
Inserts the text between <C>@BeginCode</C> and <C>@EndCode</C> verbatim at the point where
<C>@InsertCode</C> is called. This is useful to insert code excerpts
directly into the manual.
<Listing><![CDATA[
#! @BeginCode Increment
i := i + 1;
#! @EndCode
#! @InsertCode Increment
## Code is inserted here.
]]></Listing>
</Subsection>
<Subsection Label="@LatexOnly">
<Index Key="@LatexOnly"><C>@LatexOnly <A>text</A></C></Index>
<Index Key="@BeginLatexOnly"><C>@BeginLatexOnly</C></Index>
<Index Key="@EndLatexOnly"><C>@EndLatexOnly</C></Index>
<Heading><C>@LatexOnly <A>text</A></C>, <C>@BeginLatexOnly</C>, and <C>@EndLatexOnly</C></Heading>
Code inserted between <C>@BeginLatexOnly</C> and <C>@EndLatexOnly</C> or after <C>@LatexOnly</C> is only inserted
in the PDF version of the manual or worksheet. It can hold arbitrary &LaTeX;-commands.
<Listing><![CDATA[
#! @BeginLatexOnly
#! \include{picture.tex}
#! @EndLatexOnly
<Subsection Label="@NotLatex">
<Index Key="@NotLatex"><C>@NotLatex <A>text</A></C></Index>
<Index Key="@BeginNotLatex"><C>@BeginNotLatex</C></Index>
<Index Key="@EndNotLatex"><C>@EndNotLatex</C></Index>
<Heading><C>@NotLatex <A>text</A></C>, <C>@BeginNotLatex</C>, and <C>@EndNotLatex</C></Heading>
Code inserted between <C>@BeginNotLatex</C> and <C>@EndNotLatex</C> or after <C>@NotLatex</C> is inserted
in the HTML and text versions of the manual or worksheet, but not in the PDF version.
<Listing><![CDATA[
#! @BeginNotLatex
#! For further information see the PDF version of this manual.
#! @EndNotLatex
#! @NotLatex For further information see the PDF version of this manual.
]]></Listing>
</Subsection>
The following commands can be used to add the corresponding parts to the title page of
the document which generated by &AutoDoc; if scaffolding is enabled.
<List>
<Item>
<C>@Title</C>
</Item>
<Item>
<C>@Subtitle</C>
</Item>
<Item>
<C>@Version</C>
</Item>
<Item>
<C>@TitleComment</C>
</Item>
<Item>
<C>@Author</C>
</Item>
<Item>
<C>@Date</C>
</Item>
<Item>
<C>@Address</C>
</Item>
<Item>
<C>@Abstract</C>
</Item>
<Item>
<C>@Copyright</C>
</Item>
<Item>
<C>@Acknowledgements</C>
</Item>
<Item>
<C>@Colophon</C>
</Item>
</List>
Those add the following lines at the corresponding point of the title page. Please note that many of those
things can be (better) extracted from the <F>PackageInfo.g</F>. In case you set some of those,
the extracted or in scaffold defined items will be overwritten. While this is not very useful for
documenting packages, they are necessary for worksheets created with <Ref Func="AutoDocWorksheet"/>,
since worksheets do not have a <F>PackageInfo.g</F> file from which this information could be extracted.
</Section>
<Section Label="PlainText">
<Heading>Plain text files</Heading>
Files that have the suffix <C>.autodoc</C> and are listed in the
<C>autodoc.files</C> option of <Ref Func="AutoDoc"/>, resp. are contained in
one of the directories listed in <C>autodoc.scan_dirs</C>, are treated as
&AutoDoc; plain text files. These work exactly like &AutoDoc; comments, except
that lines do not need to (and in fact, should not) start with <C>#!</C>.
</Section>
In &GAPDoc;, it is possible to make groups of manual items, i.e., when documenting
a function, operation, etc., it is possible to group them into suitable chunks.
This can be particularly useful if there are several definitions of an operation
with several different argument types, all doing more or less the same to the arguments.
Then their manual items can be grouped, sharing the same description and return type information.
You can give a heading to the group in the manual with the <C>@GroupTitle</C>
command; if that is not supplied, then the heading of the first manual item
in the group will be used as the heading.
<P/>
Note that group names are globally unique throughout the whole manual.
That is, groups with the same name are in fact merged into a single group, even if they
were declared in different source files.
Thus you can have multiple <C>@BeginGroup</C> / <C>@EndGroup</C> pairs using the
same group name, in different places, and these all will refer to the same group.
<P/>
Moreover, this means that you can add items to a group via the <C>@Group</C> command
in the &AutoDoc; comment of an arbitrary declaration, at any time.
<P/>
The following code
<Listing><![CDATA[
#! @BeginGroup Group1
#! @GroupTitle A family of operations
<ManSection Label="Group1">
<Heading>A family of operations</Heading>
<Oper Arg="arg" Name="FirstOperation" Label="for IsInt"/>
<Oper Arg="arg1,arg2" Name="SecondOperation" Label="for IsInt, IsGroup"/>
<Oper Arg="arg1,arg2" Name="ThirdOperation" Label="for IsGroup, IsInt"/>
<Description>
First sentence.
Second sentence.
Third sentence.
</Description>
</ManSection>
</Section>
<Section Label="Level">
<Heading>Level</Heading>
Levels can be set to not write certain parts in the manual by default.
Every entry has by default the level 0. The command <C>@Level</C> can
be used to set the level of the following part to a higher level, for
example 1, and prevent it from being printed to the manual by default.
However, if one sets the level to a higher value in the autodoc option of
&AutoDoc;, the parts will be included in the manual at the specific place.
<Listing><![CDATA[
#! This text will be printed to the manual.
#! @Level 1
#! This text will be printed to the manual if created with level 1 or higher.
#! @Level 2
#! This text will be printed to the manual if created with level 2 or higher.
#! @ResetLevel
#! This text will be printed to the manual.
]]></Listing>
</Section>
<Section Label="MarkdownExtension">
<Heading>Markdown-like formatting of text in &AutoDoc;</Heading>
&AutoDoc; has some convenient ways to insert special format into text, like
math formulas and lists. The syntax for them are inspired by Markdown and &LaTeX;,
but do not follow them strictly. Neither are all features of the Markdown language
supported. The following subsections describe what is possible.
One can create lists of items by beginning a new line with *, +, -, followed by one
space. The first item starts the list. When items are longer than one line, the following lines
have to be indented by at least two spaces. The list ends when a line which does not start a new
item is not indented by two spaces. Of course lists can be nested. Here is an example:
<Listing><![CDATA[
#! The list starts in the next line
#! * item 1
#! * item 2
#! which is a bit longer
#! * and also contains a nested list
#! * with two items
#! * item 3 of the outer list
#! This does not belong to the list anymore.
]]></Listing>
This is the output:<Br/>
The list starts in the next line
<List>
<Item>
item 1
</Item>
<Item>
item 2
which is a bit longer
<List>
<Item>
and also contains a nested list
</Item>
<Item>
with two items
</Item>
</List>
</Item>
<Item>
item 3 of the outer list
</Item>
</List>
This does not belong to the list anymore.<Br/>
The *, -, and + are fully interchangeable and can even be used mixed, but this is not recommended.
One can start an inline formula with a $, and also end it with $, just like in &LaTeX;. This will translate into
&GAPDoc;s inline math environment. For display mode one can use $$, also like &LaTeX;.
<Listing><![CDATA[
#! This is an inline formula: $1+1 = 2$.
#! This is a display formula:
#! $$ \sum_{i=1}^n i. $$
]]></Listing>
produces the following output:<Br/>
This is an inline formula: <Math>1+1 = 2</Math>.
This is a display formula:
<Display> \sum_{i=1}^n i. </Display>
One can emphasize text by using two asterisks (**) or two underscores (__) at the
beginning and the end of the text which should be emphasized. Example:
<Listing><![CDATA[
#! **This** is very important.
#! This is __also important__.
#! **Naturally, more than one line
#! can be important.**
]]></Listing>
This produces the following output:<Br/>
<E>This</E> is very important.
This is <E>also important</E>.
<E>Naturally, more than one line
can be important.</E>
The following commands used to be supported, but are not anymore.
<List>
<Mark><C>@EndSection</C></Mark>
<Item>You can simply remove any use of this, &AutoDoc; ends sections automatically
at the start of any new section or chapter.</Item>
<Mark><C>@EndSubsection</C></Mark>
<Item>You can simply remove any use of this, &AutoDoc; ends subsections automatically
at the start of any new subsection, section or chapter.</Item>
<Mark><C>@BeginAutoDoc</C> and <C>@EndAutoDoc</C></Mark>
<Item>It suffices to prepend each declaration that is meant to be appear in the
manual with a minimal &AutoDoc; comment <C>#!</C>.</Item>
<Mark><C>@BeginSystem <A>name</A></C>, <C>@EndSystem</C>, and <C>@InsertSystem <A>name</A></C></Mark>
<Item>Please use the chunk commands from subsection <Ref Subsect="@BeginChunk"/> instead.</Item>
<Mark><C>@AutoDocPlainText</C> and <C>@EndAutoDocPlainText</C></Mark>
<Item>Use <C>.autodoc</C> files or &AutoDoc; comments instead.</Item>
</List>
</Section>
</Chapter>
¤ Dauer der Verarbeitung: 0.29 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.