A troff to HTML Conversion Program

troff_to_html - a TROFF to HTML Convertor

Paul E. Dunne

Department of Computer Science

University of Liverpool

Liverpool L69 3BX

Great Britain




The following describes a very basic text conversion facility for translating a troff source file (using the -ms macro set) to a HTML file suitable for vieweing using mosaic or netscape.

The translator is invoked (locally) via the command

~ped/bin/troff_to_html < input_file > output_file

A (uuencoded compressed) binary (HP7000 Series) is here

Source program (written in Ada) is here

where input_file is a troff source file (that may include directives for the pre-processors pic, and eqn), built using the -ms macro set. output_file will be a HTML source file.

A C++ version (compiling under c89) has been produced by Dave McGaw and may be found here. Please note that this requires a dictionary file for special characters located here and an include (.h) file that is here.

-ms macros Recognised and Translated

Extensions August 1996: Two artificial directives have been added, to allow printing of $ symbols: These are:

Ada Version

No limit on number of rows/column. New version (July 1996) uses HTML <table> feature.

C++ Version

Also incorporates HTML <table> (errors in previous version corrected, July 1996). Multiple row formats allowed (max 70 rows/20 columns).

NoteNo font changes or eqn inside table entries. Multi-column spans generally don't look very good. It is assumed that the table specification is valid (otherwise conversion program will crash).

troff Directives Recognised and Translated.

In addition diacritical marks (umlaut, grave, and acute accents) are dealt with.

Note: All lines opening with a full-stop are ignored unless the line is a directive recognised by the translator.