kramdown-man 0.1.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +4 -9
- data/.gitignore +4 -3
- data/.yardopts +1 -1
- data/ChangeLog.md +61 -0
- data/Gemfile +6 -3
- data/LICENSE.txt +1 -1
- data/README.md +156 -57
- data/Rakefile +1 -1
- data/bin/kramdown-man +3 -12
- data/gemspec.yml +7 -0
- data/kramdown-man.gemspec +2 -1
- data/lib/kramdown/man/cli.rb +202 -0
- data/lib/kramdown/{converter/man.rb → man/converter.rb} +328 -89
- data/lib/kramdown/man/task.rb +3 -1
- data/lib/kramdown/man/version.rb +3 -1
- data/lib/kramdown/man.rb +28 -3
- data/man/kramdown-man.1 +203 -101
- data/man/kramdown-man.1.md +102 -27
- data/spec/cli_spec.rb +218 -0
- data/spec/converter_spec.rb +969 -0
- data/spec/{kramdown/document_spec.rb → integration_spec.rb} +3 -3
- data/spec/{kramdown/man_spec.rb → man_spec.rb} +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +18 -11
- data/spec/kramdown/converter/man_spec.rb +0 -562
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d53e0152c21c6a0e3e32b4f2dc2d185577eb01f34cd9cbfb8a300e5077e6648
|
4
|
+
data.tar.gz: c825469b0addc74ff69b1d1b53c54021d7020e9ae7284b94913187d58a61e6a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa320fdff23430cb680ad6aadae1b52a79a9eb78bd42ab58b802460c23892f0597a3b536744ffc40584c3309c441a6f8671a37ba9a149653f7ff27ced654f90d
|
7
|
+
data.tar.gz: 69465385b9ec09efcbe01ccb45c014c47dc04485687682167a68dc0f700e3009a34080d0048ffbc3612991fee9dc16f7445dca7078ab52c0c35860ec798a9f89
|
data/.github/workflows/ruby.yml
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
name: CI
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ master ]
|
6
|
-
pull_request:
|
7
|
-
branches: ['**']
|
3
|
+
on: [ push, pull_request ]
|
8
4
|
|
9
5
|
jobs:
|
10
6
|
tests:
|
@@ -13,12 +9,11 @@ jobs:
|
|
13
9
|
fail-fast: false
|
14
10
|
matrix:
|
15
11
|
ruby:
|
16
|
-
- 2.4
|
17
|
-
- 2.5
|
18
|
-
- 2.6
|
19
|
-
- 2.7
|
20
12
|
- 3.0
|
13
|
+
- 3.1
|
14
|
+
- 3.2
|
21
15
|
- jruby
|
16
|
+
- truffleruby
|
22
17
|
name: Ruby ${{ matrix.ruby }}
|
23
18
|
steps:
|
24
19
|
- uses: actions/checkout@v2
|
data/.gitignore
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
Gemfile.lock
|
2
|
-
|
3
|
-
|
1
|
+
/Gemfile.lock
|
2
|
+
/coverage/
|
3
|
+
/doc/
|
4
|
+
/pkg/
|
data/.yardopts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--markup markdown --
|
1
|
+
--markup markdown --title "kramdown-man Documentation" --protected
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,64 @@
|
|
1
|
+
### 1.0.0 / 2023-12-03
|
2
|
+
|
3
|
+
* Ignore `kd:blank` elements to reduce size of generated man pages.
|
4
|
+
* No longer output `.HP` paragraphs due to cross-platform compatibility issues
|
5
|
+
with `groff`, `nroff`, `troff`.
|
6
|
+
* Renamed `Kramdown::Converters::Man` to {Kramdown::Man::Converter}.
|
7
|
+
* Override {Kramdown::Document#to_man} to use our {Kramdown::Man::Converter}.
|
8
|
+
|
9
|
+
#### Syntax
|
10
|
+
|
11
|
+
* Added support for definition lists.
|
12
|
+
* Switched to using definition lists for documenting options and arguments.
|
13
|
+
|
14
|
+
```markdown
|
15
|
+
## ARGUMENTS
|
16
|
+
|
17
|
+
*ARG*
|
18
|
+
: Description goes here.
|
19
|
+
|
20
|
+
...
|
21
|
+
```
|
22
|
+
|
23
|
+
```markdown
|
24
|
+
## OPTIONS
|
25
|
+
|
26
|
+
`-o`, `--option` *VALUE
|
27
|
+
: Description goes here.
|
28
|
+
|
29
|
+
...
|
30
|
+
```
|
31
|
+
* Added support for rendering relative links to other markdown man pages
|
32
|
+
as `SEE ALSO` man page references.
|
33
|
+
|
34
|
+
Example:
|
35
|
+
|
36
|
+
```markdown
|
37
|
+
[foo-bar](foo-bar.1.md)
|
38
|
+
```
|
39
|
+
|
40
|
+
Will be converted into:
|
41
|
+
|
42
|
+
```
|
43
|
+
foo-bar(1)
|
44
|
+
```
|
45
|
+
* Ignore horizontal rule elements due to cross-platform compatibility issues
|
46
|
+
with `groff`, `nroff`, `troff`.
|
47
|
+
|
48
|
+
#### CLI
|
49
|
+
|
50
|
+
* Added the `-o`, `--output FILE` option.
|
51
|
+
* Added the `-V`, `--version` option.
|
52
|
+
* Display the `kramdown-man.1` man page when `--help` is given, if STDOUT is
|
53
|
+
a TTY. If STDOUT is not a TTY, then the usual `--help` information will be
|
54
|
+
printed.
|
55
|
+
|
56
|
+
### 0.1.9 / 2023-12-01
|
57
|
+
|
58
|
+
* Allow markdown `man:file.ext` style links, since man pages can be named after
|
59
|
+
file names (ex: `shard.yml`).
|
60
|
+
* Use the `.PP` roff macro instead of the deprecated `.HP` macro.
|
61
|
+
|
1
62
|
### 0.1.8 / 2020-12-26
|
2
63
|
|
3
64
|
* Upgrade to kramdown 2.x.
|
data/Gemfile
CHANGED
@@ -4,7 +4,10 @@ gemspec
|
|
4
4
|
|
5
5
|
group :development do
|
6
6
|
gem 'rake'
|
7
|
-
gem 'rubygems-tasks',
|
8
|
-
gem 'rspec',
|
9
|
-
gem '
|
7
|
+
gem 'rubygems-tasks', '~> 0.2'
|
8
|
+
gem 'rspec', '~> 3.0'
|
9
|
+
gem 'simplecov', '~> 0.20'
|
10
|
+
gem 'redcarpet', platform: :mri
|
11
|
+
gem 'yard', '~> 0.9'
|
12
|
+
gem 'dead_end', require: false
|
10
13
|
end
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# kramdown-man
|
2
2
|
|
3
|
+
[![CI](https://github.com/postmodern/kramdown-man/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/kramdown-man/actions/workflows/ruby.yml)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/postmodern/kramdown-man.svg)](https://codeclimate.com/github/postmodern/kramdown-man)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/kramdown-man.svg)](https://badge.fury.io/rb/kramdown-man)
|
6
|
+
|
3
7
|
* [Homepage](https://github.com/postmodern/kramdown-man#readme)
|
4
8
|
* [Issues](https://github.com/postmodern/kramdown-man/issues)
|
5
9
|
* [Documentation](http://rubydoc.info/gems/kramdown-man/frames)
|
6
|
-
* [Email](mailto:postmodern.mod3 at gmail.com)
|
7
10
|
|
8
11
|
## Description
|
9
12
|
|
@@ -12,123 +15,209 @@ A [Kramdown][kramdown] convert for converting Markdown files into man pages.
|
|
12
15
|
## Features
|
13
16
|
|
14
17
|
* Converts markdown to [roff]:
|
15
|
-
* Supports codespans, emphasis and strong fonts.
|
16
|
-
* Supports normal
|
17
|
-
* Supports
|
18
|
+
* Supports codespans, emphasis, and strong fonts.
|
19
|
+
* Supports normal and tagged paragraphs.
|
20
|
+
* Supports codeblocks and blockquotes.
|
21
|
+
* Supports bullet, numbered, and definition lists.
|
18
22
|
* Supports multi-paragraph list items and blockquotes.
|
19
|
-
* Supports
|
20
|
-
|
23
|
+
* Supports converting `[foo-bar](foo-bar.1.md)` and `[bash](man:bash(1))`
|
24
|
+
links into `SEE ALSO` man page references.
|
21
25
|
* Provides Rake task for converting `man/*.md` into man pages.
|
22
26
|
* Uses the pure-Ruby [Kramdown][kramdown] markdown parser.
|
23
|
-
* Supports [Ruby]
|
27
|
+
* Supports [Ruby] 3.x, [JRuby], and [TruffleRuby].
|
24
28
|
|
25
29
|
## Synopsis
|
26
30
|
|
31
|
+
```
|
32
|
+
usage: kramdown-man [options] MARKDOWN_FILE
|
33
|
+
-o, --output FILE Write the man page output to the file
|
34
|
+
-V, --version Print the version
|
35
|
+
-h, --help Print the help output
|
36
|
+
|
37
|
+
Examples:
|
38
|
+
kramdown-man -o man/myprogram.1 man/myprogram.1.md
|
39
|
+
kramdown-man man/myprogram.1.md
|
40
|
+
|
41
|
+
```
|
42
|
+
|
27
43
|
Render a man page from markdown:
|
28
44
|
|
29
|
-
|
45
|
+
```shell
|
46
|
+
kramdown-man -o man/myprogram.1 man/myprogram.1.md
|
47
|
+
```
|
48
|
+
|
49
|
+
Preview the rendered man page:
|
50
|
+
|
51
|
+
```shell
|
52
|
+
kramdown-man man/myprogram.1.md
|
53
|
+
```
|
30
54
|
|
31
55
|
## Examples
|
32
56
|
|
33
57
|
Render a man page from a markdown file:
|
34
58
|
|
35
|
-
|
59
|
+
```ruby
|
60
|
+
require 'kramdown/man'
|
36
61
|
|
37
|
-
|
38
|
-
|
62
|
+
doc = Kramdown::Document.new(File.read('man/kramdown-man.1.md'))
|
63
|
+
File.write('man/kramdown-man.1',doc.to_man)
|
39
64
|
|
40
|
-
|
65
|
+
system 'man', 'man/kramdown-man.1'
|
66
|
+
```
|
41
67
|
|
42
68
|
Define a `man` and file tasks which render all `*.md` files within the
|
43
69
|
`man/` directory:
|
44
70
|
|
45
|
-
|
46
|
-
|
71
|
+
```ruby
|
72
|
+
require 'kramdown/man/task'
|
73
|
+
Kramdown::Man::Task.new
|
74
|
+
```
|
47
75
|
|
48
76
|
## Syntax
|
49
77
|
|
50
|
-
###
|
78
|
+
### Code
|
51
79
|
|
52
|
-
|
80
|
+
```markdown
|
81
|
+
`code`
|
82
|
+
```
|
53
83
|
|
54
84
|
`code`
|
55
85
|
|
56
|
-
|
86
|
+
### Emphasis
|
57
87
|
|
88
|
+
```markdown
|
58
89
|
*emphasis*
|
90
|
+
```
|
59
91
|
|
60
|
-
|
92
|
+
*emphasis*
|
93
|
+
|
94
|
+
### Strong
|
95
|
+
|
96
|
+
```markdown
|
97
|
+
**strong**
|
98
|
+
```
|
61
99
|
|
62
100
|
**strong**
|
63
101
|
|
64
|
-
###
|
102
|
+
### Paragraph
|
65
103
|
|
66
|
-
|
104
|
+
```markdown
|
105
|
+
Normal paragraph.
|
106
|
+
```
|
67
107
|
|
68
108
|
Normal paragraph.
|
69
109
|
|
70
|
-
|
110
|
+
#### Usage String
|
111
|
+
|
112
|
+
```markdown
|
113
|
+
`command` [`--foo`] **FILE**
|
114
|
+
```
|
71
115
|
|
72
|
-
`command` [`--foo`]
|
116
|
+
`command` [`--foo`] **FILE**
|
73
117
|
|
74
|
-
|
75
|
-
Text here.
|
118
|
+
#### Argument Definitions
|
76
119
|
|
77
|
-
|
78
|
-
|
120
|
+
```markdown
|
121
|
+
*ARG*
|
122
|
+
: Description here.
|
123
|
+
```
|
124
|
+
|
125
|
+
*ARG*
|
126
|
+
: Description here.
|
127
|
+
|
128
|
+
#### Option Definitions
|
129
|
+
|
130
|
+
```markdown
|
131
|
+
`-o`, `--option` *VALUE*
|
132
|
+
: Description here.
|
133
|
+
```
|
134
|
+
|
135
|
+
`-o`, `--option` *VALUE*
|
136
|
+
: Description here.
|
79
137
|
|
80
138
|
### Links
|
81
139
|
|
82
|
-
|
140
|
+
```markdown
|
141
|
+
[website](http://example.com/)
|
142
|
+
```
|
83
143
|
|
84
144
|
[website](http://example.com/)
|
85
145
|
|
86
|
-
|
146
|
+
#### Man Pages
|
147
|
+
|
148
|
+
Link to other man pages in a project:
|
87
149
|
|
150
|
+
```markdown
|
151
|
+
[kramdown-man](kramdown-man.1.md)
|
152
|
+
```
|
153
|
+
|
154
|
+
[kramdown-man](https://github.com/postmodern/kramdown-man/blob/main/man/kramdown-man.1.md)
|
155
|
+
|
156
|
+
Link to other system man page:
|
157
|
+
|
158
|
+
```markdown
|
88
159
|
[bash](man:bash(1))
|
160
|
+
```
|
161
|
+
|
162
|
+
[bash](man:bash(1))
|
163
|
+
|
164
|
+
**Note:** only works on [firefox] on Linux.
|
89
165
|
|
90
|
-
|
166
|
+
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
167
|
+
|
168
|
+
#### Email Addresses
|
169
|
+
|
170
|
+
```markdown
|
171
|
+
Email <bob@example.com>
|
172
|
+
```
|
91
173
|
|
92
174
|
Email <bob@example.com>
|
93
175
|
|
94
176
|
### Lists
|
95
177
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
178
|
+
```markdown
|
179
|
+
* one
|
180
|
+
* two
|
181
|
+
* three
|
182
|
+
```
|
102
183
|
|
103
184
|
* one
|
104
185
|
* two
|
105
186
|
* three
|
106
187
|
|
107
|
-
|
188
|
+
#### Numbered Lists
|
108
189
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
190
|
+
```markdown
|
191
|
+
1. one
|
192
|
+
2. two
|
193
|
+
3. three
|
194
|
+
```
|
114
195
|
|
115
196
|
1. one
|
116
197
|
2. two
|
117
198
|
3. three
|
118
199
|
|
119
|
-
|
200
|
+
#### Definition Lists
|
201
|
+
|
202
|
+
```markdown
|
203
|
+
ex·am·ple
|
204
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
120
205
|
|
121
|
-
|
206
|
+
: a person or thing regarded in terms of their fitness to be imitated or the likelihood of their being imitated.
|
207
|
+
```
|
122
208
|
|
123
|
-
|
209
|
+
ex·am·ple
|
210
|
+
: a thing characteristic of its kind or illustrating a general rule.
|
124
211
|
|
125
|
-
|
212
|
+
: a person or thing regarded in terms of their fitness to be imitated or the likelihood of their being imitated.
|
126
213
|
|
127
214
|
### Blockquotes
|
128
215
|
|
129
|
-
|
130
|
-
|
131
|
-
|
216
|
+
```markdown
|
217
|
+
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
218
|
+
>
|
219
|
+
> --Antoine de Saint-Exupéry
|
220
|
+
```
|
132
221
|
|
133
222
|
> Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
|
134
223
|
>
|
@@ -136,13 +225,20 @@ Email <bob@example.com>
|
|
136
225
|
|
137
226
|
### Code Blocks
|
138
227
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
228
|
+
```markdown
|
229
|
+
Source code:
|
230
|
+
|
231
|
+
#include <stdio.h>
|
232
|
+
|
233
|
+
int main()
|
234
|
+
{
|
235
|
+
printf("hello world\n");
|
236
|
+
return 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
```
|
240
|
+
|
241
|
+
Source code:
|
146
242
|
|
147
243
|
#include <stdio.h>
|
148
244
|
|
@@ -158,7 +254,9 @@ Email <bob@example.com>
|
|
158
254
|
|
159
255
|
## Install
|
160
256
|
|
161
|
-
|
257
|
+
```shell
|
258
|
+
gem install kramdown-man
|
259
|
+
```
|
162
260
|
|
163
261
|
## Alternatives
|
164
262
|
|
@@ -168,7 +266,7 @@ Email <bob@example.com>
|
|
168
266
|
|
169
267
|
## Copyright
|
170
268
|
|
171
|
-
Copyright (c) 2013-
|
269
|
+
Copyright (c) 2013-2023 Hal Brodigan
|
172
270
|
|
173
271
|
See {file:LICENSE.txt} for details.
|
174
272
|
|
@@ -177,3 +275,4 @@ See {file:LICENSE.txt} for details.
|
|
177
275
|
|
178
276
|
[Ruby]: http://www.ruby-lang.org/
|
179
277
|
[JRuby]: http://jruby.org/
|
278
|
+
[TruffleRuby]: https://github.com/oracle/truffleruby#readme
|
data/Rakefile
CHANGED
data/bin/kramdown-man
CHANGED
@@ -1,16 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
lib_dir = File.expand_path('../lib',
|
3
|
+
lib_dir = File.expand_path('../lib',__dir__)
|
4
4
|
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
5
5
|
|
6
|
-
require 'kramdown'
|
7
|
-
|
8
|
-
|
9
|
-
case ARGV[0]
|
10
|
-
when '-h', '--help'
|
11
|
-
warn "usage: #{File.dirname($0)} <INPUT.md >OUTPUT"
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
doc = Kramdown::Document.new(ARGF.read)
|
16
|
-
puts doc.to_man
|
6
|
+
require 'kramdown/man/cli'
|
7
|
+
exit Kramdown::Man::CLI.run(ARGV)
|
data/gemspec.yml
CHANGED
@@ -6,6 +6,13 @@ authors: Postmodern
|
|
6
6
|
email: postmodern.mod3@gmail.com
|
7
7
|
homepage: https://github.com/postmodern/kramdown-man#readme
|
8
8
|
|
9
|
+
metadata:
|
10
|
+
documentation_uri: https://rubydoc.info/gems/kramdown-man
|
11
|
+
source_code_uri: https://github.com/postmodern/kramdown-man
|
12
|
+
bug_tracker_uri: https://github.com/postmodern/kramdown-man/issues
|
13
|
+
changelog_uri: https://github.com/postmodern/kramdown-man/blob/master/ChangeLog.md
|
14
|
+
rubygems_mfa_required: 'true'
|
15
|
+
|
9
16
|
dependencies:
|
10
17
|
kramdown: ~> 2.0
|
11
18
|
|
data/kramdown-man.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'yaml'
|
4
4
|
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.authors = Array(gemspec['authors'])
|
21
21
|
gem.email = gemspec['email']
|
22
22
|
gem.homepage = gemspec['homepage']
|
23
|
+
gem.metadata = gemspec['metadata'] if gemspec['metadata']
|
23
24
|
|
24
25
|
glob = lambda { |patterns| gem.files & Dir[*patterns] }
|
25
26
|
|