kramdown-man 0.1.9 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -3
- data/.yardopts +1 -1
- data/ChangeLog.md +66 -0
- data/Gemfile +6 -3
- data/README.md +176 -62
- data/bin/kramdown-man +3 -12
- data/gemspec.yml +5 -2
- data/lib/kramdown/man/cli.rb +202 -0
- data/lib/kramdown/{converter/man.rb → man/converter.rb} +334 -88
- data/lib/kramdown/man/task.rb +1 -1
- data/lib/kramdown/man/version.rb +1 -1
- data/lib/kramdown/man.rb +26 -3
- data/man/kramdown-man.1 +205 -113
- data/man/kramdown-man.1.md +100 -32
- data/spec/cli_spec.rb +223 -0
- data/spec/converter_spec.rb +993 -0
- data/spec/{document_spec.rb → integration_spec.rb} +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +11 -7
- data/spec/converter/man_spec.rb +0 -579
data/man/kramdown-man.1
CHANGED
@@ -1,133 +1,197 @@
|
|
1
|
-
.\" Generated by kramdown-man 0.
|
1
|
+
.\" Generated by kramdown-man 1.0.0
|
2
2
|
.\" https://github.com/postmodern/kramdown-man#readme
|
3
|
-
.TH kramdown-man
|
4
|
-
.
|
3
|
+
.TH kramdown-man 1 "April 2013" kramdown-man "User Manuals"
|
4
|
+
.SH NAME
|
5
|
+
.PP
|
6
|
+
kramdown\-man \- generates man pages from markdown files
|
5
7
|
.SH SYNOPSIS
|
6
|
-
.LP
|
7
8
|
.PP
|
8
|
-
\fBkramdown
|
9
|
-
.LP
|
9
|
+
\fBkramdown\-man\fR \[lB]\fIoptions\fP\[rB] \fIMARKDOWN\[ru]FILE\fP
|
10
10
|
.SH DESCRIPTION
|
11
|
-
.LP
|
12
11
|
.PP
|
13
12
|
A Kramdown
|
14
13
|
.UR http:\[sl]\[sl]kramdown\.gettalong\.org\[sl]
|
15
|
-
.UE
|
16
|
-
|
14
|
+
.UE
|
15
|
+
plugin for converting Markdown files into man pages\.
|
17
16
|
.SH ARGUMENTS
|
18
|
-
.LP
|
19
17
|
.TP
|
20
|
-
\
|
18
|
+
\fIMARKDOWN\[ru]FILE\fP
|
21
19
|
The input markdown file to convert\.
|
22
|
-
.LP
|
23
|
-
.TP
|
24
|
-
\fIOUTPUT\fP
|
25
|
-
The output file for the man page\.
|
26
|
-
.LP
|
27
20
|
.SH OPTIONS
|
28
|
-
.LP
|
29
21
|
.TP
|
30
|
-
\fB
|
31
|
-
|
32
|
-
.
|
22
|
+
\fB\-o\fR, \fB\-\-output\fR \fIOUTPUT\fP
|
23
|
+
The file to write the man page output to\.
|
24
|
+
.TP
|
25
|
+
\fB\-V\fR, \fB\-\-version\fR
|
26
|
+
Prints the \fBkramdown\-man\fR version\.
|
27
|
+
.TP
|
28
|
+
\fB\-h\fR, \fB\-\-help\fR
|
29
|
+
Prints the usage for \fBkramdown\-man\fR\.
|
33
30
|
.SH EXAMPLE
|
34
|
-
.
|
35
|
-
|
31
|
+
.PP
|
32
|
+
Render a man page from markdown:
|
33
|
+
.PP
|
34
|
+
.RS 4
|
35
|
+
.EX
|
36
|
+
\[Do] kramdown\-man \-o man\[sl]myprogram\.1 man\[sl]myprogram\.1\.md
|
37
|
+
.EE
|
38
|
+
.RE
|
39
|
+
.PP
|
40
|
+
Preview the rendered man page:
|
41
|
+
.PP
|
42
|
+
.RS 4
|
43
|
+
.EX
|
44
|
+
\[Do] kramdown\-man man\[sl]myprogram\.1\.md
|
45
|
+
.EE
|
46
|
+
.RE
|
47
|
+
.SS RUBY
|
48
|
+
.PP
|
49
|
+
.RS 4
|
50
|
+
.EX
|
36
51
|
require \(aqkramdown\(aq
|
37
52
|
require \(aqkramdown\[sl]man\(aq
|
38
53
|
|
39
54
|
doc \[eq] Kramdown::Document\.new(File\.read(\(aqman\[sl]kramdown\-man\.1\.md\(aq))
|
40
55
|
File\.write(\(aqman\[sl]kramdown\-man\.1\(aq,doc\.to\[ru]man)
|
41
56
|
system \(aqman\(aq, \(aqman\[sl]kramdown\-man\.1\(aq
|
42
|
-
.
|
43
|
-
.
|
57
|
+
.EE
|
58
|
+
.RE
|
59
|
+
.SS RAKE TASK
|
60
|
+
.PP
|
61
|
+
Define a \fBman\fR and files tasks which render all \fB*\.md\fR files within the
|
62
|
+
\fBman\[sl]\fR directory:
|
63
|
+
.PP
|
64
|
+
.RS 4
|
65
|
+
.EX
|
66
|
+
require \(aqkramdown\[sl]man\[sl]task\(aq
|
67
|
+
Kramdown::Man::Task\.new
|
68
|
+
.EE
|
69
|
+
.RE
|
44
70
|
.SH SYNTAX
|
45
|
-
.
|
46
|
-
.
|
47
|
-
.
|
48
|
-
.
|
71
|
+
.SS Code
|
72
|
+
.PP
|
73
|
+
.RS 4
|
74
|
+
.EX
|
49
75
|
\`code\`
|
50
|
-
.
|
51
|
-
.
|
76
|
+
.EE
|
77
|
+
.RE
|
52
78
|
.PP
|
53
79
|
\fBcode\fR
|
54
|
-
.
|
55
|
-
.
|
80
|
+
.SS Emphasis
|
81
|
+
.PP
|
82
|
+
.RS 4
|
83
|
+
.EX
|
56
84
|
*emphasis*
|
57
|
-
.
|
58
|
-
.
|
85
|
+
.EE
|
86
|
+
.RE
|
59
87
|
.PP
|
60
88
|
\fIemphasis\fP
|
61
|
-
.
|
62
|
-
.
|
89
|
+
.SS Strong
|
90
|
+
.PP
|
91
|
+
.RS 4
|
92
|
+
.EX
|
63
93
|
**strong**
|
64
|
-
.
|
65
|
-
.
|
94
|
+
.EE
|
95
|
+
.RE
|
66
96
|
.PP
|
67
97
|
\fBstrong\fP
|
68
|
-
.
|
69
|
-
.
|
70
|
-
.
|
71
|
-
.
|
98
|
+
.SS Paragraph
|
99
|
+
.PP
|
100
|
+
.RS 4
|
101
|
+
.EX
|
72
102
|
Normal paragraph\.
|
73
|
-
.
|
74
|
-
.
|
103
|
+
.EE
|
104
|
+
.RE
|
75
105
|
.PP
|
76
106
|
Normal paragraph\.
|
77
|
-
.
|
78
|
-
.
|
107
|
+
.SS Usage String
|
108
|
+
.PP
|
109
|
+
.RS 4
|
110
|
+
.EX
|
79
111
|
\`command\` \[lB]\`\-\-foo\`\[rB] **FILE**
|
80
|
-
.
|
81
|
-
.
|
82
|
-
.PP
|
83
|
-
\fBcommand\fR \[lB]\fB
|
84
|
-
.
|
85
|
-
.
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
112
|
+
.EE
|
113
|
+
.RE
|
114
|
+
.PP
|
115
|
+
\fBcommand\fR \[lB]\fB\-\-foo\fR\[rB] \fBFILE\fP
|
116
|
+
.SS Argument Definitions
|
117
|
+
.PP
|
118
|
+
.RS 4
|
119
|
+
.EX
|
120
|
+
*ARG*
|
121
|
+
: Description here\.
|
122
|
+
.EE
|
123
|
+
.RE
|
124
|
+
.TP
|
125
|
+
\fIARG\fP
|
126
|
+
Description here\.
|
127
|
+
.SS Option Definitions
|
128
|
+
.PP
|
129
|
+
.RS 4
|
130
|
+
.EX
|
131
|
+
\`\-o\`, \`\-\-option\` *VALUE*
|
132
|
+
: Description here\.
|
133
|
+
.EE
|
134
|
+
.RE
|
90
135
|
.TP
|
91
|
-
\fB
|
92
|
-
|
93
|
-
.
|
94
|
-
.
|
95
|
-
.
|
96
|
-
.
|
136
|
+
\fB\-o\fR, \fB\-\-option\fR \fIVALUE\fP
|
137
|
+
Description here\.
|
138
|
+
.SS Links
|
139
|
+
.PP
|
140
|
+
.RS 4
|
141
|
+
.EX
|
97
142
|
\[lB]website\[rB](http:\[sl]\[sl]example\.com\[sl])
|
98
|
-
.
|
99
|
-
.
|
143
|
+
.EE
|
144
|
+
.RE
|
100
145
|
.PP
|
101
146
|
website
|
102
147
|
.UR http:\[sl]\[sl]example\.com\[sl]
|
103
148
|
.UE
|
104
|
-
.
|
105
|
-
.
|
149
|
+
.SS Man Pages
|
150
|
+
.PP
|
151
|
+
Link to other man pages in a project:
|
152
|
+
.PP
|
153
|
+
.RS 4
|
154
|
+
.EX
|
155
|
+
\[lB]kramdown\-man\[rB](kramdown\-man\.1\.md)
|
156
|
+
.EE
|
157
|
+
.RE
|
158
|
+
.PP
|
159
|
+
.BR kramdown\-man (1)
|
160
|
+
.PP
|
161
|
+
Link to other system man page:
|
162
|
+
.PP
|
163
|
+
.RS 4
|
164
|
+
.EX
|
106
165
|
\[lB]bash\[rB](man:bash(1))
|
107
|
-
.
|
108
|
-
.
|
166
|
+
.EE
|
167
|
+
.RE
|
109
168
|
.PP
|
110
169
|
.BR bash (1)
|
111
|
-
.
|
112
|
-
|
170
|
+
.PP
|
171
|
+
\fBNote:\fP only works on firefox
|
172
|
+
.UR https:\[sl]\[sl]www\.mozilla\.org\[sl]en\-US\[sl]firefox\[sl]new\[sl]
|
173
|
+
.UE
|
174
|
+
on Linux\.
|
175
|
+
.SS Email Addresses
|
176
|
+
.PP
|
177
|
+
.RS 4
|
178
|
+
.EX
|
113
179
|
Email <bob\[at]example\.com>
|
114
|
-
.
|
115
|
-
.
|
180
|
+
.EE
|
181
|
+
.RE
|
116
182
|
.PP
|
117
183
|
Email
|
118
184
|
.MT bob\[at]example\.com
|
119
185
|
.ME
|
120
|
-
.
|
121
|
-
.
|
122
|
-
.
|
123
|
-
.
|
186
|
+
.SS Lists
|
187
|
+
.PP
|
188
|
+
.RS 4
|
189
|
+
.EX
|
124
190
|
* one
|
125
191
|
* two
|
126
192
|
* three
|
127
|
-
|
128
|
-
|
129
|
-
.fi
|
130
|
-
.LP
|
193
|
+
.EE
|
194
|
+
.RE
|
131
195
|
.RS
|
132
196
|
.IP \(bu 2
|
133
197
|
one
|
@@ -135,10 +199,16 @@ one
|
|
135
199
|
two
|
136
200
|
.IP \(bu 2
|
137
201
|
three
|
138
|
-
.IP \( 2
|
139
|
-
extra paragraph
|
140
202
|
.RE
|
141
|
-
.
|
203
|
+
.SS Numbered Lists
|
204
|
+
.PP
|
205
|
+
.RS 4
|
206
|
+
.EX
|
207
|
+
1\. one
|
208
|
+
2\. two
|
209
|
+
3\. three
|
210
|
+
.EE
|
211
|
+
.RE
|
142
212
|
.nr step1 0 1
|
143
213
|
.RS
|
144
214
|
.IP \n+[step1]
|
@@ -147,43 +217,51 @@ one
|
|
147
217
|
two
|
148
218
|
.IP \n+[step1]
|
149
219
|
three
|
150
|
-
.
|
151
|
-
|
152
|
-
.
|
153
|
-
.
|
154
|
-
.
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
.
|
161
|
-
|
162
|
-
.
|
163
|
-
|
164
|
-
|
165
|
-
.
|
220
|
+
.RE
|
221
|
+
.SS Definition Lists
|
222
|
+
.PP
|
223
|
+
.RS 4
|
224
|
+
.EX
|
225
|
+
ex\[pc]am\[pc]ple
|
226
|
+
: a thing characteristic of its kind or illustrating a general rule\.
|
227
|
+
|
228
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
229
|
+
likelihood of their being imitated\.
|
230
|
+
.EE
|
231
|
+
.RE
|
232
|
+
.TP
|
233
|
+
ex\[pc]am\[pc]ple
|
234
|
+
a thing characteristic of its kind or illustrating a general rule\.
|
235
|
+
.RS
|
236
|
+
.PP
|
237
|
+
a person or thing regarded in terms of their fitness to be imitated or the
|
238
|
+
likelihood of their being imitated\.
|
239
|
+
.RE
|
240
|
+
.SS Blockquotes
|
241
|
+
.PP
|
242
|
+
.RS 4
|
243
|
+
.EX
|
166
244
|
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away\.
|
167
245
|
>
|
168
246
|
> \-\-Antoine de Saint\-Exup\['e]ry
|
169
|
-
.
|
170
|
-
.
|
171
|
-
.PP
|
247
|
+
.EE
|
248
|
+
.RE
|
172
249
|
.RS
|
250
|
+
.PP
|
173
251
|
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away\.
|
174
|
-
.
|
252
|
+
.PP
|
175
253
|
\-\-Antoine de Saint\-Exup\['e]ry
|
176
254
|
.RE
|
177
|
-
.
|
178
|
-
.
|
179
|
-
.
|
180
|
-
.
|
255
|
+
.SS Code Blocks
|
256
|
+
.PP
|
257
|
+
.RS 4
|
258
|
+
.EX
|
181
259
|
\[sh]include <stdio\.h>
|
182
260
|
|
183
261
|
int main()
|
184
262
|
\[lC]
|
185
|
-
|
186
|
-
|
263
|
+
printf(\[dq]hello world\en\[dq]);
|
264
|
+
return 0;
|
187
265
|
\[rC]
|
188
266
|
|
189
267
|
\[sh]include <stdio\.h>
|
@@ -193,12 +271,26 @@ int main()
|
|
193
271
|
printf(\[dq]hello world\en\[dq]);
|
194
272
|
return 0;
|
195
273
|
\[rC]
|
196
|
-
.
|
197
|
-
.
|
274
|
+
.EE
|
275
|
+
.RE
|
276
|
+
.SS Code Fences
|
277
|
+
.PP
|
278
|
+
.RS 4
|
279
|
+
.EX
|
280
|
+
\`\`\`
|
281
|
+
puts \[dq]hello world\[dq]
|
282
|
+
\`\`\`
|
283
|
+
.EE
|
284
|
+
.RE
|
285
|
+
.PP
|
286
|
+
.PP
|
287
|
+
.RS 4
|
288
|
+
.EX
|
289
|
+
puts \[dq]hello world\[dq]
|
290
|
+
.EE
|
291
|
+
.RE
|
198
292
|
.SH AUTHOR
|
199
|
-
.LP
|
200
293
|
.PP
|
201
294
|
Postmodern
|
202
295
|
.MT postmodern\.mod3\[at]gmail\.com
|
203
296
|
.ME
|
204
|
-
.LP
|
data/man/kramdown-man.1.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
# kramdown-man
|
1
|
+
# kramdown-man 1 "April 2013" kramdown-man "User Manuals"
|
2
|
+
|
3
|
+
## NAME
|
4
|
+
|
5
|
+
kramdown-man - generates man pages from markdown files
|
2
6
|
|
3
7
|
## SYNOPSIS
|
4
8
|
|
5
|
-
`kramdown-man` [*options*]
|
9
|
+
`kramdown-man` [*options*] *MARKDOWN_FILE*
|
6
10
|
|
7
11
|
## DESCRIPTION
|
8
12
|
|
@@ -10,19 +14,32 @@ A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
|
|
10
14
|
|
11
15
|
## ARGUMENTS
|
12
16
|
|
13
|
-
*
|
14
|
-
|
15
|
-
|
16
|
-
*OUTPUT*
|
17
|
-
The output file for the man page.
|
17
|
+
*MARKDOWN_FILE*
|
18
|
+
: The input markdown file to convert.
|
18
19
|
|
19
20
|
## OPTIONS
|
20
21
|
|
22
|
+
`-o`, `--output` *OUTPUT*
|
23
|
+
: The file to write the man page output to.
|
24
|
+
|
25
|
+
`-V`, `--version`
|
26
|
+
: Prints the `kramdown-man` version.
|
27
|
+
|
21
28
|
`-h`, `--help`
|
22
|
-
|
29
|
+
: Prints the usage for `kramdown-man`.
|
23
30
|
|
24
31
|
## EXAMPLE
|
25
32
|
|
33
|
+
Render a man page from markdown:
|
34
|
+
|
35
|
+
$ kramdown-man -o man/myprogram.1 man/myprogram.1.md
|
36
|
+
|
37
|
+
Preview the rendered man page:
|
38
|
+
|
39
|
+
$ kramdown-man man/myprogram.1.md
|
40
|
+
|
41
|
+
### RUBY
|
42
|
+
|
26
43
|
require 'kramdown'
|
27
44
|
require 'kramdown/man'
|
28
45
|
|
@@ -30,86 +47,127 @@ A [Kramdown][kramdown] plugin for converting Markdown files into man pages.
|
|
30
47
|
File.write('man/kramdown-man.1',doc.to_man)
|
31
48
|
system 'man', 'man/kramdown-man.1'
|
32
49
|
|
50
|
+
### RAKE TASK
|
51
|
+
|
52
|
+
Define a `man` and files tasks which render all `*.md` files within the
|
53
|
+
`man/` directory:
|
54
|
+
|
55
|
+
require 'kramdown/man/task'
|
56
|
+
Kramdown::Man::Task.new
|
57
|
+
|
33
58
|
## SYNTAX
|
34
59
|
|
35
|
-
###
|
60
|
+
### Code
|
36
61
|
|
37
62
|
`code`
|
38
63
|
|
39
64
|
`code`
|
40
65
|
|
66
|
+
### Emphasis
|
67
|
+
|
41
68
|
*emphasis*
|
42
69
|
|
43
70
|
*emphasis*
|
44
71
|
|
72
|
+
### Strong
|
73
|
+
|
45
74
|
**strong**
|
46
75
|
|
47
76
|
**strong**
|
48
77
|
|
49
|
-
###
|
78
|
+
### Paragraph
|
50
79
|
|
51
80
|
Normal paragraph.
|
52
81
|
|
53
82
|
Normal paragraph.
|
54
83
|
|
84
|
+
#### Usage String
|
85
|
+
|
55
86
|
`command` [`--foo`] **FILE**
|
56
87
|
|
57
88
|
`command` [`--foo`] **FILE**
|
58
89
|
|
59
|
-
|
60
|
-
|
90
|
+
#### Argument Definitions
|
91
|
+
|
92
|
+
*ARG*
|
93
|
+
: Description here.
|
61
94
|
|
62
|
-
|
63
|
-
|
95
|
+
*ARG*
|
96
|
+
: Description here.
|
64
97
|
|
65
|
-
|
98
|
+
#### Option Definitions
|
99
|
+
|
100
|
+
`-o`, `--option` *VALUE*
|
101
|
+
: Description here.
|
102
|
+
|
103
|
+
`-o`, `--option` *VALUE*
|
104
|
+
: Description here.
|
105
|
+
|
106
|
+
### Links
|
66
107
|
|
67
108
|
[website](http://example.com/)
|
68
109
|
|
69
110
|
[website](http://example.com/)
|
70
111
|
|
112
|
+
#### Man Pages
|
113
|
+
|
114
|
+
Link to other man pages in a project:
|
115
|
+
|
116
|
+
[kramdown-man](kramdown-man.1.md)
|
117
|
+
|
118
|
+
[kramdown-man](kramdown-man.1.md)
|
119
|
+
|
120
|
+
Link to other system man page:
|
121
|
+
|
71
122
|
[bash](man:bash(1))
|
72
123
|
|
73
124
|
[bash](man:bash(1))
|
74
125
|
|
126
|
+
**Note:** only works on [firefox] on Linux.
|
127
|
+
|
128
|
+
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
129
|
+
|
130
|
+
#### Email Addresses
|
131
|
+
|
75
132
|
Email <bob@example.com>
|
76
133
|
|
77
134
|
Email <bob@example.com>
|
78
135
|
|
79
|
-
###
|
136
|
+
### Lists
|
80
137
|
|
81
138
|
* one
|
82
139
|
* two
|
83
140
|
* three
|
84
|
-
|
85
|
-
extra paragraph
|
86
|
-
|
87
141
|
|
88
142
|
* one
|
89
143
|
* two
|
90
144
|
* three
|
91
145
|
|
92
|
-
|
146
|
+
#### Numbered Lists
|
93
147
|
|
94
148
|
1. one
|
95
149
|
2. two
|
96
150
|
3. three
|
97
|
-
|
98
|
-
extra paragraph
|
99
|
-
|
151
|
+
|
100
152
|
1. one
|
101
153
|
2. two
|
102
154
|
3. three
|
103
155
|
|
104
|
-
|
156
|
+
#### Definition Lists
|
157
|
+
|
158
|
+
ex·am·ple
|
159
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
105
160
|
|
106
|
-
|
161
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
162
|
+
likelihood of their being imitated.
|
107
163
|
|
108
|
-
|
164
|
+
ex·am·ple
|
165
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
109
166
|
|
110
|
-
|
167
|
+
: a person or thing regarded in terms of their fitness to be imitated or the
|
168
|
+
likelihood of their being imitated.
|
111
169
|
|
112
|
-
###
|
170
|
+
### Blockquotes
|
113
171
|
|
114
172
|
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
115
173
|
>
|
@@ -119,14 +177,14 @@ Email <bob@example.com>
|
|
119
177
|
>
|
120
178
|
> --Antoine de Saint-Exupéry
|
121
179
|
|
122
|
-
###
|
180
|
+
### Code Blocks
|
123
181
|
|
124
182
|
#include <stdio.h>
|
125
|
-
|
183
|
+
|
126
184
|
int main()
|
127
185
|
{
|
128
|
-
|
129
|
-
|
186
|
+
printf("hello world\n");
|
187
|
+
return 0;
|
130
188
|
}
|
131
189
|
|
132
190
|
#include <stdio.h>
|
@@ -137,6 +195,16 @@ Email <bob@example.com>
|
|
137
195
|
return 0;
|
138
196
|
}
|
139
197
|
|
198
|
+
#### Code Fences
|
199
|
+
|
200
|
+
```
|
201
|
+
puts "hello world"
|
202
|
+
```
|
203
|
+
|
204
|
+
```
|
205
|
+
puts "hello world"
|
206
|
+
```
|
207
|
+
|
140
208
|
## AUTHOR
|
141
209
|
|
142
210
|
Postmodern <postmodern.mod3@gmail.com>
|