Miftran Users Guide: 1 Overview

Table of Contents * Previous Chapter * Next Chapter

# Overview

Miftran is a configurable translation program designed to translate Framemaker MIF (Maker Interchange Format) files into other text formats. By providing a customized initialization (or `rc') file, you can convert any MIF file into another useful text format. In particular, miftran has been designed to be able to produce reasonable HTML (Hypertext Markup Language) text files. In the rest of this document, the output is assumed to be HTML. If you plan on producing a format other than HTML, replace the word `HTML' in the remainder of this document with the name of the output format you are producing.

Note: This document is used as a sample MIF file to be run through miftran, as well as being a real manual that describes how to use the program. Thus there may be gratuitous use of formatting controls and cross-references. This is intended to better demonstrate the capabilities and use of miftran.

The translation process is based upon the paragraph and font tags used in your MIF document. Your rc file specifies how those tags are to be translated into HTML. The configuration information in the rc file also includes input and output filenames and various other control information.

For each document that you want to process, you will have to create an rc file which defines how the paragraph and font tags in that document are to be translated into HTML tags. This may take a couple of hours the first time you do it, but once you have your rc file you can continue to edit your MIF file and rerun miftran to get updated HTML files with no further work. If you have multiple documents that use the same set of paragraph tags, you can use the same rc file if it does not include the input filename, or you can copy your existing rc file for the new document, make the few changes required, and be ready to process the new document in a few minutes. For recommentations on how to set up your environment in which to do the translation, see Section 2.1, `Requirements' on page 4.

## 1.1 The Translation Process

The translation process reads the MIF file and transforms it through the following steps:

- lex - Lexical parsing (tokenizing). Separates the input into tokens for left and right angle brackets, numbers, and strings.
- cmd - Command level parsing. Groups tokens into commands with start, end, or complete markers to indicate nesting.
- tran - Translation. The MIF commands are translated into a series of non-nested commands according to an internal table. Most of the information in the MIF file is thrown away at this point. Tags, text, markers, and a few other things are kept. For advanced customization, you can edit the translation module to recognize more MIF keywords. Note that this module recognizes MIF keywords, which are defined by the MIF syntax, and which are not affected by the contents of any particular document.
- sub - Substitution. Based on the configuration information in the rc file, substitutes specified strings in place of thefixed strings output from the translation stage. This is the stage at which paragraph tags such as `1Heading' would be converted to HTML markers such as `<H1>' and `</H1>'.
- fmt - Formatting. The subsituted string from the previous stage is passed through a formatter which looks for special % escapes, replacing them with specified data. Some % escapes have side effects, such as switching the output file, allowing you to do some crude programming by using the format strings. (For more sophisticated stuff, you can hack up the C code.)

By default, miftran will process the input file through all of these stages. For debugging purposes, you can give it a command line option (such as -tran) which will cause it to output the text after that stage of processing, allowing you to see better what's going on.

Table of Contents * Previous Chapter * Next Chapter