Websites Navigation: Airbit | Shop | m-shell.net
Languages: EN | DE

Class mdoc.DocGenerator

A documentation generator from m source files. It collects declarations and their comments from m source files and writes them, and writes HTML sources representing the modules and class hierarchy.

Constructor

function init()
Constructor. This assigns defaults to configurable attributes.

Fields

footer The text to write at the end of each generated file. Each {TITLE} in it will be replaced by the document title, each {DATE} by the current date, each {FILE} by the source file.
header The text to write at the beginning of each generated file. Each {TITLE} in it will be replaced by the document title, each {DATE} by the current date, each {FILE} by the source file.
inheritedPrefix The text prefix for a comment inherited from an overriden function.
libpath The module search path (list of pathes ending in backslashes). Initialized from the m properties.
outCount The number of files created.
sources The list of sources. Modules are indexed by their name.
stateListener The function reference called with a text describing the current state. May be null.

Functions

addSource(file) Parse a source file to update the internal representation.
document(file, dir=...) Run the complete documentation cycle for a single file.
getFirstError() Get the first error occured during source addition or output writing.
reset() Reset the internal representation of the sources read in.
resolveLink(body:mdoc.Body, s) Resolve a link having one of the following forms:
resolveOverrides() Set the overridden class, and get the comments of the overridden functions if required.
write(dir) Write the documentation as HTML.
function reset()
Reset the internal representation of the sources read in.
function addSource(file)
Parse a source file to update the internal representation.
Parameters:
file – the m source file to add.
Returns:true if the source file was found and added.
function resolveOverrides()
Set the overridden class, and get the comments of the overridden functions if required.
function resolveLink(body:mdoc.Body, s)
Resolve a link having one of the following forms:
  • module
  • module.class
  • module.variable
  • module.class.variable
  • module.class.function[()]
  • class (within its module)
  • class.variable (within its module)
  • class.function[()] (within its module)
  • variable (within its module or class)
  • function[()] (within its module or class)
The optional function parentheses may serve to distinguish between functions and variables of the same name in case of ambiguities.
Parameters:
body – the body defining the context (module or class)
s – the link source text, in the format above.
Returns:the HTML link text, or null if there is no such item.
function write(dir)
Write the documentation as HTML.
Parameters:
dir – the directory to write to.
function getFirstError()
Get the first error occured during source addition or output writing.
Returns:null if no error occured, [file, pos, msg] otherwise.
function document(file, dir=cd())
Run the complete documentation cycle for a single file.
Parameters:
file – the source file to scan.
dir – the directory to write the documentation to.
Returns:null if no error occured, [file, pos, msg] otherwise.
mShell Home  > Documentation  > mdoc