Atdoc generates documentation for Common Lisp packages. It extracts documention strings written using a custom markup language and generates HTML pages, TeX documents, and Info files.
atdoc was written by David Lichteblau and is available under an X11-style license.
Output formats
Atdoc can currently generate documentation in these formats:
- HTML, one page for each definition, with extra pages containing the package and overview text for its definitions (example)
- HTML, all on one page (example)
Download and Installation
Download an atdoc tarball, or get it from git: http://www.lichteblau.com/git/atdoc.git (gitweb)
atdoc needs Closure XML, Split sequence, Slime's swank, Xuriella XSLT, Closer-MOP, and their dependencies.
ASDF is used for compilation. Register the .asd file, e.g. by symlinking it, then compile atdoc using asdf:operate.
$ ln -sf `pwd`/atdoc.asd /path/to/your/registry/ * (asdf:operate 'asdf:load-op :atdoc)
Usage
Please refer to the API documentation for details, or see below for an example.
Sample Documentation
As an example, I have chosen code from the book Lisp (3rd edition) by Winston and Horn. You can find the code with an ASDF definition in the example/ subdirectory of the atdoc sources so that you can easily compile it yourself. The code included is the Blocks World, from chapters 21 ("The Blocks World with Classes and Methods") and 22 ("Answering Questions about Goals"). Note that the source code from the book has been taken from the publically available lisp3 tarball and is covered by its own license, different from the license of atdoc.
The examples linked above were generated using:
(atdoc:generate-html-documentation '(:blocks-world :blocks-world-goals) output-directory :index-title "Blocks World API reference" :heading "The Blocks World" :single-page-p t ;optional :include-internal-symbols-p nil)
and
(atdoc:generate-latex-documentation '(:blocks-world :blocks-world-goals) output-directory :title "The Blocks World")
(atdoc:generate-info-documentation '(:blocks-world :blocks-world-goals) output-directory :name "blocks-world" :title "The Blocks World")
Writing a documentation string
Here is an example of what the documentation of print-object could look like using atdoc:
@arg[object]{an object} @arg[stream]{a @class{stream}} @return{@code{object}} @short{The generic function @fun{print-object} writes the printed representation of @code{object} to @code{stream}.} The function print-object is called by the Lisp printer; it should not be called by the user. (...) @see{pprint-fill} @see{pprint-logical-block} (...)
Note that parts of the documentation strings are just documentation text, which is will be included in a section "Details" of the page. Other parts, however, are not part of the actual text, and will be extracted from the documentation string as the first step of processing it. In this case, @arg, @return, and @see are the tags that will be removed. All @arg tags will be collected into a section about the function's arguments, all @see tags will be collected together will all @fun and @class references into a "See also" section.
Tags for use only in the docstring of a package itself:
- @section[title]: Generates a sub-heading called title. A table of contents will be generated at the top of the package pages listing the sections.
- @aboutfun{name}: Insert the lambda list of function name and its short description (the contents of @short in its docstring).
- @aboutclass{name}: Insert the name of class name and its short description (the contents of @short in its docstring).
Tags that will be extracted into their own sections:
- @arg[name]{description}: Will be moved into the "Arguments" section.
- @return{description}: Will be moved into the "Return Value" section.
- @see{name}: Link to the function named name. Syntactically like @fun, this tag will be moved into the "See also" section.
- @see-slot{name}: Similar to @see, this tag specifies a slot reader function for the class it is used in, and will be moved into a "Slot Access Functions" sections. In addition, a section "Inherited Slot Access Functions" will be shown for subclasses.
- @see-constructor{name}: Similar to @see, this tag specifies a function creating instances of current class, and will be moved into a "Returned By" section.
Tags for use in the documentation text:
- @short{text}: Copies text into the output normally, but will also extract it for use with @aboutfun and @aboutclass.
- @code: In-line lisp code, will be formatted using a fixed-width font.
- @a[href]: Hyperlink. This tag accepts an argument, the URL to be used as the href attribute.
- @itemize, @item: Like <ul> and <li>;
- @fun{name}: Link to the function named name, read as a symbol into the current package (qualify with a package name to reference other packages included in the same documentation).
- @class{name}: Link to the class named name. Works like @fun.
- @variable{name}: Link to the special variable named name. Works like @fun.
Tags that are passed through to HTML:
- @pre: Preformatted section, e.g. for source code listings.
- @b: Bold font.
- @em: Italic font.
The Atsign syntax
Atdoc looks for markup tags start with an at-sign, in either a long or a short form.
The short form looks like this:
@return{the computed result}
The long form can be convenient for multiple lines of text:
@begin{return} the computed result @end{return}
Except for the additional whitespace due to line breaks in the second example, the two forms are completely interchangeable. Behind the scenes, both produce an XML element with tag name result, <result>the computed result</result>
Both forms take an optional argument, written with brackets:
@a[http://www.cliki.net]{Cliki}(gets translated into <a a="http://www.cliki.net">Cliki</a>, until the XSLT stylesheets rename a into href)
@begin[Title]{section} body @end{section}(gets translated into <section section="Title">body</section>)
The atsign also escapes special characters:
closing braces need to be escaped: {n,m@}
Multiple line breaks delimit paragraphs:
First paragraph. Second paragraph.
Recent changes
2008-11-30
- Added a mode for single-page HTML output, combining several packages into one document.
- Added a mode for LaTeX output, using pdflatex to generate printable documentation.
- Added a mode for .info output.
- Uses Xuriella XSLT instead of xsltproc.
2007-05-13
- Initial public release.