(texinfo)
7.22.1.1 Overview
Texinfo processing in scheme
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.
Notes on the SXML vocabulary
Consider the following texinfo fragment:
@deffn Primitive set-car! pair value
This function...
@end deffnLogically, 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’.
7.22.1.2 Usage
Function: call-with-file-and-dir filename proc
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.
Variable: texi-command-specs
Function: texi-command-depth command max-depth
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) ⇒ #fFunction: texi-fragment->stexi string-or-port
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*.
Function: texi->stexi port
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.
Function: stexi->sxml tree
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