|
NAMEhtmlroff - HTML formatting and typesettingDESCRIPTIONaccepts troff input with a few extensions and changes. This manual describes the changes to the input language, assuming a working knowledge of troff itself.Name lengthsRequest, macro, string, and number names can be longer than two letters, as in:
HTML outputTwo new requests:
.html and .ihtml insert HTML into the output. The requests are only for opening new HTML tags. To close previously-opened tags, repeat the request with the same id. For example, the input:
produces this output:
The .html request is intended for block-level HTML constructs (those that can contain <p>) and maintains the HTML tag stack automatically. Intermediate tags need not be explicitly closed: removing the final .html t line in the example above would produce the same output. The special id closes the HTML tags immediately after printing them. The .ihtml request is similar to .html but is intended for inline HTML constructs such as <b> or <i> (those that can be contained within <p>). Unlike .html, .ihtml treats the open HTML tags as a set rather than a stack: each must be explicitly closed. Although it treats the tags as a set, .ihtml treats nesting properly in the output, closing and reopening tags as necessary. For example, the input:
produces this output:
Outside of .html and .ihtml requests, the characters and are treated as normal characters, not HTML markers, and are translated to and on output. To embed the raw HTML markers, use and [sic]. Font changesHtmlroff interprets the usual \f, .ft, \s, and .ps requests to change the font and point size. After applying each such change to its internal registers, htmlroff invokes the .font macro to emit corresponding HTML. The default definition of .font is:
Input files can redefine .font like any other request or macro. ParagraphsHtmlroff implements line height, text adjustment, and margins by wrapping all output text in <p style="..."> tags. This behavior can be disabled by setting the .paragraph number register to zero. Setting the .margin register to zero eliminates only the margin annotations.Subscripts and superscriptsHtmlroff interprets the \u, \d, and \v requests to move vertically during output. It emits output vertically offset up the page inside <sup> tags and output vertically offset down the page inside <sub> tags. This heuristic handles simple equations formatted byConditional inputTo make it easier to write input files that can be formatted by both troff and htmlroff, htmlroff adds a new condition h which evaluates true in .if and .ie requests. The t condition continues to evaluate true, to accomodate input files trying to distinguish between troff and nroff. To write a conditional matching troff alone, use `.if !h .if t'.Htmlroff 's handling of conditional input does not match troff's exactly. For example,
redefines the xx macro in troff but not in htmlroff. Do not write files depending on this behavior, as this bug may be fixed in the future. Htmlroff also mishandles \} in some cases. To work around them, use .\} on a line by itself, as in the last example. DiversionsDiversions in htmlroff use the alignment in effect at the time of the diversion when output. In particular,
produces a centered line in troff but not in htmlroff. The solution is to center inside the diversion, as in
Input pipesHtmlroff adds a new request .inputpipe stop cmd that redirects htmlroff 's input into a pipe to the given cmd . The redirection stops on encountering the line stop, optionally followed by white space and extra text. This is a dangerous and clusmy request, as htmlroff stops interpreting its input during the redirection, so stop must be found in the input itself, not in a macro that the input might appear to call. Although clusmy, .inputpipe allows input files to invoke troff to handle complicated input. For example, tmac.html redefines the PS macro that marks the beginning of a picture:
This macro invokes the shell script troff2png to run troff and convert the Postscript output to a PNG image file. Before starting the program, the macro creates a new file name for the image and prints HTML referring to it. The new .B register holds the final path element (the base name) of the current input file. Visit the GSP FreeBSD Man Page Interface. |