[BACK]Return to mandoc.1 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Annotation of mandoc/mandoc.1, Revision 1.39

1.39    ! kristaps    1: .\"    $Id: mandoc.1,v 1.38 2009/09/21 13:44:56 kristaps Exp $
1.1       kristaps    2: .\"
1.17      kristaps    3: .\" Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
1.1       kristaps    4: .\"
                      5: .\" Permission to use, copy, modify, and distribute this software for any
1.16      kristaps    6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
1.1       kristaps    8: .\"
1.16      kristaps    9: .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10: .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12: .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13: .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14: .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15: .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1       kristaps   16: .\"
                     17: .Dd $Mdocdate$
1.14      kristaps   18: .Dt MANDOC 1
1.1       kristaps   19: .Os
1.32      kristaps   20: .
                     21: .
1.1       kristaps   22: .Sh NAME
                     23: .Nm mandoc
1.8       kristaps   24: .Nd format and display UNIX manuals
1.32      kristaps   25: .
                     26: .
1.1       kristaps   27: .Sh SYNOPSIS
                     28: .Nm mandoc
                     29: .Op Fl f Ns Ar option...
1.8       kristaps   30: .Op Fl m Ns Ar format
1.37      kristaps   31: .Op Fl o Ns Ar option...
                     32: .Op Fl T Ns Ar output
                     33: .Op Fl V
1.1       kristaps   34: .Op Fl W Ns Ar err...
                     35: .Op Ar infile...
1.32      kristaps   36: .
                     37: .
1.1       kristaps   38: .Sh DESCRIPTION
                     39: The
                     40: .Nm
1.26      kristaps   41: utility formats
1.8       kristaps   42: .Ux
                     43: manual pages for display.  The arguments are as follows:
1.32      kristaps   44: .
1.19      kristaps   45: .Bl -tag -width Ds
1.1       kristaps   46: .It Fl f Ns Ar option...
1.37      kristaps   47: Comma-separated compiler options.  See
1.1       kristaps   48: .Sx Compiler Options
                     49: for details.
1.32      kristaps   50: .
1.19      kristaps   51: .It Fl m Ns Ar format
1.8       kristaps   52: Input format.  See
                     53: .Sx Input Formats
                     54: for available formats.  Defaults to
1.12      kristaps   55: .Fl m Ns Ar andoc .
1.32      kristaps   56: .
1.37      kristaps   57: .It Fl o Ns Ar format
                     58: Comma-separated output options.  See
                     59: .Sx Output Options
                     60: for details.
                     61: .
1.19      kristaps   62: .It Fl T Ns Ar output
1.1       kristaps   63: Output format.  See
                     64: .Sx Output Formats
                     65: for available formats.  Defaults to
                     66: .Fl T Ns Ar ascii .
1.32      kristaps   67: .
1.1       kristaps   68: .It Fl V
                     69: Print version and exit.
1.32      kristaps   70: .
1.1       kristaps   71: .It Fl W Ns Ar err...
1.37      kristaps   72: Comma-separated warning options.  Use
1.1       kristaps   73: .Fl W Ns Ar all
1.24      kristaps   74: to print warnings,
1.26      kristaps   75: .Fl W Ns Ar error
1.24      kristaps   76: for warnings to be considered errors and cause utility
1.26      kristaps   77: termination.  Multiple
1.1       kristaps   78: .Fl W
                     79: arguments may be comma-separated, such as
                     80: .Fl W Ns Ar error,all .
1.32      kristaps   81: .
1.1       kristaps   82: .It Ar infile...
                     83: Read input from zero or more
                     84: .Ar infile .
1.2       kristaps   85: If unspecified, reads from stdin.  If multiple files are specified,
                     86: .Nm
                     87: will halt with the first failed parse.
1.1       kristaps   88: .El
1.32      kristaps   89: .
1.1       kristaps   90: .Pp
1.26      kristaps   91: By default,
                     92: .Nm
                     93: reads
1.8       kristaps   94: .Xr mdoc 7
1.12      kristaps   95: or
                     96: .Xr man 7
1.8       kristaps   97: text from stdin, implying
1.12      kristaps   98: .Fl m Ns Ar andoc ,
1.8       kristaps   99: and prints 78-column backspace-encoded output to stdout as if
1.1       kristaps  100: .Fl T Ns Ar ascii
                    101: were provided.
1.32      kristaps  102: .
1.1       kristaps  103: .Pp
                    104: .Ex -std mandoc
1.32      kristaps  105: .
                    106: .
1.22      kristaps  107: .Ss Punctuation and Spacing
1.13      kristaps  108: If punctuation is set apart from words, such as in the phrase
                    109: .Dq to be \&, or not to be ,
                    110: it's processed by
                    111: .Nm
1.22      kristaps  112: according to the following rules:  opening punctuation
1.4       kristaps  113: .Po
1.26      kristaps  114: .Sq \&( ,
                    115: .Sq \&[ ,
1.4       kristaps  116: and
                    117: .Sq \&{
1.26      kristaps  118: .Pc
1.22      kristaps  119: is not followed by a space; closing punctuation
1.4       kristaps  120: .Po
1.26      kristaps  121: .Sq \&. ,
                    122: .Sq \&, ,
                    123: .Sq \&; ,
                    124: .Sq \&: ,
                    125: .Sq \&? ,
                    126: .Sq \&! ,
                    127: .Sq \&) ,
                    128: .Sq \&]
1.4       kristaps  129: and
                    130: .Sq \&}
1.26      kristaps  131: .Pc
1.15      kristaps  132: is not preceded by whitespace.
1.32      kristaps  133: .
1.4       kristaps  134: .Pp
1.13      kristaps  135: If the input is
                    136: .Xr mdoc 7 ,
                    137: these rules are also applied to macro arguments when appropriate.
1.32      kristaps  138: .
1.22      kristaps  139: .Pp
                    140: White-space, in non-literal (normal) mode, is stripped from input and
1.33      kristaps  141: replaced on output by a single space.  Thus, if you wish to preserve multiple
                    142: spaces, they must be space-escaped or used in a literal display mode, e.g.,
1.27      kristaps  143: .Sq \&Bd \-literal
1.26      kristaps  144: in
1.22      kristaps  145: .Xr mdoc 7 .
1.32      kristaps  146: .
                    147: .
1.8       kristaps  148: .Ss Input Formats
                    149: The
                    150: .Nm
                    151: utility accepts
                    152: .Xr mdoc 7
                    153: and
                    154: .Xr man 7
                    155: input with
1.10      kristaps  156: .Fl m Ns Ar doc
1.8       kristaps  157: and
1.10      kristaps  158: .Fl m Ns Ar an ,
1.8       kristaps  159: respectively.  The
                    160: .Xr mdoc 7
                    161: format is
                    162: .Em strongly
1.26      kristaps  163: recommended;
1.8       kristaps  164: .Xr man 7
                    165: should only be used for legacy manuals.
1.32      kristaps  166: .
1.11      kristaps  167: .Pp
1.12      kristaps  168: A third option,
                    169: .Fl m Ns Ar andoc ,
1.13      kristaps  170: which is also the default, determines encoding on-the-fly: if the first
1.26      kristaps  171: non-comment macro is
1.27      kristaps  172: .Sq \&Dd
1.13      kristaps  173: or
1.27      kristaps  174: .Sq \&Dt ,
1.26      kristaps  175: the
1.13      kristaps  176: .Xr mdoc 7
                    177: parser is used; otherwise, the
                    178: .Xr man 7
                    179: parser is used.
1.32      kristaps  180: .
1.13      kristaps  181: .Pp
                    182: If multiple
1.26      kristaps  183: files are specified with
                    184: .Fl m Ns Ar andoc ,
1.13      kristaps  185: each has its file-type determined this way.  If multiple files are
                    186: specified and
1.12      kristaps  187: .Fl m Ns Ar doc
                    188: or
                    189: .Fl m Ns Ar an
                    190: is specified, then this format is used exclusively.
1.32      kristaps  191: .
                    192: .
1.1       kristaps  193: .Ss Output Formats
                    194: The
                    195: .Nm
                    196: utility accepts the following
                    197: .Fl T
                    198: arguments:
1.32      kristaps  199: .
1.19      kristaps  200: .Bl -tag -width Ds
1.13      kristaps  201: .It Fl T Ns Ar ascii
1.1       kristaps  202: Produce 7-bit ASCII output, backspace-encoded for bold and underline
                    203: styles.  This is the default.
1.32      kristaps  204: .
1.37      kristaps  205: .It Fl T Ns Ar html
                    206: Produce strict HTML-4.01 output, with a sane default style.
                    207: .
1.13      kristaps  208: .It Fl T Ns Ar tree
1.1       kristaps  209: Produce an indented parse tree.
1.32      kristaps  210: .
1.13      kristaps  211: .It Fl T Ns Ar lint
1.1       kristaps  212: Parse only: produce no output.
                    213: .El
1.32      kristaps  214: .
1.13      kristaps  215: .Pp
                    216: If multiple input files are specified, these will be processed by the
                    217: corresponding filter in-order.
1.32      kristaps  218: .
                    219: .
1.1       kristaps  220: .Ss Compiler Options
1.35      kristaps  221: Default compiler behaviour may be overridden with the
1.1       kristaps  222: .Fl f
                    223: flag.
1.32      kristaps  224: .
1.19      kristaps  225: .Bl -tag -width Ds
1.1       kristaps  226: .It Fl f Ns Ar ign-scope
                    227: When rewinding the scope of a block macro, forces the compiler to ignore
                    228: scope violations.  This can seriously mangle the resulting tree.
1.8       kristaps  229: .Pq mdoc only
1.32      kristaps  230: .
1.21      kristaps  231: .It Fl f Ns Ar no-ign-escape
                    232: Don't ignore invalid escape sequences.
1.32      kristaps  233: .
1.12      kristaps  234: .It Fl f Ns Ar no-ign-macro
1.21      kristaps  235: Do not ignore unknown macros at the start of input lines.
1.32      kristaps  236: .
1.21      kristaps  237: .It Fl f Ns Ar no-ign-chars
                    238: Do not ignore disallowed characters.
1.32      kristaps  239: .
1.21      kristaps  240: .It Fl f Ns Ar strict
1.26      kristaps  241: Implies
1.21      kristaps  242: .Fl f Ns Ar no-ign-escape ,
1.26      kristaps  243: .Fl f Ns Ar no-ign-macro
1.21      kristaps  244: and
1.26      kristaps  245: .Fl f Ns Ar no-ign-chars .
1.32      kristaps  246: .
1.28      kristaps  247: .It Fl f Ns Ar ign-errors
                    248: Don't halt when encountering parse errors.  Useful with
                    249: .Fl T Ns Ar lint
                    250: over a large set of manuals passed on the command line.
1.1       kristaps  251: .El
1.32      kristaps  252: .
1.37      kristaps  253: .Ss Output Options
                    254: For the time being, only
                    255: .Fl T Ns Ar html
                    256: is the only mode with output options:
                    257: .Bl -tag -width Ds
                    258: .It Fl o Ns Ar style=style.css
                    259: The file
                    260: .Ar style.css
                    261: is used for an external style-sheet.  This must be a valid absolute or
                    262: relative URI.
1.39    ! kristaps  263: .It Fl o Ns Ar man=fmt
        !           264: The string
        !           265: .Ar fmt ,
        !           266: for example,
        !           267: .Ar ../html%S/%N.%S.html ,
        !           268: is used as a template for linked manuals (usually via the
1.37      kristaps  269: .Sq \&Xr
1.39    ! kristaps  270: macro).  The default is
        !           271: .Ar %N.%S.html .
1.37      kristaps  272: .El
1.32      kristaps  273: .
1.1       kristaps  274: .Sh EXAMPLES
1.13      kristaps  275: To page manuals to the terminal:
1.32      kristaps  276: .
1.1       kristaps  277: .Pp
1.21      kristaps  278: .D1 % mandoc \-Wall,error \-fstrict mandoc.1 2>&1 | less
1.13      kristaps  279: .D1 % mandoc mandoc.1 mdoc.3 mdoc.7 | less
1.32      kristaps  280: .
1.28      kristaps  281: .Pp
1.38      kristaps  282: To produce HTML manuals with
                    283: .Pa http://localhost/
                    284: as the base URI:
                    285: .Pp
                    286: .D1 % mandoc \-Thtml -obase=http://localhost/ mdoc.7 > mdoc.7.html
                    287: .Pp
1.28      kristaps  288: To check over a large set of manuals:
1.32      kristaps  289: .
1.28      kristaps  290: .Pp
                    291: .Dl % mandoc \-Tlint \-fign-errors `find /usr/src -name \e*\e.[1-9]`
1.32      kristaps  292: .
                    293: .
1.20      kristaps  294: .Sh COMPATIBILITY
1.26      kristaps  295: This section summarises
1.20      kristaps  296: .Nm
1.26      kristaps  297: compatibility with
1.20      kristaps  298: .Xr groff 1 .
1.32      kristaps  299: Each input and output format is separately noted.
                    300: .
                    301: .
                    302: .Ss ASCII output
1.37      kristaps  303: .Bl -bullet -compact
1.29      kristaps  304: .It
                    305: The
                    306: .Sq \e~
1.32      kristaps  307: special character doesn't produce expected behaviour in
                    308: .Fl T Ns Ar ascii .
                    309: .
                    310: .It
                    311: The
1.33      kristaps  312: .Sq \&Bd \-literal
1.32      kristaps  313: and
                    314: .Sq \&Bd \-unfilled
                    315: macros of
                    316: .Xr mdoc 7
                    317: in
                    318: .Fl T Ns Ar ascii
                    319: are synonyms, as are \-filled and \-ragged.
                    320: .
1.26      kristaps  321: .It
1.27      kristaps  322: In
                    323: .Xr groff 1 ,
                    324: the
                    325: .Sq \&Pa
1.32      kristaps  326: .Xr mdoc 7
                    327: macro does not underline when scoped under an
1.30      kristaps  328: .Sq \&It
                    329: in the FILES section.  This behaves correctly in
1.27      kristaps  330: .Nm .
1.32      kristaps  331: .
1.27      kristaps  332: .It
1.20      kristaps  333: A list or display following
1.27      kristaps  334: .Sq \&Ss
1.32      kristaps  335: .Xr mdoc 7
                    336: macro in
                    337: .Fl T Ns Ar ascii
1.20      kristaps  338: does not assert a prior vertical break, just as it doesn't with
1.27      kristaps  339: .Sq \&Sh .
1.32      kristaps  340: .
1.20      kristaps  341: .It
1.32      kristaps  342: The
                    343: .Sq \&na
                    344: .Xr man 7
1.34      kristaps  345: macro in
1.32      kristaps  346: .Fl T Ns Ar ascii
1.34      kristaps  347: has no effect.
1.32      kristaps  348: .
1.20      kristaps  349: .It
                    350: Words aren't hyphenated.
1.32      kristaps  351: .
1.22      kristaps  352: .It
                    353: In normal mode (not a literal block), blocks of spaces aren't preserved,
1.32      kristaps  354: so double spaces following sentence closure are reduced to a single space;
                    355: .Xr groff 1
                    356: retains spaces.
                    357: .
                    358: .It
                    359: Sentences are unilaterally monospaced.
1.20      kristaps  360: .El
                    361: .\" SECTION
1.1       kristaps  362: .Sh SEE ALSO
1.13      kristaps  363: .Xr mandoc_char 7 ,
1.9       kristaps  364: .Xr mdoc 7 ,
                    365: .Xr man 7
1.39    ! kristaps  366: .
1.1       kristaps  367: .Sh AUTHORS
                    368: The
                    369: .Nm
1.26      kristaps  370: utility was written by
1.18      kristaps  371: .An Kristaps Dzonsons Aq kristaps@kth.se .
1.39    ! kristaps  372: .
        !           373: .Sh CAVEATS
        !           374: In
        !           375: .Fl T Ns Ar html ,
        !           376: the maximum size of an element attribute is determined by
        !           377: .Dv BUFSIZ ,
        !           378: which is usually 1024 bytes.  Be aware of this when setting long link
        !           379: formats with
        !           380: .Fl o Ns Ar man=fmt .

CVSweb