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

Annotation of pod2mdoc/pod2mdoc.1, Revision 1.17

1.17    ! schwarze    1: .\"    $Id: pod2mdoc.1,v 1.16 2015/02/13 18:44:04 schwarze Exp $
1.1       schwarze    2: .\"
                      3: .\" Copyright (c) 2014 Kristaps Dzonsons <kristaps@bsd.lv>
                      4: .\"
                      5: .\" Permission to use, copy, modify, and distribute this software for any
                      6: .\" purpose with or without fee is hereby granted, provided that the above
                      7: .\" copyright notice and this permission notice appear in all copies.
                      8: .\"
                      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.
                     16: .\"
1.15      schwarze   17: .Dd $Mdocdate: February 13 2015 $
1.1       schwarze   18: .Dt POD2MDOC 1
                     19: .Os
                     20: .Sh NAME
                     21: .Nm pod2mdoc
                     22: .Nd Convert POD data to mdoc input
                     23: .Sh SYNOPSIS
                     24: .Nm pod2man
                     25: .Op Fl chloqruv
                     26: .Op Fl d Ar date
                     27: .Op Fl n Ar title
                     28: .Op Fl s Ar section
                     29: .Op Ar file
                     30: .Sh DESCRIPTION
                     31: The
                     32: .Nm
                     33: utility reads
                     34: .Ar file
                     35: and
                     36: generates
                     37: .Xr mdoc 7
                     38: input from
                     39: .Xr perlpod 1
                     40: source.
                     41: If unspecified or
                     42: .Ar \&- ,
                     43: .Ar file
                     44: is taken to be standard input.
                     45: Its arguments are as follows:
                     46: .Bl -tag -width Ds
                     47: .It Fl chloqruv
                     48: For compatibility with
                     49: .Xr pod2man 1 .
                     50: Ignored.
                     51: .It Fl d Ar date
                     52: Set the document date
1.14      schwarze   53: .Pq Sq \&Dd
1.1       schwarze   54: to
                     55: .Ar date
                     56: .Po
                     57: preferrably in
                     58: .Qq Month Day, Year
                     59: format
                     60: .Pc .
1.17    ! schwarze   61: If unspecified or if
        !            62: .Ar date
        !            63: is the literal string
        !            64: .Cm Mdocdate ,
1.1       schwarze   65: .Nm
                     66: uses the file modification date or the current date if reading from
                     67: standard input.
1.17    ! schwarze   68: If
        !            69: .Ar date
        !            70: is the literal string
        !            71: .Cm Mdocdate ,
        !            72: .Nm
        !            73: prepends
        !            74: .Qq $Mdocdate:
        !            75: to the date and appends a dollar sign, producing the format used by
        !            76: .Ox
        !            77: .Xr cvs 1 .
1.1       schwarze   78: .It Fl n Ar title
                     79: Set the document title
1.14      schwarze   80: .Pq Sq \&Dt
1.1       schwarze   81: to
                     82: .Ar title .
                     83: If unspecified,
                     84: .Nm
                     85: uses the suffix-stripped filename part of
                     86: .Ar file
                     87: as a document title or
                     88: .Ar STDIN
                     89: if reading from standard input
                     90: .Pq you probably don't want that .
                     91: .It Fl s Ar section
                     92: Set the document section
1.14      schwarze   93: .Pq Sq \&Dt
1.1       schwarze   94: to
                     95: .Ar section .
                     96: If unspecified,
                     97: .Nm
                     98: uses
                     99: .Ar 1
                    100: or, if the input file suffix is
                    101: .Li .pm ,
                    102: uses
                    103: .Ar 3p .
                    104: .El
1.7       kristaps  105: .Ss Smarts
                    106: Since
                    107: .Xr mdoc 7
                    108: is semantic and
                    109: .Xr perlpod 1
                    110: is not,
                    111: .Nm
                    112: tries to figure out semantic context for some terms.
                    113: Specifically, within each paragraph of the SYNOPSIS section, the
                    114: following occur:
                    115: .Bl -bullet
1.12      kristaps  116: .It
                    117: If any number of
                    118: .Li #include <foo.h>
                    119: lines are found at the start of a verbatim paragraph, they're rendered
                    120: with
                    121: .Sq \&In .
1.16      schwarze  122: .It
                    123: Other lines starting with
                    124: .Sq #
                    125: are rendered with
                    126: .Sq \&Fd .
1.7       kristaps  127: .It
                    128: An initial
                    129: .Li B<>
                    130: format code is rendered as
                    131: .Sq \&Nm .
                    132: .It
                    133: Subsequent
                    134: .Li B<>
                    135: format codes are rendered as
                    136: .Sq \&Ar .
                    137: However, if the leading character of a
                    138: .Li B<>
                    139: format code is
                    140: .Sq - ,
                    141: it is rendered as
                    142: .Sq \&Fl .
                    143: Subsequent space-separated terms without leading hyphens, e.g.,
                    144: .Li B<-foo bar> ,
                    145: are rendered as
                    146: .Sq \&Ar .
                    147: .It
                    148: Matching
                    149: .Li \&[
                    150: and
                    151: .Li \&]
                    152: pairs are rendered as
                    153: .Sq \&Oo
                    154: and
                    155: .Sq \&Oc .
                    156: .El
                    157: .Pp
                    158: Thus, the input
                    159: .Li B<foo> [B<-bar baz>]
                    160: is rendered as follows:
                    161: .Bd -literal
1.14      schwarze  162: \&.Nm foo
1.7       kristaps  163: \&.Oo
                    164: \&.Fl bar Ar baz
                    165: \&.Oc
                    166: .Ed
                    167: .Pp
1.8       kristaps  168: In the NAME section,
1.7       kristaps  169: .Sq \&Nm
                    170: and
                    171: .Sq \&Nd
1.8       kristaps  172: macros are inferred from text leading and trailing the last hyphen
1.7       kristaps  173: followed by a space (there may be any number of hyphens preceding the
                    174: space).
                    175: The space may occur on either side of the hyphen.
                    176: Thus,
                    177: .Li B<foo> - bar
                    178: will be rendered as follows:
                    179: .Bd -literal
                    180: \&.Nm foo
                    181: \&.Nd bar
                    182: .Ed
1.8       kristaps  183: .Pp
                    184: Multiple names separated by a comma are properly handled.
1.9       kristaps  185: .Pp
                    186: In any section, the
                    187: .Li L<>
                    188: format code is considered a
                    189: .Sq \&Lk
                    190: link if beginning with
                    191: .Li http: ,
                    192: .Li https: ,
                    193: .Li ftp: ,
                    194: .Li sftp: ,
                    195: .Li smb: ,
                    196: or
                    197: .Li afs: .
                    198: If beginning with
                    199: .Li mailto: ,
                    200: it is considered a
                    201: .Sq \&Mt
                    202: link.
                    203: Otherwise, it is considered a
                    204: .Sq \&Xr
                    205: manpage in section 3P if containing double-colons or section 1
                    206: otherwise.
                    207: The section may be overriden as
                    208: .Li L<foo(5)> .
1.10      kristaps  209: If only a section appears, such as in
                    210: .Li </section> ,
                    211: the link is rendered with
                    212: .Sq \&Sx .
1.14      schwarze  213: .Pp
                    214: Words followed by
                    215: .Qq Pq
                    216: that match function names listed in the SYNOPSIS section are marked up with
                    217: .Sq \&Fn .
1.15      schwarze  218: .Pp
                    219: If the contents of a
                    220: .Li B<>
                    221: format code matches a type name mentioned in the SYNOPSIS section,
                    222: it is rendered as
                    223: .Sq \&Vt .
                    224: If it matches a function argument name mentioned there,
                    225: it is rendered as
                    226: .Sq \&Fa .
1.1       schwarze  227: .Sh EXIT STATUS
                    228: .Ex -std
1.6       kristaps  229: .Sh EXAMPLES
                    230: To pipe a POD document
                    231: .Pa foo.pod
                    232: through
                    233: .Xr mandoc 1
                    234: and a pager:
                    235: .Pp
                    236: .Dl % pod2mdoc foo.pod | mandoc | more
1.1       schwarze  237: .Sh COMPATIBILITY
                    238: If
                    239: .Fl s
                    240: is not specified and the suffix for
                    241: .Ar file
                    242: is
                    243: .Li .pm ,
1.4       kristaps  244: .Nm
1.6       kristaps  245: infers a manual section of 3p, not 3 as stipulated in
1.4       kristaps  246: .Xr perlpod 1 .
1.5       kristaps  247: Furthermore, all links in the format of
                    248: .Li L<Foo::Bar>
                    249: are assumed to be in section 3p.
1.4       kristaps  250: .Pp
                    251: If
                    252: .Nm
                    253: encounters an
                    254: .Li =item
                    255: without the necessary
                    256: .Li =over ,
                    257: it will pretend that a prior
                    258: .Li =over
                    259: was invoked.
                    260: However, it will do so silently and not, as
                    261: .Xr pod2man 1
                    262: does, append a POD ERRORS section in the output manpage saying so.
1.1       schwarze  263: .Sh SEE ALSO
1.4       kristaps  264: .Xr perlpod 1 ,
1.6       kristaps  265: .Xr pod2man 1 ,
                    266: .Xr mdoc 7
1.1       schwarze  267: .Sh AUTHORS
                    268: .Nm
                    269: was written by
1.14      schwarze  270: .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
1.1       schwarze  271: .Sh CAVEATS
1.4       kristaps  272: By way of being a presentational language, POD is not well-represented
                    273: by
1.1       schwarze  274: .Xr mdoc 7 .
1.11      kristaps  275: Semantic content must be inferred and may be wrong.
1.1       schwarze  276: .Pp
                    277: .Nm
1.4       kristaps  278: only supports the named
                    279: .Li E<xxx>
                    280: escapes.
                    281: HTML names and numbers are silently discarded.
                    282: .Pp
                    283: Although most white-space requests in character encodings are properly
                    284: carried to output, adjacent character escapes with the specific
1.5       kristaps  285: whitespace sequence
1.4       kristaps  286: .Qq Li "B<2>B< 3>"
                    287: will cause the second space to be lost.
                    288: .Pp
                    289: The
                    290: .Li S<>
                    291: escape is discarded.
1.10      kristaps  292: .Pp
                    293: Unless solely a section link, the text and section parts of
                    294: .Li L<text|link/section>
                    295: are discarded.

CVSweb