.\" $Revision: 1.12 $ .ds Ve 1.0 .\" .de Ex .RS .nf .nr sf \\n(.f .if !\\n(.U \{\ . ft B . if n .sp . if t .sp .5 \} .. .de Ee .if !\\n(.U \{\ . ft \\n(sf . if n .sp . if t .sp .5 \} .fi .RE .. .\" .de Sd .ds Dt \\$2 .. .\" .Sd $Date: 1995/08/23 12:07:31 $ .TH unroff-html 1 "\*(Dt" .SH NAME unroff-html \- HTML 2.0 back-end for the programmable troff translator .SH SYNOPSIS .B unroff [ .B \-fhtml ] [ .BI \-m package ] [ .IR file " | " option...\& ] .SH OVERVIEW When called with the .B \-fhtml option, .I unroff loads the back-end for the Hypertext Markup Language (HTML) version 2.0. Please read .BR unroff (1) first for an overview of the Scheme-based, programmable troff translator and for a description of the generic options that exist in addition to .B \-f and .BR \-m . For information about extending and programming .I unroff also refer to the .IR "Unroff Programmer's Manual" . .LP .I unroff is usually invoked with an additional .BI \-m package option (such as .B \-ms or .BR \-man ) to load the translation rules for the troff macros and other elements defined by the macro package that is used to typeset the document. If no .B \-m option is supplied, only the standard troff requests, special characters, escape sequences, etc. are recognized and translated to HTML by .I unroff as described in this manual. .SH OPTIONS The following HTML-specific options can be specified in the command line after the generic options. See .BR unroff (1) for a general description of keyword/value options and their types and for a list of options that are not specific to the target language. .TP .BR title " (string)" The value to be used for the
andtags. Nested requests are treated correctly, and currently active character formatting elements such as (resulting from troff font changes) are temporarily disabled while the
oris emitted. A warning is printed if a \*(lqtab\*(rq character is encountered within filled text. .SS FONTS The `\ef' escape sequence and the requests .B .ft (change current font) and .B .fp (mount font at font position) are supported in the usual way, both with numeric font positions as well as font names and the special name `P' to denote the previous font. The font position of the currently active font is available through the read-only number register `.f'. Initially, the font `R' is mounted on font positions 1 and 4, font `I' on font position 2, and font `B' on position 3. .LP To map troff font names to HTML character formatting elements, the \f2define-font\fP Scheme procedure is called with the name of a troff font to be used in documents, and HTML start and end tags to be emitted when changing to this font, or when changing .I from this font to another font, respectively. Whether and is generated inside non-filled (pre-formatted) text for fixed-width fonts is controlled by the option .BR tt-preformat . The following calls to .I define-font are evaluated on startup: .LP .nf .if !\n(.U \{\ . ft C . ps -1 . vs -1 \} (define-font "R" "" "") (define-font "I" ' ') (define-font "B" ' ') (define-font "C" ' ') (define-font "CW" ' ') (define-font "CO" ' ') ; kludge for Courier-Oblique .if !\n(.U \{\ . ft . ps . vs \} .fi .LP Site administrators may add definitions here for fonts used at their site. Users can define mappings for new fonts by placing corresponding definitions in their documents or document-specific Scheme files. .SS "OTHER TROFF REQUESTS" The .B .br request generates a
tags (or newline characters inside non-filled/pre-formatted
text).
Likewise, the request
.BR .ti ,
when called with a positive indent, produces a
followed by the
appropriate number of non-breakable spaces.
.LP
The
.B .tl
requests justs emits the title parts delimited by spaces.
It is impossible to preserve the meaning of this request
in HTML 2.0.
.LP
The horizontal line drawing escape sequence `\el' just repeats
the specified character (or underline as default) to draw
a line.
If the given length looks like it could be the line length
(that is, if it exceeds a certain value), a
and. If assigned to the option .BR handle-eqn , inline equations are rendered in the font currently mounted on font position 2. .TP .B text The input is sent to the respective preprocessor (as specified by the options .BR eqn , .BR tbl , or .BR pic ), and its result is piped to the shell command referred to by the option .BR troff-to-text , which typically involves a call to .BR nroff (1) or an equivalent command. As with \*(lqcopy\*(rq, the result is then placed inside
and, unless the source is an inline equation. .IP The value of .B troff-to-text is filtered through a call to the .I substitute Scheme primitive with the name of an output file as its argument; this file name can be referenced from within the option's value by the substitute specifier \*(lq%1%\*(rq (see the Programmer's Manual for a description of .I substitute and a list of substitute specifiers). Here is a typical value for the .B troff-to-text option: .Ex "groff \-Tascii | col \-b | sed '/^[ \et]*$/d' > %1%" .Ee .TP .B gif Input lines are preprocessed as described under \*(lqtext\*(rq, and the result is piped to the shell command named by the option .BR troff-to-gif . The latter is subject to a call to .I substitute with the name of a temporary file (which may be used to store intermediate PostScript output) and the name of the output file where the resulting GIF image must be stored. The entire preprocessor input is replaced by an element with a reference to the GIF file and a suitable \*(lqalt=\*(rq attribute. Unless processing an inline equation, the element is surrounded by
tags. .IP The names of the files containing the GIF images are generated from the value of the .B document option, a sequence number, and the suffix \*(lq.gif\*(rq. Therefore, the .B document option must have been set when using the \*(lqgif\*(rq method, otherwise a warning is printed and the preprocessor input is skipped. .LP In any case, the output of a call to eqn is ignored if the input consists of calls to \*(lqdelim\*(rq or \*(lqdefine\*(rq and empty lines exclusively. When processing eqn input, calls to \*(lqdelim\*(rq are intercepted by .I unroff to record changes of the inline equation delimiters. .SS "HYPERTEXT LINKS" The facilities for embedding arbitrary hypertext links in troff documents are still experimental in this version of .I unroff and thus are likely to change in future releases. To use them, mention the file name \*(lqhyper.scm\*(rq in the command line before any troff source files. At the beginning of the first troff file, source the file \*(lqtmac.hyper\*(rq from the directory \*(lqdoc\*(rq like this: .LP .nf .if !\en(.U .so tmac.hyper .fi .LP The request .B .Hr can then be used to create a hypertext link. Its usage is: .LP .nf .Hr -url URL anchor-text [suffix] .Hr -symbolic label anchor-text [suffix] .Hr troff-text .fi .LP The first two forms are recognized by .I unroff and the third form is recognized by troff. The first form is used for links pointing to external resources, and the second one is used for forward or backward links referencing anchors defined in a file belonging to the same document. An anchor is placed in the document by calling the request .BR .Ha : .LP .nf .Ha label anchor-text .fi .LP The label specified in a call to .B .Ha can then be used in calls to .BR ".Hr -symbolic" . All symbolic references must have been resolved at the end of the document. The \*(lqanchor-text\*(rq is placed between the tags and ; \*(lqsuffix\*(rq is appended to the closing if present. \*(lqtroff-text\*(rq is just formatted in the normal way. Quotes must be used if any of the arguments contains spaces. .LP Use of the hypertext facilities is demonstrated by the troff source of the Programmer's Manual that is included in the .I unroff distribution. .SH "SCHEME PROCEDURES" The following Scheme procedures, macros, and variables are defined by the HTML 2.0 back-end and can be used from within user-supplied Scheme code: .TP (\f2define-font name start-tag end-tag\fP) Associates a HTML start tag and end tag (symbols) with a troff font name (string) as explained under FONTS above. The font name can then be used in .BR .fp , .BR .ft , and `\ef' requests. .TP (\f2reset-font\fP) Resets both the current and previous font to the font mounted on position 1. .TP \f2current-font\fP .TP \f2previous-font\fP These variables hold the current and previous font as (integer) font positions. .TP (\f2with-font-preserved\fP . \f2body\fP) This macro can be used to temporarily change to font \*(lqR\*(rq, evaluate \f2body\fP, and revert to the font that has been active when the form was entered. The macro returns a string that can be output using the primitive \f2emit\fP or returned from an event procedure. .TP (\f2preform enable?\fP) If the argument is #t, pre-formatted text is enabled, otherwise disabled. .TP \f2preform?\fP This boolean variable holds #t if pre-formatted text is enabled, #f otherwise. .TP (\f2with-preform-preserved\fP . \f2body\fP) A macro that can be used to temporarily disable pre-formatted text, evaluate \f2body\fP, and then re-enable it if appropriate. The macro expands to a string that must be output or returned from an event procedure. .TP (\f2parse-unquote string\fP) Temporarily establishes an output translation to map the quote character to \*(lq"\*(rq, applies \f2parse\fP (explained in the Programmer's Manual) to its argument, and returns the result. .TP (\f2center n\fP) Centers the next \f2n\fP input lines (see description of .B .ce under TROFF REQUESTS above). If \f2n\fP is zero, centering is stopped. .TP \f2nbsp\fP A Scheme variable that holds a string interpreted as a non-breaking space by HTML clients. .SH "SEE ALSO" .BR unroff (1), .BR unroff-html-man (1), .BR unroff-html-ms (1); .br .BR troff (1), .BR nroff (1), .BR groff (1), .BR eqn (1), .BR tbl (1), .BR pic (1). .LP Unroff Programmer's Manual. .LP http://www.informatik.uni-bremen.de/~net/unroff .LP Berners-Lee, Connolly, et al., HyperText Markup Language Specification\(em2.0, Internet Draft, Internet Engineering Task Force. .SH BUGS The `\espace' escape sequence should be mapped to the entity (non-breaking space), but this entity is not supported by a number of HTML clients. .LP Only the font positions 1 to 9 can currently be used. There should be no limit. .LP The extra space generated for end of sentence should be configurable. .LP Underlining should be supported.