next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
SimpleDoc > doc

doc -- a simple documentation function



The string s contains text describing the documentation to be produced.

Lines beginning with white space followed by two hyphens are ignored.

The text is divided into sections, each of which begins with a keyword alone on a line; the keywords must all be indented to the same level, and everything else must be further indented.

The valid keywords are: Key, Headline, Usage, Inputs, Outputs, Consequences, Description, SeeAlso, Subnodes, Caveat, and ExampleFiles.

The only keyword which is always required is Key.

Each line in the Key section is evaluated as a Macaulay2 expression to yield a documentation key. The various types of documentation keys are described in document(..., Key => ...). (If a string is desired as a key, it must be surrounded by quotation marks.)

The body of the Headline section should have a single line, which will be interpreted as a string. The lines of the Usage section may be used to present alternative usages, and they will be collected into a single string.

The text in an Inputs or Outputs section is divided into subsections, each of which corresponds to one input or output value. The first line of each subsection contains the name of the variable corresponding to it, as referred to in the usage line, a colon, and the type of the variable. The name of the variable must be a nonempty string of alphanumeric characters or quotation marks. For example, the first line might be s2:String. The variable name and type are both optional. (For optional inputs, one puts the name of the option, a double arrow, and the expected type of value; for example, the first line might be Precision => ZZ.) Subsequent lines of the subsection, indented further, describe the variable and may include markup.

Markup allowed includes many TeX commands, as allowed in TEX; for details and examples see html(TEX), allowing various mathematical expressions, such as 3 or xi33 + 1/2, to be displayed in the html form of the documentation. Also allowed is a pair of @ characters, enclosing Macaulay2 code to be executed, yielding appropriate hypertext. For example, @TO Key@ will insert a link to another node of the documentation.

Each subsection of the Consequences section should start with the keyword Item; the text in each subsection can be marked up as described above.

The text in the Description section occurs in subsections labeled with the keywords Text, Example, CannedExample, Pre, and Code. The text in a Text subsection can be separated into paragraphs with blank lines. (A paragraph, when rendered in HTML, will normally be enclosed in an HTML P tag, except if its top level markup is an instance of HypertextContainer or HypertextParagraph.)

The text in an Example subsection consists of lines of Macaulay2 code to be used as examples in the documentation node; within in each complete expression, indent lines after the first one more than the first; output will be generated automatically and incorporated into the display. The text in a CannedExample subsection consists of lines containing an interaction with Macaulay2, to displayed as an example. The text in a Pre section, with common indentation removed, is wrapped with PRE. The text in a Code section, with common indentation removed, is wrapped with parentheses and evaluated; the result is spliced into the list of documentation items at the appropriate point before passing the list to document.

Each line in the ExampleFiles section should be the name of a file in the auxiliary files directory of the package; the name of that directory is the same as the name of the package. Copies of the corresponding files will be made visible in the current directory while the example code is running.

The lines in the Subnodes section not beginning with a colon are keys giving links to the subnodes of the current documentation node. The purpose is to allow the documentation of the package to be arranged linearly, as in a book. The lines in the Subnodes section beginning with a colon are subheadings used to classify the subnodes.

See also

Ways to use doc :