This module parses texinfo into SXML. TeX will always be the processor
of choice for print output, of course. However, although makeinfo
works well for info, its output in other formats is not very
customizable, and the program is not extensible as a whole. This module
aims to provide an extensible framework for texinfo processing that
integrates texinfo into the constellation of SXML processing tools.
Consider the following texinfo fragment:
@deffn Primitive set-car! pair value This function... @end deffn
Logically, the category (Primitive), name (set-car!), and arguments
(pair value) are “attributes” of the deffn, with the description as
the content. However, texinfo allows for @-commands within the
arguments to an environment, like @deffn
, which means that
texinfo “attributes” are PCDATA. XML attributes, on the other hand,
are CDATA. For this reason, “attributes” of texinfo @-commands are
called “arguments”, and are grouped under the special element, ‘%’.
Because ‘%’ is not a valid NCName, stexinfo is a superset of SXML. In the interests of interoperability, this module provides a conversion function to replace the ‘%’ with ‘texinfo-arguments’.
Call the one-argument procedure proc with an input port that reads
from filename. During the dynamic extent of proc’s
execution, the current directory will be (dirname
filename)
. This is useful for parsing documents that can include
files by relative path name.
Given the texinfo command command, return its nesting level, or
#f
if it nests too deep for max-depth.
Examples:
(texi-command-depth 'chapter 4) ⇒ 1 (texi-command-depth 'top 4) ⇒ 0 (texi-command-depth 'subsection 4) ⇒ 3 (texi-command-depth 'appendixsubsec 4) ⇒ 3 (texi-command-depth 'subsection 2) ⇒ #f
Parse the texinfo commands in string-or-port, and return the
resultant stexi tree. The head of the tree will be the special command,
*fragment*
.
Read a full texinfo document from port and return the parsed stexi
tree. The parsing will start at the @settitle
and end at
@bye
or EOF.
Transform the stexi tree tree into sxml. This involves replacing
the %
element that keeps the texinfo arguments with an element
for each argument.
FIXME: right now it just changes % to texinfo-arguments
– that
doesn’t hang with the idea of making a dtd at some point