source. If unspecified or
is taken to be standard input. Its arguments are as follows:
Smarts
Since
mdoc(7) is semantic and
perlpod(1) is not,
pod2mdoc tries to figure out semantic context for some terms. Specifically, within each paragraph of the SYNOPSIS section, the following occur:
-
If any number of
#include <foo.h>
lines are found at the start of a verbatim paragraph, they're rendered with ‘In’.
-
Other lines starting with ‘#’ are rendered with ‘Fd’.
-
Function declarations are rendered with ‘Ft’, ‘Fo’, and ‘Fa’.
-
An initial
B<>
format code is rendered as ‘Nm’.
-
Subsequent
B<>
format codes are rendered as ‘Ar’. However, if the leading character of a B<>
format code is ‘-’, it is rendered as ‘Fl’. Subsequent space-separated terms without leading hyphens, e.g., B<-foo bar>
, are rendered as ‘Ar’.
-
Matching
[
and ]
pairs are rendered as ‘Oo’ and ‘Oc’.
Thus, the input
B<foo> [B<-bar baz>]
is rendered as follows:
.Nm foo
.Oo
.Fl bar Ar baz
.Oc
In the NAME section, ‘Nm’ and ‘Nd’ macros are inferred from text leading and trailing the last hyphen followed by a space (there may be any number of hyphens preceding the space). The space may occur on either side of the hyphen. Thus,
B<foo> - bar
will be rendered as follows:
.Nm foo
.Nd bar
Multiple names separated by a comma are properly handled.
In any section, the
L<>
format code is considered a ‘Lk’ link if beginning with
http:
,
https:
,
ftp:
,
sftp:
,
smb:
, or
afs:
. If beginning with
mailto:
, it is considered a ‘Mt’ link. Otherwise, it is considered a ‘Xr’ manpage in section 3P if containing double-colons or section 1 otherwise. The section may be overriden as
L<foo(5)>
. If only a section appears, such as in
</section>
, the link is rendered with ‘Sx’.
Words followed by “()” that match function names listed in the SYNOPSIS section are marked up with ‘Fn’. If they don't match, they are marked up with ‘Xr’. Words not followed by “()” that match preprocessor macros #define'd in the SYNOPSIS section are marked up with ‘Dv’.
If the contents of a
B<>
or
I<>
format code matches a type name mentioned in the SYNOPSIS section, it is rendered as ‘Vt’. If it matches a function argument name mentioned there, it is rendered as ‘Fa’.