File: txt2man.1

package info (click to toggle)
txt2man 1.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 272 kB
  • sloc: sh: 1,411; makefile: 37
file content (188 lines) | stat: -rw-r--r-- 5,620 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
.\" Text automatically generated by txt2man
.TH txt2man 1 "15 August 2016" "txt2man-1.6.0" ""
.SH NAME
\fBtxt2man \fP- convert flat ASCII text to man page format
.SH SYNOPSIS
.nf
.fam C
\fBtxt2man\fP [\fB-hpTX\fP] [\fB-t\fP \fImytitle\fP] [\fB-P\fP \fIpname\fP] [\fB-r\fP \fIrel\fP] [\fB-s\fP \fIsect\fP]
        [\fB-v\fP \fIvol\fP] [\fB-I\fP \fItxt\fP] [\fB-B\fP \fItxt\fP] [\fB-d\fP \fIdate\fP] [\fIifile\fP]
.fam T
.fi
.fam T
.fi
.SH DESCRIPTION
\fBtxt2man\fP converts the input text into nroff/troff standard \fBman\fP(7)
macros used to format Unix manual pages. Nice pages can be generated
specially for commands (section 1 or 8) or for C functions reference
(sections 2, 3), with the ability to recognize and format command and
function names, flags, types and arguments.
.PP
\fBtxt2man\fP is also able to recognize and format sections, paragraphs,
lists (standard, numbered, description, nested), cross references and
literal display blocks.
.PP
If input file \fIifile\fP is omitted, standard input is used. Result is
displayed on standard output.
.PP
Here is how text patterns are recognized and processed:
.TP
.B
Sections
These headers are defined by a line in upper case, starting
column 1. If there is one or more leading spaces, a
sub-section will be generated instead. Optionally, the
Section name can be preceded by a blank line. This is useful
for a better visualization of the source text to be used to
generate the manpage.
.TP
.B
Paragraphs
They must be separated by a blank line, and left aligned.
Alternatively two blank spaces can be used to produce the
same result. This option will provide a better visualization
of the source text to be used to generate the manpage.
.TP
.B
Tag list
The item definition is separated from the item description
by at least 2 blank spaces, even before a new line, if
definition is too long. Definition will be emphasized
by default.
.TP
.B
Bullet list
Bullet list items are defined by the first word being "-"
or "*" or "o".
.TP
.B
Enumerated list
The first word must be a number followed by a dot.
.TP
.B
Literal display blocks
This paragraph type is used to display unmodified text,
for example source code. It must be separated by a blank
line and be indented by a TAB. It is primarily used to format
unmodified source code. It will be printed using fixed font
whenever possible (troff).
.TP
.B
Cross references
A cross reference (another man page) is defined by a word
followed by a number in parenthesis.
.PP
Special sections:
.TP
.B
NAME
The function or command name and short description are set in
this section.
.TP
.B
SYNOPSIS
This section receives a special treatment to identify command
name, flags and arguments, and propagate corresponding
attributes later in the text. If a C like function is recognized
(word immediately followed by an open parenthesis), \fBtxt2man\fP will
print function name in bold font, types in normal font, and
variables in italic font. The whole section will be printed using
a fixed font family (courier) whenever possible (troff).
.PP
It is a good practice to embed documentation into source code, by using
comments or constant text variables. \fBtxt2man\fP allows one to do that, keeping
the document source readable, usable even without further formatting
(i.e. for online help) and easy to write. The result is high quality
and standard complying document.
.SH OPTIONS
.TP
.B
\fB-h\fP
The option \fB-h\fP displays help.
.TP
.B
\fB-d\fP \fIdate\fP
Set \fIdate\fP in header. Defaults to current \fIdate\fP.
.TP
.B
\fB-P\fP \fIpname\fP
Set \fIpname\fP as project name in header. Default to uname \fB-s\fP.
.TP
.B
\fB-p\fP
Probe title, section name and volume.
.TP
.B
\fB-t\fP \fImytitle\fP
Set \fImytitle\fP as title of generated man page.
.TP
.B
\fB-r\fP \fIrel\fP
Set \fIrel\fP as project name and release.
.TP
.B
\fB-s\fP \fIsect\fP
Set \fIsect\fP as section in heading, usually a value from 1 to 8.
.TP
.B
\fB-v\fP \fIvol\fP
Set \fIvol\fP as volume name, i.e. "Unix user 's manual".
.TP
.B
\fB-I\fP \fItxt\fP
Italicize \fItxt\fP in output. Can be specified more than once.
.TP
.B
\fB-B\fP \fItxt\fP
Emphasize (bold) \fItxt\fP in output. Can be specified more than once.
.TP
.B
\fB-T\fP
Text result previewing using PAGER, usually \fBmore\fP(1).
.TP
.B
\fB-X\fP
X11 result previewing using \fBgxditview\fP(1).
.SH ENVIRONMENT
.TP
.B
PAGER
name of paging command, usually \fBmore\fP(1), or \fBless\fP(1). If not set
falls back to \fBmore\fP(1).
.TP
.B
SOURCE_DATE_EPOCH
Unix timestamp that is used for \fIdate\fP in header instead
of current \fIdate\fP.
.SH EXAMPLES
Try this command to format this text itself:
.PP
.nf
.fam C
    $ txt2man -h 2>&1 | txt2man -T

.fam T
.fi
The following command will generate a manpage level 1 to foo-1.1.0 program,
from foo.txt file, used as source code to previously mentioned manpage:
.PP
.nf
.fam C
    $ txt2man -d "15 May 2016" -t foo -r foo-1.1.0 -s 1 -v "show stars on screen" foo.txt > foo.1
.fam T
.fi
.SH HINTS
To obtain an overall good formatting of output document, keep paragraphs
indented correctly. If you have unwanted bold sections, search for
multiple spaces between words, which are used to identify a tag list
(term followed by a description). Choose also carefully the name of
command line or function parameters, as they will be emphasized each
time they are encountered in the document.
.SH SEE ALSO
\fBman\fP(1), \fBmandoc\fP(7), \fBrman\fP(1), \fBgroff\fP(1), \fBmore\fP(1), \fBgxditview\fP(1), \fBtroff\fP(1).
.SH BUGS
.IP \(bu 3
Automatic probe (\fB-p\fP option) works only if input is a regular file (i.e.
not stdin).
.SH AUTHOR
Marc Vertes <mvertes@free.fr>