File 'lib/genericFormatter.cls' (part of 'AutoDOC')

Description (short)
Base class of all formatters
Written by
Andreas Kupries
Description
The base class of all formatters
Keywords
Output formatter, formatting output, interface to formatter

Class 'genericFormatter'

Description
This class defines the interface used by the autodoc engine to produce the documentation from data embedded into tcl code.
Superclasses
distInterface
Options
css
outputdir
replyaddr
adlocation
ip
Methods
public
MakeError (category output error)
ampersand ()
blockClass (script)
caption (args)
chapter (title)
clear ()
closePage ()
commaList (textList)
crError (outputText errorText)
definitionList (script)
defterm (term text)
defterm2 (term)
emph (text)
enumerate (script)
example (term text)
exampleRow (term text)
formattedRow (term text)
formattedRowVar (term var)
formattedTerm (term text)
formattedTermVar (term var)
getAnchor (name)
getClass ()
getString (script)
hrule ()
imgDef (code text geometry imgfile)
imgRef (code)
item (text)
itemize (script)
link (text url)
linkCommaList (objList)
linkDef (code text url)
linkList (objList)
linkMail (prefix nameVar addrVar)
linkRef (code)
mailToDefterm (prefix nameVar addrVar)
markAppendClass (class text)
markError (text)
markVisibility (text)
markWithClass (class text)
missingDescError (errorText)
newPage (file title firstheading)
pageFile (pageName)
par (args)
parbreak ()
popClass ()
popClassAll ()
preformatted (text)
prepareForOutput ()
pushAppendClass (name)
pushClass (name)
quote (string)
sample (text)
section (title)
setAnchor (name)
sortByName (objList)
sortedObjectList (objlist)
strong (text)
table (args)
table_data (args)
table_head (args)
table_row (args)
termVar (term var)
termclasses (tc dc)
unset_termclasses ()
write (text)
Membervariables
public
extension
currentPage
termclass
defclass
cstack

Options

-css
Boolean option to control support for cascading style sheets (CSS). Support is enabled by default.
default value: 1
-outputdir
Path to the directory to store the generated files into.
-replyaddr
Address of person to reply to in case of problems with the documented distribution.
-adlocation
Location of the Autodoc documentation. Required for generation of backreferences for any generated page.
-ip
Requests the formatter to use the specified interpreter for script evaluation instead of uplevel. Only if not empty.

Methods

MakeError (category output error)

Internal method to generate a problem report. The report is added to the object currently writing its documentation linking it to the place of the problem.
Argument: category Category of the problem, either desc or crossref
Argument: output The text to print at the place of the problem.
Argument: error The text to use in the problem report to describe it.
Returns: a string containing the output formatted as problem and having an anchor the report can link to.

ampersand ()

Writes an ampersand (&) into the current page.

blockClass (script)

Encloses a block of output with a marker for an output class.
Argument: script Script to execute to create the output to enclose in the markers.

caption (args)

Executes the specified script (last argument) in the calling context, captures the produced formatted text and organizes it into a table caption. The arguments before the script are interpreted as 'name=value'-style parameterization.
Argument: args A list of 'name=value' parameters and a script to evaluate in the calling context (last element).

chapter (title)

Adds a chapter title to the current page.
Argument: title The text of the title.

clear ()

Clear internal state, prepare for new scan.

closePage ()

Completes the generation of the current page

commaList (textList)

Takes the specified list of strings and converts it into a comma separated list.
Argument: textList List of strings.
Returns: a string separating the incoming texts by commas.

crError (outputText errorText)

Generates a crossreference problem at the place of its calling. Uses MakeError as workhorse.
Argument: outputText The text to print at the place of the problem.
Argument: errorText The text to use in the problem report to describe it.

definitionList (script)

Executes the specified script in the calling context and captures any generated output in a string, which is then formatted as definition list.
Argument: script The tcl code to execute in the calling context.

defterm (term text)

Generates an item in a definition list.
Argument: term The name of the thing to explain.
Argument: text The text explaining the term.

defterm2 (term)

Generates an item in a definition list.
Argument: term The name of the thing to explain. But without explanation.

emph (text)

Adds the appropriate formatting to the given text to make it emphasized, then returns the result.
Argument: text The string to mark as sample.
Returns: The emphasized text.

enumerate (script)

Executes the specified script in the calling context and captures any generated output in a string, which is then formatted as enumerated list.
Argument: script The tcl code to execute in the calling context.

example (term text)

Render an example text as part of a definition list. The formatting of the text is preserved.
Argument: term The name of the thing to explain.
Argument: text The text used to explain the term.

exampleRow (term text)

Render an example text as part of a 2-column table The formatting of the text is preserved.
Argument: term The name of the thing to explain.
Argument: text The text used to explain the term.

formattedRow (term text)

See formattedTerm, but writes out a table row, not a term of a definition list.
Argument: term The name of the thing to explain.
Argument: text The text explaining the term.

formattedRowVar (term var)

Same as formattedRow, but the explanation is specified as name of a variable. An empty explanation causes the system to ignore the call. Crossreferences are resolved too.
Argument: term The name of the thing to explain.
Argument: var The name of the variable containing the epxlanatory text.

formattedTerm (term text)

Like defterm, but crossreferences in text are resolved.
Argument: term The name of the thing to explain.
Argument: text The text explaining the term.

formattedTermVar (term var)

Same as formattedTerm, but the explanation is specified as name of a variable. An empty explanation causes the system to ignore the call.
Argument: term The name of the thing to explain.
Argument: var The name of the variable containing the epxlanatory text.

getAnchor (name)

Generates a named anchor and returns the HTML to the caller.
Argument: name The name of the generated anchor.
Returns: the HTML string defining the named anchor.

getClass ()

Returns: Returns the currently active output class.

getString (script)

Executes the specified script in the calling context and captures any generated output in a string, which is then returned as the result of the call.
Argument: script The tcl code to execute in the calling context.
Returns: a string containing all output produced by the script

hrule ()

Writes a horizontal rule into the current page.

imgDef (code text geometry imgfile)

Stores an hyperlink to an image under code, allowing later retrieval via imgRef.
Argument: code The identifier for storage and retrieval of the image link.
Argument: text Alternative text describing the contents of the picture.
Argument: geometry A list containing the width and height of the image, in this order. Can be empty. Used to insert geometry information into the link, for better display even if the image is not loaded.
Argument: imgfile The location to point at, i.e. the image file.

imgRef (code)

Argument: code The identifier for storage and retrieval of the image link.
Returns: the image link generated by imgDef and then stored under code.

item (text)

Generates an item in an itemized list.
Argument: text The paragraph to format as item in the list.

itemize (script)

Executes the specified script in the calling context and captures any generated output in a string, which is then formatted as itemized list.
Argument: script The tcl code to execute in the calling context.

link (text url)

Combines its arguments into a hyperlink having the text and pointing to the location specified via url
Argument: text The string to use as textual part of the hyperlink.
Argument: url The location to point at.
Returns: the formatted hyperlink.

linkCommaList (objList)

Takes the specified list of objects and converts it into a comma separated list of hyperlinks to the pages describing them.
Argument: objList List of object handles. The objects in it have to understand the link method.
Returns: a string containing several hyperlinks.

linkDef (code text url)

The same as in link, but the result is stored internally instead, using code as reference.
Argument: code The identifier for storage and retrieval of the hyperlink.
Argument: text The string to use as textual part of the hyperlink.
Argument: url The location to point at.

linkList (objList)

Takes the specified list of objects and converts it into a list of hyperlinks to the pages describing them. The hyperlinks are separated by line-breaks.
Argument: objList List of object handles. The objects in it have to understand the link method.
Returns: a string containing several hyperlinks.

linkMail (prefix nameVar addrVar)

Generates hyperlink for name (in attr)
Argument: prefix String to write before the actual hyperlink
Argument: nameVar Name of the variable containing the name to write.
Argument: addrVar Name of the variable containing the address.
Returns: A string containing a hyperlink to the given mail address.

linkRef (code)

Argument: code The identifier for storage and retrieval of the hyperlink.
Returns: the hyperlink generated by linkDef and then stored under code.

mailToDefterm (prefix nameVar addrVar)

Writes hyperlink for a person and its mail address.
Argument: prefix String to write before the actual hyperlink
Argument: nameVar Name of the variable containing the name to write.
Argument: addrVar Name of the variable containing the address.

markAppendClass (class text)

Uses the specified output class refinement to mark the given text and returns the marked text.
Argument: class The refinement to add to the current class to get the marker.
Argument: text The text to mark with an output class.
Returns: the marked text.

markError (text)

Formats the incoming text as error and returns the modified information.
Argument: text The text to reformat.
Returns: a string containing the given text formatted as error.

markVisibility (text)

Formats the incoming text for display as visibility/usage add-on to a variable or method description.
Argument: text The text to reformat.
Returns: a string containing the reformatted text.

markWithClass (class text)

Uses the specified output class to mark the given text and returns the marked text.
Argument: class The class to use as marker.
Argument: text The text to mark with an output class.
Returns: Default implementation, returns the text unchanged.

missingDescError (errorText)

Generates a documention missing problem at the place of its calling. Uses MakeError as workhorse.
Argument: errorText The text to use in the problem report to describe it.

newPage (file title firstheading)

Start a new page, implicitly completes the current page.
Argument: file name of file to contain the generated page
Argument: title string to be used as title of the page
Argument: firstheading (= {}) string to use in toplevel heading. Defaults to title. Required to allow hyperlinks in toplevel headings without violating HTML syntax in the title.

pageFile (pageName)

Converts the name of page into the name of the file containing it.
Argument: pageName Guess what :-)
Returns: the name of the file containing the specified page.

par (args)

Writes a paragraph into the current page, uses all arguments as one string.
Argument: args The text to format and write as paragraph. Actually a list of arguments put together into one string

parbreak ()

Writes a paragraph break into the current page.

popClass ()

Removes the output class at the top of the stack from the stack. Is a no-op for an empty stack.

popClassAll ()

Clears the stack of all output classes.

preformatted (text)

Adds the appropriate formatting to the given text to preserve its exact structure, then returns the result.
Argument: text The string to mark as preformatted text.
Returns: The emphasized text.

prepareForOutput ()

Called just before the generation of output starts. Checks for the existence of a target directory and creates it, if necessary.

pushAppendClass (name)

Like pushClass, but not quite. Takes the top element of the stack and pushes a class whose name is the concatenation of the name of the top element and of the argument name. This allows code to push specializations of the current output class without much effort.
Argument: name The name of the specialization to activate.

pushClass (name)

Activates the output class name, i.e. pushes it onto the stack.
Argument: name The name of the output class to activate.

quote (string)

Takes the specified string, add protective signs to all character (sequences) having special meaning for the formatter and returns the so enhanced text.
Argument: string The string to protect against interpretation by the formatter.
Returns: a string containing no unprotected special character (sequences).

sample (text)

Adds the appropriate formatting to the given text to emphasize it as sample program output, then returns the result.
Argument: text The string to mark as sample.
Returns: The emphasized text.

section (title)

Adds a section title to the current page.
Argument: title The text of the title.

setAnchor (name)

Generates a named anchor at the current location in the current page.
Argument: name The name of the generated anchor.

sortByName (objList)

Sorts the specified list of objects alphabetically in ascending order by the name of the objects.
Argument: objList List of object handles. The objects in it have to understand the name method.
Returns: the sorted list.

sortedObjectList (objlist)

Takes the specified list of objects, sorts them by name, then generates a definition list containing hyperlinks to the object pages as terms and their short descriptions as explanation.
Argument: objlist List of object handles. The objects in it have to understand the methods link and short.

strong (text)

Adds the appropriate formatting to the given text to emphasize it as strong, then returns the result.
Argument: text The string to mark as strong.
Returns: The emphasized text.

table (args)

Executes the specified script (last argument) in the calling context, captures the produced formatted text and organizes it into a table. The arguments before the scripts are interpreted as 'name=value'-style parameterization.
Argument: args A list of 'name=value' parameters and a script to evaluate in the calling context (last element).

table_data (args)

Executes the specified script (last argument) in the calling context, captures the produced formatted text and organizes it into a table cell. The arguments before the script are interpreted as 'name=value'-style parameterization.
Argument: args A list of 'name=value' parameters and a script to evaluate in the calling context (last element).

table_head (args)

Executes the specified script (last argument) in the calling context, captures the produced formatted text and organizes it into a table cell formatted as heading. The arguments before the script are interpreted as 'name=value'-style parameterization.
Argument: args A list of 'name=value' parameters and a script to evaluate in the calling context (last element).

table_row (args)

Executes the specified script (last argument) in the calling context, captures the produced formatted text and organizes it into a table row. The arguments before the script are interpreted as 'name=value'-style parameterization.
Argument: args A list of 'name=value' parameters and a script to evaluate in the calling context (last element).

termVar (term var)

Same as formattedTerm, but the explanation is specified as name of a variable. An empty explanation causes the system to ignore the call. There is no crossreference resolution.
Argument: term The name of the thing to explain.
Argument: var The name of the variable containing the epxlanatory text.

termclasses (tc dc)

Sets termclass and defclass.
Argument: tc Value for termclass.
Argument: dc Value for defclass.

unset_termclasses ()

Unsets termclass and defclass.

write (text)

Has to write the specified text into the current page.
Argument: text The string to place into the current page.


Membervariables

extension
The extension to add to a page name to convert it into the name of the associated file (if there is any). Has to contain the separating dot or whatever is used on the particular platform to separate file names adn their extensions.
initial value: .
currentPage
A token allowing the high level formatting routines to use the current page as target of hyperlinks.
termclass
Output class to use for a term.
defclass
Output class to use for a term definition
cstack
Stack of currently active output classes. Only the top of the stack is used in the current output. The TOS is at the first position of the list.

Generated by AutoDoc 2.4 at 09/28/2001, invoked by Andreas Kupries,,,