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