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