kramdown-man 0.1.5 → 0.1.6
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 +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -7
- data/ChangeLog.md +4 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/Rakefile +10 -32
- data/gemspec.yml +2 -1
- data/lib/kramdown/converter/man.rb +19 -19
- data/lib/kramdown/man/version.rb +1 -1
- data/man/kramdown-man.1 +3 -3
- data/man/kramdown-man.1.md +1 -1
- data/spec/kramdown/converter/man_spec.rb +58 -58
- data/spec/kramdown/man_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +37 -32
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 386f6adb2d234cffd25b37f8cc2fbce4657c3430
|
4
|
+
data.tar.gz: 3bb5849572fe71fe5e620307d083ddfdf17eabc5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: de7aef0dff59e658cc861d0e1e8c30847db607a3f5744c8059fae8be07dde75c71aec72549a3b6b1e1ec9b0c993e47c9e5734e78c19cc07973b88149ee724a14
|
7
|
+
data.tar.gz: 384cc17a480668ccf3e938acfa400d8d5fb6a3c56172f46c4fab609c7033a18cde19a20f2d0b51624238ac656e0f783d3274607fcab89234e3ce902b11a7f77f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install ffi rubygems-tasks rspec yard kramdown
|
4
2
|
rvm:
|
5
3
|
- 1.9.3
|
6
4
|
- 2.0.0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
- rbx-
|
11
|
-
script: rake spec
|
5
|
+
- 2.1.0
|
6
|
+
- 2.2.0
|
7
|
+
- jruby
|
8
|
+
- rbx-2
|
9
|
+
script: bundle exec rake spec
|
data/ChangeLog.md
CHANGED
data/Gemfile
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,7 @@ A [Kramdown][kramdown] convert for converting Markdown files into man pages.
|
|
22
22
|
* Supports converting `[bash](man:bash(1))` links into man page references.
|
23
23
|
* Provides Rake task for converting `man/*.md` into man pages.
|
24
24
|
* Uses the pure-Ruby [Kramdown][kramdown] markdown parser.
|
25
|
-
* Supports [Ruby] 1.
|
25
|
+
* Supports [Ruby] 1.9.x, 2.0.x, 2.1.x, 2.2.x, [JRuby], [Rubinius].
|
26
26
|
|
27
27
|
## Synopsis
|
28
28
|
|
@@ -170,11 +170,11 @@ Email <bob@example.com>
|
|
170
170
|
|
171
171
|
## Copyright
|
172
172
|
|
173
|
-
Copyright (c) 2013 Hal Brodigan
|
173
|
+
Copyright (c) 2013-2015 Hal Brodigan
|
174
174
|
|
175
175
|
See {file:LICENSE.txt} for details.
|
176
176
|
|
177
|
-
[kramdown]: http://kramdown.
|
177
|
+
[kramdown]: http://kramdown.gettalong.org/
|
178
178
|
[roff]: http://en.wikipedia.org/wiki/Roff
|
179
179
|
|
180
180
|
[Ruby]: http://www.ruby-lang.org/
|
data/Rakefile
CHANGED
@@ -1,45 +1,23 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
|
-
require 'rake'
|
5
|
-
|
6
3
|
begin
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Gem::Tasks.new
|
11
|
-
rescue LoadError => e
|
12
|
-
warn e.message
|
13
|
-
warn "Run `gem install rubygems-tasks` to install Gem::Tasks."
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError => error
|
6
|
+
abort error.message
|
14
7
|
end
|
15
8
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
RSpec::Core::RakeTask.new
|
21
|
-
rescue LoadError => e
|
22
|
-
task :spec do
|
23
|
-
abort "Please run `gem install rspec` to install RSpec."
|
24
|
-
end
|
25
|
-
end
|
9
|
+
require 'rake'
|
10
|
+
require 'rubygems/tasks'
|
11
|
+
Gem::Tasks.new
|
26
12
|
|
13
|
+
require 'rspec/core/rake_task'
|
14
|
+
RSpec::Core::RakeTask.new
|
27
15
|
task :test => :spec
|
28
16
|
task :default => :spec
|
29
17
|
|
30
|
-
|
31
|
-
|
32
|
-
require 'yard'
|
33
|
-
|
34
|
-
YARD::Rake::YardocTask.new
|
35
|
-
rescue LoadError => e
|
36
|
-
task :yard do
|
37
|
-
abort "Please run `gem install yard` to install YARD."
|
38
|
-
end
|
39
|
-
end
|
18
|
+
require 'yard'
|
19
|
+
YARD::Rake::YardocTask.new
|
40
20
|
task :doc => :yard
|
41
21
|
|
42
|
-
$LOAD_PATH.unshift(File.expand_path('lib'))
|
43
|
-
|
44
22
|
require 'kramdown/man/task'
|
45
23
|
Kramdown::Man::Task.new
|
data/gemspec.yml
CHANGED
@@ -20,7 +20,7 @@ module Kramdown
|
|
20
20
|
TYPOGRAPHIC_SYMS = {
|
21
21
|
:ndash => '\-\-',
|
22
22
|
:mdash => '\[em]',
|
23
|
-
:hellip => '
|
23
|
+
:hellip => '\.\.\.',
|
24
24
|
:laquo => '\[Fo]',
|
25
25
|
:raquo => '\[Fc]',
|
26
26
|
:laquo_space => '\[Fo]',
|
@@ -124,7 +124,7 @@ module Kramdown
|
|
124
124
|
'˝' => '\[a"]',
|
125
125
|
'¯' => '\[a-]',
|
126
126
|
'˙' => '\[a.]',
|
127
|
-
'^' => '\[a^]',
|
127
|
+
# '^' => '\[a^]',
|
128
128
|
'´' => "\\´",
|
129
129
|
'`' => '\`',
|
130
130
|
'˘' => '\[ab]',
|
@@ -132,7 +132,7 @@ module Kramdown
|
|
132
132
|
'¨' => '\[ad]',
|
133
133
|
'ˇ' => '\[ah]',
|
134
134
|
'˚' => '\[ao]',
|
135
|
-
'~' => '\(ti',
|
135
|
+
# '~' => '\(ti',
|
136
136
|
'˛' => '\[ho]',
|
137
137
|
'^' => '\(ha',
|
138
138
|
'~' => '\[ti]',
|
@@ -163,8 +163,8 @@ module Kramdown
|
|
163
163
|
'}' => '\[rC]',
|
164
164
|
'⟨' => '\[la]',
|
165
165
|
'⟩' => '\[ra]',
|
166
|
-
'⎪' => '\[bv]',
|
167
|
-
'⎪' => '\[braceex]',
|
166
|
+
# '⎪' => '\[bv]',
|
167
|
+
# '⎪' => '\[braceex]',
|
168
168
|
'⎡' => '\[bracketlefttp]',
|
169
169
|
'⎣' => '\[bracketleftbt]',
|
170
170
|
'⎢' => '\[bracketleftex]',
|
@@ -177,7 +177,7 @@ module Kramdown
|
|
177
177
|
'⎨' => '\[braceleftmid]',
|
178
178
|
'╰' => '\[lb]',
|
179
179
|
'⎩' => '\[braceleftbt]',
|
180
|
-
'⎪' => '\[braceleftex]',
|
180
|
+
# '⎪' => '\[braceleftex]',
|
181
181
|
'╮' => '\[rt]',
|
182
182
|
'⎫' => '\[bracerighttp]',
|
183
183
|
'┝' => '\[rk]',
|
@@ -206,9 +206,9 @@ module Kramdown
|
|
206
206
|
'⇕' => '\[vA]',
|
207
207
|
'⎯' => '\[an]',
|
208
208
|
# Lines
|
209
|
-
'|' => '\[ba]',
|
209
|
+
# '|' => '\[ba]',
|
210
210
|
'│' => '\[br]',
|
211
|
-
'_' => '\[ul]',
|
211
|
+
# '_' => '\[ul]',
|
212
212
|
'‾' => '\[rn]',
|
213
213
|
'_' => '\[ru]',
|
214
214
|
'¦' => '\[bb]',
|
@@ -216,7 +216,7 @@ module Kramdown
|
|
216
216
|
'\\' => '\e',
|
217
217
|
# Text markers
|
218
218
|
'○' => '\[ci]',
|
219
|
-
'·' => '\[bu]',
|
219
|
+
# '·' => '\[bu]',
|
220
220
|
'‡' => '\[dd]',
|
221
221
|
'†' => '\[dg]',
|
222
222
|
'◊' => '\[lz]',
|
@@ -236,7 +236,7 @@ module Kramdown
|
|
236
236
|
# Currency symbols
|
237
237
|
'$' => '\[Do]',
|
238
238
|
'¢' => '\[ct]',
|
239
|
-
'€' => '\[eu]',
|
239
|
+
# '€' => '\[eu]',
|
240
240
|
'€' => '\[Eu]',
|
241
241
|
'¥' => '\[Ye]',
|
242
242
|
'£' => '\[Po]',
|
@@ -253,12 +253,12 @@ module Kramdown
|
|
253
253
|
# Logical Symbols
|
254
254
|
'∧' => '\[AN]',
|
255
255
|
'∨' => '\[OR]',
|
256
|
-
'¬' => '\[no]',
|
256
|
+
# '¬' => '\[no]',
|
257
257
|
'¬' => '\[tno]',
|
258
258
|
'∃' => '\[te]',
|
259
259
|
'∀' => '\[fa]',
|
260
260
|
'∋' => '\[st]',
|
261
|
-
'∴' => '\[3d]',
|
261
|
+
# '∴' => '\[3d]',
|
262
262
|
'∴' => '\[tf]',
|
263
263
|
'|' => '\[or]',
|
264
264
|
# Mathematical Symbols
|
@@ -276,15 +276,15 @@ module Kramdown
|
|
276
276
|
'-' => '\-',
|
277
277
|
'−' => '\[mi]',
|
278
278
|
'∓' => '\[-+]',
|
279
|
-
'±' => '\[+-]',
|
279
|
+
# '±' => '\[+-]',
|
280
280
|
'±' => '\[t+-]',
|
281
281
|
'·' => '\[pc]',
|
282
282
|
'⋅' => '\[md]',
|
283
|
-
'×' => '\[mu]',
|
283
|
+
# '×' => '\[mu]',
|
284
284
|
'×' => '\[tmu]',
|
285
285
|
'⊗' => '\[c*]',
|
286
286
|
'⊕' => '\[c+]',
|
287
|
-
'÷' => '\[di]',
|
287
|
+
# '÷' => '\[di]',
|
288
288
|
'÷' => '\[tdi]',
|
289
289
|
'⁄' => '\[f/]',
|
290
290
|
'∗' => '\[**]',
|
@@ -299,7 +299,7 @@ module Kramdown
|
|
299
299
|
'≅' => '\[=~]',
|
300
300
|
'≃' => '\[|=]',
|
301
301
|
'∼' => '\[ap]',
|
302
|
-
'≈' => '\[~~]',
|
302
|
+
# '≈' => '\[~~]',
|
303
303
|
'≈' => '\[~=]',
|
304
304
|
'∝' => '\[pt]',
|
305
305
|
'∅' => '\[es]',
|
@@ -315,13 +315,13 @@ module Kramdown
|
|
315
315
|
'∪' => '\[cu]',
|
316
316
|
'∠' => '\[/_]',
|
317
317
|
'⊥' => '\[pp]',
|
318
|
-
'∫' => '\[is]',
|
318
|
+
# '∫' => '\[is]',
|
319
319
|
'∫' => '\[integral]',
|
320
320
|
'∑' => '\[sum]',
|
321
321
|
'∏' => '\[product]',
|
322
322
|
'∐' => '\[coproduct]',
|
323
323
|
'∇' => '\[gr]',
|
324
|
-
'√' => '\[sr]',
|
324
|
+
# '√' => '\[sr]',
|
325
325
|
'√' => '\[sqrt]',
|
326
326
|
'⌈' => '\[lc]',
|
327
327
|
'⌉' => '\[rc]',
|
@@ -333,7 +333,7 @@ module Kramdown
|
|
333
333
|
'ℜ' => '\[Re]',
|
334
334
|
'℘' => '\[wp]',
|
335
335
|
'∂' => '\[pd]',
|
336
|
-
'ℏ' => '\[-h]',
|
336
|
+
# 'ℏ' => '\[-h]',
|
337
337
|
'ℏ' => '\[hbar]',
|
338
338
|
# Greek glyphs
|
339
339
|
'Α' => '\[*A]',
|
data/lib/kramdown/man/version.rb
CHANGED
data/man/kramdown-man.1
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.\" Generated by kramdown-man 0.1.
|
1
|
+
.\" Generated by kramdown-man 0.1.5
|
2
2
|
.\" https://github.com/postmodern/kramdown-man#readme
|
3
3
|
.TH kramdown-man.1 "April 2013" kramdown-man "User Manuals"
|
4
4
|
.LP
|
@@ -6,7 +6,7 @@
|
|
6
6
|
.LP
|
7
7
|
.PP
|
8
8
|
A Kramdown
|
9
|
-
.UR http:\[sl]\[sl]kramdown\.
|
9
|
+
.UR http:\[sl]\[sl]kramdown\.gettalong\.org\[sl]
|
10
10
|
.UE plugin for converting Markdown files into man pages\.
|
11
11
|
.LP
|
12
12
|
.SH EXAMPLE
|
@@ -180,4 +180,4 @@ int main()
|
|
180
180
|
Postmodern
|
181
181
|
.MT postmodern\.mod3\[at]gmail\.com
|
182
182
|
.ME
|
183
|
-
.LP
|
183
|
+
.LP
|
data/man/kramdown-man.1.md
CHANGED
@@ -20,13 +20,13 @@ Hello world.
|
|
20
20
|
let(:root) { doc.root }
|
21
21
|
|
22
22
|
it "should add the header" do
|
23
|
-
subject.convert(root).
|
23
|
+
expect(subject.convert(root)).to eq([
|
24
24
|
described_class::HEADER,
|
25
25
|
".TH Header",
|
26
26
|
".LP",
|
27
27
|
".PP",
|
28
28
|
'Hello world\.'
|
29
|
-
].join("\n")
|
29
|
+
].join("\n"))
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -42,12 +42,12 @@ Hello world.
|
|
42
42
|
let(:root) { doc.root }
|
43
43
|
|
44
44
|
it "should convert every element" do
|
45
|
-
subject.convert_root(root).
|
45
|
+
expect(subject.convert_root(root)).to eq([
|
46
46
|
".TH Header",
|
47
47
|
".LP",
|
48
48
|
".PP",
|
49
49
|
'Hello world\.'
|
50
|
-
].join("\n")
|
50
|
+
].join("\n"))
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -56,7 +56,7 @@ Hello world.
|
|
56
56
|
let(:el) { doc.root.children[0] }
|
57
57
|
|
58
58
|
it "should convert the element based on it's type" do
|
59
|
-
subject.convert_element(el).
|
59
|
+
expect(subject.convert_element(el)).to eq(subject.convert_codeblock(el))
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -65,7 +65,7 @@ Hello world.
|
|
65
65
|
let(:blank) { doc.root.children[0].children[1] }
|
66
66
|
|
67
67
|
it "should convert blank elements to '.LP'" do
|
68
|
-
subject.convert_blank(blank).
|
68
|
+
expect(subject.convert_blank(blank)).to eq('.LP')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -75,14 +75,14 @@ Hello world.
|
|
75
75
|
let(:text) { doc.root.children[0].children[0] }
|
76
76
|
|
77
77
|
it "should convert text elements" do
|
78
|
-
subject.convert_text(text).
|
78
|
+
expect(subject.convert_text(text)).to eq(content)
|
79
79
|
end
|
80
80
|
|
81
81
|
context "when the text has two-space indentation" do
|
82
82
|
let(:content) { "Foo\n bar\n baz" }
|
83
83
|
|
84
84
|
it "should strip leading whitespace from each line" do
|
85
|
-
subject.convert_text(text).
|
85
|
+
expect(subject.convert_text(text)).to eq(content.gsub("\n ","\n"))
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -90,7 +90,7 @@ Hello world.
|
|
90
90
|
let(:content) { "Foo\n\tbar\n\tbaz" }
|
91
91
|
|
92
92
|
it "should strip leading whitespace from each line" do
|
93
|
-
subject.convert_text(text).
|
93
|
+
expect(subject.convert_text(text)).to eq(content.gsub("\n\t","\n"))
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
@@ -101,7 +101,7 @@ Hello world.
|
|
101
101
|
let(:sym) { doc.root.children[0].children[0] }
|
102
102
|
|
103
103
|
it "should convert ndash symbols back into '\-\-'" do
|
104
|
-
subject.convert_typographic_sym(sym).
|
104
|
+
expect(subject.convert_typographic_sym(sym)).to eq("\\-\\-")
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -110,7 +110,7 @@ Hello world.
|
|
110
110
|
let(:sym) { doc.root.children[0].children[0] }
|
111
111
|
|
112
112
|
it "should convert mdash symbols into '\[em]'" do
|
113
|
-
subject.convert_typographic_sym(sym).
|
113
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\[em]')
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -118,8 +118,8 @@ Hello world.
|
|
118
118
|
let(:doc) { Kramdown::Document.new("... foo") }
|
119
119
|
let(:sym) { doc.root.children[0].children[0] }
|
120
120
|
|
121
|
-
it "should convert mdash symbols into '
|
122
|
-
subject.convert_typographic_sym(sym).
|
121
|
+
it "should convert mdash symbols into '\\.\\.\\.'" do
|
122
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\.\.\.')
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -128,7 +128,7 @@ Hello world.
|
|
128
128
|
let(:sym) { doc.root.children[0].children[0] }
|
129
129
|
|
130
130
|
it "should convert mdash symbols into '\[Fo]'" do
|
131
|
-
subject.convert_typographic_sym(sym).
|
131
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\[Fo]')
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
@@ -137,7 +137,7 @@ Hello world.
|
|
137
137
|
let(:sym) { doc.root.children[0].children[1] }
|
138
138
|
|
139
139
|
it "should convert mdash symbols into '\[Fc]'" do
|
140
|
-
subject.convert_typographic_sym(sym).
|
140
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\[Fc]')
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -146,7 +146,7 @@ Hello world.
|
|
146
146
|
let(:sym) { doc.root.children[0].children[0] }
|
147
147
|
|
148
148
|
it "should convert mdash symbols into '\[Fo]'" do
|
149
|
-
subject.convert_typographic_sym(sym).
|
149
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\[Fo]')
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -155,7 +155,7 @@ Hello world.
|
|
155
155
|
let(:sym) { doc.root.children[0].children[1] }
|
156
156
|
|
157
157
|
it "should convert mdash symbols into '\[Fc]'" do
|
158
|
-
subject.convert_typographic_sym(sym).
|
158
|
+
expect(subject.convert_typographic_sym(sym)).to eq('\[Fc]')
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -166,7 +166,7 @@ Hello world.
|
|
166
166
|
let(:quote) { doc.root.children[0].children.first }
|
167
167
|
|
168
168
|
it "should convert lsquo quotes into '\[oq]'" do
|
169
|
-
subject.convert_smart_quote(quote).
|
169
|
+
expect(subject.convert_smart_quote(quote)).to eq('\[oq]')
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -175,7 +175,7 @@ Hello world.
|
|
175
175
|
let(:quote) { doc.root.children[0].children.last }
|
176
176
|
|
177
177
|
it "should convert rsquo quotes into '\[cq]'" do
|
178
|
-
subject.convert_smart_quote(quote).
|
178
|
+
expect(subject.convert_smart_quote(quote)).to eq('\[cq]')
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -184,7 +184,7 @@ Hello world.
|
|
184
184
|
let(:quote) { doc.root.children[0].children.first }
|
185
185
|
|
186
186
|
it "should convert lsquo quotes into '\[lq]'" do
|
187
|
-
subject.convert_smart_quote(quote).
|
187
|
+
expect(subject.convert_smart_quote(quote)).to eq('\[lq]')
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -193,7 +193,7 @@ Hello world.
|
|
193
193
|
let(:quote) { doc.root.children[0].children.last }
|
194
194
|
|
195
195
|
it "should convert lsquo quotes into '\[rq]'" do
|
196
|
-
subject.convert_smart_quote(quote).
|
196
|
+
expect(subject.convert_smart_quote(quote)).to eq('\[rq]')
|
197
197
|
end
|
198
198
|
end
|
199
199
|
end
|
@@ -204,7 +204,7 @@ Hello world.
|
|
204
204
|
let(:header) { doc.root.children[0] }
|
205
205
|
|
206
206
|
it "should convert level 1 headers into '.TH text'" do
|
207
|
-
subject.convert_header(header).
|
207
|
+
expect(subject.convert_header(header)).to eq(".TH Header")
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
@@ -213,7 +213,7 @@ Hello world.
|
|
213
213
|
let(:header) { doc.root.children[0] }
|
214
214
|
|
215
215
|
it "should convert level 2 headers into '.SH text'" do
|
216
|
-
subject.convert_header(header).
|
216
|
+
expect(subject.convert_header(header)).to eq(".SH Header")
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
@@ -222,7 +222,7 @@ Hello world.
|
|
222
222
|
let(:header) { doc.root.children[0] }
|
223
223
|
|
224
224
|
it "should convert level 2 headers into '.SS text'" do
|
225
|
-
subject.convert_header(header).
|
225
|
+
expect(subject.convert_header(header)).to eq(".SS Header")
|
226
226
|
end
|
227
227
|
end
|
228
228
|
|
@@ -231,7 +231,7 @@ Hello world.
|
|
231
231
|
let(:header) { doc.root.children[0] }
|
232
232
|
|
233
233
|
it "should convert level 2 headers into '.SS text'" do
|
234
|
-
subject.convert_header(header).
|
234
|
+
expect(subject.convert_header(header)).to eq(".SS Header")
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
@@ -241,7 +241,7 @@ Hello world.
|
|
241
241
|
let(:hr) { doc.root.children[0] }
|
242
242
|
|
243
243
|
it "should convert hr elements into '.ti 0\\n\\\\l'\\\\n(.lu\\''" do
|
244
|
-
subject.convert_hr(hr).
|
244
|
+
expect(subject.convert_hr(hr)).to eq(".ti 0\n\\l'\\n(.lu'")
|
245
245
|
end
|
246
246
|
end
|
247
247
|
|
@@ -252,14 +252,14 @@ Hello world.
|
|
252
252
|
let(:ul) { doc.root.children[0] }
|
253
253
|
|
254
254
|
it "should convert ul elements into '.RS\\n...\\n.RE'" do
|
255
|
-
subject.convert_ul(ul).
|
255
|
+
expect(subject.convert_ul(ul)).to eq([
|
256
256
|
".RS",
|
257
257
|
".IP \\(bu 2",
|
258
258
|
text1,
|
259
259
|
".IP \\(bu 2",
|
260
260
|
text2,
|
261
261
|
".RE"
|
262
|
-
].join("\n")
|
262
|
+
].join("\n"))
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
@@ -269,7 +269,7 @@ Hello world.
|
|
269
269
|
let(:li) { doc.root.children[0].children[0] }
|
270
270
|
|
271
271
|
it "should convert the first p element to '.IP \\\\(bu 2\\n...'" do
|
272
|
-
subject.convert_ul_li(li).
|
272
|
+
expect(subject.convert_ul_li(li)).to eq(".IP \\(bu 2\n#{text}")
|
273
273
|
end
|
274
274
|
|
275
275
|
context "with multiple multiple paragraphs" do
|
@@ -278,12 +278,12 @@ Hello world.
|
|
278
278
|
let(:doc) { Kramdown::Document.new("* #{text1}\n\n #{text2}") }
|
279
279
|
|
280
280
|
it "should convert the other p elements to '.IP \\\\( 2\\n...'" do
|
281
|
-
subject.convert_ul_li(li).
|
281
|
+
expect(subject.convert_ul_li(li)).to eq([
|
282
282
|
".IP \\(bu 2",
|
283
283
|
text1,
|
284
284
|
".IP \\( 2",
|
285
285
|
text2
|
286
|
-
].join("\n")
|
286
|
+
].join("\n"))
|
287
287
|
end
|
288
288
|
end
|
289
289
|
end
|
@@ -295,7 +295,7 @@ Hello world.
|
|
295
295
|
let(:ol) { doc.root.children[0] }
|
296
296
|
|
297
297
|
it "should convert ol elements into '.RS\\n...\\n.RE'" do
|
298
|
-
subject.convert_ol(ol).
|
298
|
+
expect(subject.convert_ol(ol)).to eq([
|
299
299
|
".nr step1 0 1",
|
300
300
|
".RS",
|
301
301
|
".IP \\n+[step1]",
|
@@ -303,7 +303,7 @@ Hello world.
|
|
303
303
|
".IP \\n+[step1]",
|
304
304
|
text2,
|
305
305
|
".RE"
|
306
|
-
].join("\n")
|
306
|
+
].join("\n"))
|
307
307
|
end
|
308
308
|
end
|
309
309
|
|
@@ -313,7 +313,7 @@ Hello world.
|
|
313
313
|
let(:li) { doc.root.children[0].children[0] }
|
314
314
|
|
315
315
|
it "should convert the first p element to '.IP \\\\n+[step0]\\n...'" do
|
316
|
-
subject.convert_ol_li(li).
|
316
|
+
expect(subject.convert_ol_li(li)).to eq(".IP \\n+[step0]\n#{text}")
|
317
317
|
end
|
318
318
|
|
319
319
|
context "with multiple multiple paragraphs" do
|
@@ -322,12 +322,12 @@ Hello world.
|
|
322
322
|
let(:doc) { Kramdown::Document.new("1. #{text1}\n\n #{text2}") }
|
323
323
|
|
324
324
|
it "should convert the other p elements to '.IP \\\\n\\n...'" do
|
325
|
-
subject.convert_ol_li(li).
|
325
|
+
expect(subject.convert_ol_li(li)).to eq([
|
326
326
|
".IP \\n+[step0]",
|
327
327
|
text1,
|
328
328
|
".IP \\n",
|
329
329
|
text2
|
330
|
-
].join("\n")
|
330
|
+
].join("\n"))
|
331
331
|
end
|
332
332
|
end
|
333
333
|
end
|
@@ -339,7 +339,7 @@ Hello world.
|
|
339
339
|
let(:abbreviation) { doc.root.children[0].children[1] }
|
340
340
|
|
341
341
|
it "should convert abbreviation elements into their text" do
|
342
|
-
subject.convert_abbreviation(abbreviation).
|
342
|
+
expect(subject.convert_abbreviation(abbreviation)).to eq(acronym)
|
343
343
|
end
|
344
344
|
end
|
345
345
|
|
@@ -350,7 +350,7 @@ Hello world.
|
|
350
350
|
let(:blockquote) { doc.root.children[0] }
|
351
351
|
|
352
352
|
it "should convert blockquote elements into '.PP\\n.RS\\ntext...\\n.RE'" do
|
353
|
-
subject.convert_blockquote(blockquote).
|
353
|
+
expect(subject.convert_blockquote(blockquote)).to eq(".PP\n.RS\n#{escaped_text}\n.RE")
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
@@ -361,7 +361,7 @@ Hello world.
|
|
361
361
|
let(:codeblock) { doc.root.children[0] }
|
362
362
|
|
363
363
|
it "should convert codeblock elements into '.nf\\ntext...\\n.fi'" do
|
364
|
-
subject.convert_codeblock(codeblock).
|
364
|
+
expect(subject.convert_codeblock(codeblock)).to eq(".nf\n#{escaped_code}\n.fi")
|
365
365
|
end
|
366
366
|
end
|
367
367
|
|
@@ -371,7 +371,7 @@ Hello world.
|
|
371
371
|
let(:comment) { doc.root.children[0] }
|
372
372
|
|
373
373
|
it "should convert comment elements into '.\\\" text...'" do
|
374
|
-
subject.convert_comment(comment).
|
374
|
+
expect(subject.convert_comment(comment)).to eq(".\\\" #{text}")
|
375
375
|
end
|
376
376
|
end
|
377
377
|
|
@@ -382,7 +382,7 @@ Hello world.
|
|
382
382
|
let(:p) { doc.root.children[0] }
|
383
383
|
|
384
384
|
it "should convert p elements into '.PP\\ntext'" do
|
385
|
-
subject.convert_p(p).
|
385
|
+
expect(subject.convert_p(p)).to eq(".PP\n#{escaped_text}")
|
386
386
|
end
|
387
387
|
|
388
388
|
context "when the paragraph starts with a codespan element" do
|
@@ -391,7 +391,7 @@ Hello world.
|
|
391
391
|
let(:doc) { Kramdown::Document.new("`#{option}`\n\t#{text}") }
|
392
392
|
|
393
393
|
it "should convert p elements into '.TP\\n\\fB--option\\fR\\ntext...'" do
|
394
|
-
subject.convert_p(p).
|
394
|
+
expect(subject.convert_p(p)).to eq(".TP\n\\fB#{option}\\fR\n#{text}")
|
395
395
|
end
|
396
396
|
|
397
397
|
context "when there is only one codespan element" do
|
@@ -399,7 +399,7 @@ Hello world.
|
|
399
399
|
let(:doc) { Kramdown::Document.new("`#{code}`") }
|
400
400
|
|
401
401
|
it "should convert p elements into '.PP\\n\\fB...\\fR'" do
|
402
|
-
subject.convert_p(p).
|
402
|
+
expect(subject.convert_p(p)).to eq(".PP\n\\fB#{code}\\fR")
|
403
403
|
end
|
404
404
|
end
|
405
405
|
|
@@ -410,14 +410,14 @@ Hello world.
|
|
410
410
|
let(:doc) { Kramdown::Document.new("`#{flag}`, `#{option}`\n\t#{text}") }
|
411
411
|
|
412
412
|
it "should convert p elements into '.TP\\n\\fB-o\\fR, \\fB--option\\fR\\ntext...'" do
|
413
|
-
subject.convert_p(p).
|
413
|
+
expect(subject.convert_p(p)).to eq(".TP\n\\fB#{flag}\\fR, \\fB#{option}\\fR\n#{text}")
|
414
414
|
end
|
415
415
|
|
416
416
|
context "when there is no newline" do
|
417
417
|
let(:doc) { Kramdown::Document.new("`#{flag}` `#{option}`") }
|
418
418
|
|
419
419
|
it "should convert the p element into a '.HP\\n...'" do
|
420
|
-
subject.convert_p(p).
|
420
|
+
expect(subject.convert_p(p)).to eq(".HP\n\\fB#{flag}\\fR \\fB#{option}\\fR")
|
421
421
|
end
|
422
422
|
end
|
423
423
|
end
|
@@ -433,7 +433,7 @@ Hello world.
|
|
433
433
|
end
|
434
434
|
|
435
435
|
it "should convert p elements into '.TP\\n\\fI--option\\fP\\ntext...'" do
|
436
|
-
subject.convert_p(p).
|
436
|
+
expect(subject.convert_p(p)).to eq(".TP\n\\fI#{escaped_option}\\fP\n#{text}")
|
437
437
|
end
|
438
438
|
|
439
439
|
context "when there is only one em element" do
|
@@ -441,7 +441,7 @@ Hello world.
|
|
441
441
|
let(:doc) { Kramdown::Document.new("*#{text}*") }
|
442
442
|
|
443
443
|
it "should convert p elements into '.PP\\n\\fI...\\fP'" do
|
444
|
-
subject.convert_p(p).
|
444
|
+
expect(subject.convert_p(p)).to eq(".PP\n\\fI#{text}\\fP")
|
445
445
|
end
|
446
446
|
end
|
447
447
|
|
@@ -455,14 +455,14 @@ Hello world.
|
|
455
455
|
end
|
456
456
|
|
457
457
|
it "should convert p elements into '.TP\\n\\fI-o\\fP, \\fI\\-\\-option\\fP\\ntext...'" do
|
458
|
-
subject.convert_p(p).
|
458
|
+
expect(subject.convert_p(p)).to eq(".TP\n\\fI#{escaped_flag}\\fP, \\fI#{escaped_option}\\fP\n#{text}")
|
459
459
|
end
|
460
460
|
|
461
461
|
context "when there is no newline" do
|
462
462
|
let(:doc) { Kramdown::Document.new("*#{flag}* *#{option}*") }
|
463
463
|
|
464
464
|
it "should convert the p element into a '.HP\\n...'" do
|
465
|
-
subject.convert_p(p).
|
465
|
+
expect(subject.convert_p(p)).to eq(".HP\n\\fI#{escaped_flag}\\fP \\fI#{escaped_option}\\fP")
|
466
466
|
end
|
467
467
|
end
|
468
468
|
end
|
@@ -475,7 +475,7 @@ Hello world.
|
|
475
475
|
let(:em) { doc.root.children[0].children[0] }
|
476
476
|
|
477
477
|
it "should convert em elements into '\\fItext\\fP'" do
|
478
|
-
subject.convert_em(em).
|
478
|
+
expect(subject.convert_em(em)).to eq("\\fI#{text}\\fP")
|
479
479
|
end
|
480
480
|
end
|
481
481
|
|
@@ -485,7 +485,7 @@ Hello world.
|
|
485
485
|
let(:strong) { doc.root.children[0].children[0] }
|
486
486
|
|
487
487
|
it "should convert strong elements into '\\fBtext\\fP'" do
|
488
|
-
subject.convert_strong(strong).
|
488
|
+
expect(subject.convert_strong(strong)).to eq("\\fB#{text}\\fP")
|
489
489
|
end
|
490
490
|
end
|
491
491
|
|
@@ -495,7 +495,7 @@ Hello world.
|
|
495
495
|
let(:codespan) { doc.root.children[0].children[0] }
|
496
496
|
|
497
497
|
it "should convert codespan elements into '\\fBcode\\fR'" do
|
498
|
-
subject.convert_codespan(codespan).
|
498
|
+
expect(subject.convert_codespan(codespan)).to eq("\\fB#{code}\\fR")
|
499
499
|
end
|
500
500
|
end
|
501
501
|
|
@@ -507,7 +507,7 @@ Hello world.
|
|
507
507
|
let(:link) { doc.root.children[0].children[0] }
|
508
508
|
|
509
509
|
it "should convert a link elements into 'text\\n.UR href\\n.UE'" do
|
510
|
-
subject.convert_a(link).
|
510
|
+
expect(subject.convert_a(link)).to eq("#{text}\n.UR #{escaped_href}\n.UE")
|
511
511
|
end
|
512
512
|
|
513
513
|
context "when the href begins with mailto:" do
|
@@ -517,14 +517,14 @@ Hello world.
|
|
517
517
|
let(:doc) { Kramdown::Document.new("[#{text}](mailto:#{email})") }
|
518
518
|
|
519
519
|
it "should convert the link elements into '.MT email\\n.ME'" do
|
520
|
-
subject.convert_a(link).
|
520
|
+
expect(subject.convert_a(link)).to eq("#{text}\n.MT #{escaped_email}\n.ME")
|
521
521
|
end
|
522
522
|
|
523
523
|
context "when link is <email>" do
|
524
524
|
let(:doc) { Kramdown::Document.new("<#{email}>") }
|
525
525
|
|
526
526
|
it "should convert the link elements into '.MT email\\n.ME'" do
|
527
|
-
subject.convert_a(link).
|
527
|
+
expect(subject.convert_a(link)).to eq("\n.MT #{escaped_email}\n.ME")
|
528
528
|
end
|
529
529
|
end
|
530
530
|
end
|
@@ -534,7 +534,7 @@ Hello world.
|
|
534
534
|
let(:doc) { Kramdown::Document.new("[#{man}](man:#{man})") }
|
535
535
|
|
536
536
|
it "should convert the link elements into '.BR man'" do
|
537
|
-
subject.convert_a(link).
|
537
|
+
expect(subject.convert_a(link)).to eq("\n.BR #{man}")
|
538
538
|
end
|
539
539
|
|
540
540
|
context "when a section number is specified" do
|
@@ -542,7 +542,7 @@ Hello world.
|
|
542
542
|
let(:doc) { Kramdown::Document.new("[#{man}](man:#{man}(#{section}))") }
|
543
543
|
|
544
544
|
it "should convert the link elements into '.BR man (section)'" do
|
545
|
-
subject.convert_a(link).
|
545
|
+
expect(subject.convert_a(link)).to eq("\n.BR #{man} (#{section})")
|
546
546
|
end
|
547
547
|
end
|
548
548
|
end
|
@@ -553,7 +553,7 @@ Hello world.
|
|
553
553
|
|
554
554
|
described_class::GLYPHS.each do |char,glyph|
|
555
555
|
it "should convert #{char.dump} into #{glyph.dump}" do
|
556
|
-
subject.escape("#{text} #{char}").
|
556
|
+
expect(subject.escape("#{text} #{char}")).to eq("#{text} #{glyph}")
|
557
557
|
end
|
558
558
|
end
|
559
559
|
end
|
data/spec/kramdown/man_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,78 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kramdown-man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Postmodern
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-12-26 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: kramdown
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
28
39
|
- !ruby/object:Gem::Version
|
29
40
|
version: '1.0'
|
30
41
|
- !ruby/object:Gem::Dependency
|
31
42
|
name: rspec
|
32
43
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
44
|
requirements:
|
35
|
-
- - ~>
|
45
|
+
- - "~>"
|
36
46
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
47
|
+
version: '3.0'
|
38
48
|
type: :development
|
39
49
|
prerelease: false
|
40
50
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
51
|
requirements:
|
43
|
-
- - ~>
|
52
|
+
- - "~>"
|
44
53
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
54
|
+
version: '3.0'
|
46
55
|
- !ruby/object:Gem::Dependency
|
47
56
|
name: rubygems-tasks
|
48
57
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
58
|
requirements:
|
51
|
-
- - ~>
|
59
|
+
- - "~>"
|
52
60
|
- !ruby/object:Gem::Version
|
53
61
|
version: '0.2'
|
54
62
|
type: :development
|
55
63
|
prerelease: false
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
65
|
requirements:
|
59
|
-
- - ~>
|
66
|
+
- - "~>"
|
60
67
|
- !ruby/object:Gem::Version
|
61
68
|
version: '0.2'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
name: yard
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- - ~>
|
73
|
+
- - "~>"
|
68
74
|
- !ruby/object:Gem::Version
|
69
75
|
version: '0.8'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- - ~>
|
80
|
+
- - "~>"
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0.8'
|
78
83
|
description: A Kramdown converter for converting Markdown files into man pages.
|
@@ -85,12 +90,13 @@ extra_rdoc_files:
|
|
85
90
|
- LICENSE.txt
|
86
91
|
- README.md
|
87
92
|
files:
|
88
|
-
- .document
|
89
|
-
- .gitignore
|
90
|
-
- .rspec
|
91
|
-
- .travis.yml
|
92
|
-
- .yardopts
|
93
|
+
- ".document"
|
94
|
+
- ".gitignore"
|
95
|
+
- ".rspec"
|
96
|
+
- ".travis.yml"
|
97
|
+
- ".yardopts"
|
93
98
|
- ChangeLog.md
|
99
|
+
- Gemfile
|
94
100
|
- LICENSE.txt
|
95
101
|
- README.md
|
96
102
|
- Rakefile
|
@@ -109,26 +115,25 @@ files:
|
|
109
115
|
homepage: https://github.com/postmodern/kramdown-man#readme
|
110
116
|
licenses:
|
111
117
|
- MIT
|
118
|
+
metadata: {}
|
112
119
|
post_install_message:
|
113
120
|
rdoc_options: []
|
114
121
|
require_paths:
|
115
122
|
- lib
|
116
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
-
none: false
|
118
124
|
requirements:
|
119
|
-
- -
|
125
|
+
- - ">="
|
120
126
|
- !ruby/object:Gem::Version
|
121
127
|
version: '0'
|
122
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
|
-
none: false
|
124
129
|
requirements:
|
125
|
-
- -
|
130
|
+
- - ">="
|
126
131
|
- !ruby/object:Gem::Version
|
127
132
|
version: '0'
|
128
133
|
requirements: []
|
129
134
|
rubyforge_project:
|
130
|
-
rubygems_version:
|
135
|
+
rubygems_version: 2.4.7
|
131
136
|
signing_key:
|
132
|
-
specification_version:
|
137
|
+
specification_version: 4
|
133
138
|
summary: Converts markdown to man pages
|
134
139
|
test_files: []
|