TEItools is extremely poorly documented. Here are some info and tips. Hopefully this part will eventually grow into a decent documentation for TEItools. Any takers?
The user interface to TEItools is a single script named sgml2any. It should be invoked via some other name like linuxdoc2tei or tei2tex, by the means of a symbolic link or just a copy. The syntax is asfollows:
scriptname source_file style_options
source_file is the name of the source SGML file to be processed.
Each style_option looks like
-style name or like -style name=value.
Each name modifies the output of TEItools in one way or another. The order of -style options is significant. Single -style might list several comma separated styles. More on styles below.
You will probably create your own extensions to the TEItools skeleton like I do. These can include:
To facilitate such local development, the TEItools home directory could have a site subdirectory - possibly symlinked to some directory outside TEItools tree for easy upgrades. It should have the same structure main TEItools tree have. Files are searched in site tree first and then in the main tree.
sgml2any determines the frontend and backend to use just by its name: if it is started as tei2rtf, then the frontend is taken to be tei, and the backend is rtf.
Each frontend is placed in a subdirectory under $SGML_HOME. In turn, each backend lives in a subdirectory under the frontend's directory. The backend directory contains a CoST script named script plus any supplementary files it needs.The backend directory also contains a styles directory which in turn contains style files.
Each backend script processes document presentation independently, which distinguishes TEItools from DSSSL-based software. (Please, don't tell me I'm doing it in wrong way, you won't be first to do that, and even not in first dozen :-)). I'm trying to be consistent across scripts as far as it makes sense, so please report all divergences as bugs.
Style files are used by just appending them to the main script, so they can rename existing Tcl procedures and substitute their own equivalents. Styles for say tei to rtf conversion are looked up in $SGML_HOME/tei/rtf/styles directory.
If style has the name=val form, then a global Tcl variable TEItools_name_value will be set to val. It could then be checked from within the main scripts or styles.
If style has the name form, then a global Tcl variable TEItools_name_in_use will be set to some value. In this way styles could check for presence of other styles.
To understand the scripts, you have to know Tcl, CoST, and for RTF backend, RATFINK.
The TEItools are targeted to be easily internationalized. They works pretty well in Russian, since that's what I'm using daily. English, Russian, French and Finnish localization files are included in the distribution. You should clone one of them for creating new language support data.
Everything locale-dependent is in $SGML_HOME/lib/locale.LANG.tcl files. LANG is defined this way:
Note that LANG value is converted to lower case to form file name.
Locale files specify the following stuff.
First, there should be localize substitution[2], which defines some wordings in your native language, such as Table of contents etc. Second, there should be functions whose actions are localization-dependent. Currently, they are the following (parentheses show which backend uses the function).
Note that each style applies to one backend only.
Last modified: ÷ÔÒ îÏÑ 23 16:55:15 MSK 1999
Produced by TEItools