|
ActiveTcl User Guide
|
|
|
formatter(n) 1.0 doctools "Documentation tools"
NAME
formatter - Interface specification for formatter code
DESCRIPTION
This manpage specifies the interface between the manpage
processor mpexpand and the tcl code implementing
the conversion into a particular output format.
The tcl code has to provide
- Implementations of all commands specified in
format(n), using the defined names
- and additionally implementations for
- NumPasses
- This command is called after the formatter is setup and has to
return the number of passes required by this formatter to process a
manpage. This information has to be an integer number greater or
equal to one.
- PassSetup
- This command is called at the beginning of each pass over the
input. It can assume that the current number of the pass is already
set to the correct value and is responsible for setting up the
internal state of the formatter for this pass.
- PostProcess text
- This command is called after last pass, with the expansion
result of that pass, and can do any last-ditch modifications of the
generated result. Its result is the final text written to the
output.
Most formats will use identity here.
- HandleText text
- This command is called for any plain text encountered by the
processor in the input and can do any special processing required
for plain text. Its result is the string written into the
expansion.
Most formats will use identity here.
The tcl code implementing all of the above can make the
following assumptions:
- It has full access to its own non-safe interpreter. In other
words, the formatter cannot damage the other parts of the
processor, but it can do damage to the filesystem. It is trusted in
that way.
- The surrounding system provides the formatter code with the
following commands:
- mp_pass
- This command returns the number of the current pass.
- mp_file
- This command returns the full name of the file currently
processed, or stdin, if the input is read from
there.
- mp_module
- This command returns the name of the module we are in.
- cappend
- cget
- cis
- cname
- cpop
- cpush
- cset
- lb
- rb
- All of the above commands are methods of the expander object
handling the input. Their arguments and results are described in
expander(n).
SEE ALSO
expander(n), format(n), mpexpand(n)
KEYWORDS
manpage, interface, TMML, HTML, nroff, conversion, markup