ronn-ng 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +8 -0
- data/CHANGES +184 -0
- data/INSTALLING +20 -0
- data/LICENSE.txt +11 -0
- data/README.md +113 -0
- data/Rakefile +163 -0
- data/bin/ronn +223 -0
- data/config.ru +15 -0
- data/lib/ronn.rb +50 -0
- data/lib/ronn/document.rb +495 -0
- data/lib/ronn/index.rb +183 -0
- data/lib/ronn/roff.rb +302 -0
- data/lib/ronn/server.rb +70 -0
- data/lib/ronn/template.rb +171 -0
- data/lib/ronn/template/80c.css +6 -0
- data/lib/ronn/template/dark.css +18 -0
- data/lib/ronn/template/darktoc.css +17 -0
- data/lib/ronn/template/default.html +41 -0
- data/lib/ronn/template/man.css +100 -0
- data/lib/ronn/template/print.css +5 -0
- data/lib/ronn/template/screen.css +105 -0
- data/lib/ronn/template/toc.css +27 -0
- data/lib/ronn/utils.rb +55 -0
- data/man/index.html +78 -0
- data/man/index.txt +15 -0
- data/man/ronn-format.7 +201 -0
- data/man/ronn-format.7.ronn +157 -0
- data/man/ronn.1 +325 -0
- data/man/ronn.1.ronn +306 -0
- data/ronn-ng.gemspec +97 -0
- data/test/angle_bracket_syntax.html +18 -0
- data/test/angle_bracket_syntax.ronn +12 -0
- data/test/basic_document.html +9 -0
- data/test/basic_document.ronn +4 -0
- data/test/contest.rb +68 -0
- data/test/custom_title_document.html +6 -0
- data/test/custom_title_document.ronn +5 -0
- data/test/definition_list_syntax.html +21 -0
- data/test/definition_list_syntax.roff +26 -0
- data/test/definition_list_syntax.ronn +18 -0
- data/test/dots_at_line_start_test.roff +10 -0
- data/test/dots_at_line_start_test.ronn +4 -0
- data/test/entity_encoding_test.html +35 -0
- data/test/entity_encoding_test.roff +61 -0
- data/test/entity_encoding_test.ronn +25 -0
- data/test/index.txt +8 -0
- data/test/markdown_syntax.html +957 -0
- data/test/markdown_syntax.roff +1467 -0
- data/test/markdown_syntax.ronn +881 -0
- data/test/middle_paragraph.html +15 -0
- data/test/middle_paragraph.roff +13 -0
- data/test/middle_paragraph.ronn +10 -0
- data/test/missing_spaces.roff +9 -0
- data/test/missing_spaces.ronn +2 -0
- data/test/pre_block_with_quotes.roff +13 -0
- data/test/pre_block_with_quotes.ronn +6 -0
- data/test/section_reference_links.html +17 -0
- data/test/section_reference_links.roff +10 -0
- data/test/section_reference_links.ronn +12 -0
- data/test/test_ronn.rb +110 -0
- data/test/test_ronn_document.rb +186 -0
- data/test/test_ronn_index.rb +73 -0
- data/test/titleless_document.html +10 -0
- data/test/titleless_document.ronn +3 -0
- data/test/underline_spacing_test.roff +21 -0
- data/test/underline_spacing_test.ronn +11 -0
- metadata +176 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
<div class='mp'>
|
2
|
+
<h2 id="NAME">NAME</h2>
|
3
|
+
<p class="man-name">
|
4
|
+
<code>test</code> - <span class="man-whatis">just a ron test</span>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<h2 id="TEST">TEST</h2>
|
8
|
+
|
9
|
+
<p>Foo</p>
|
10
|
+
|
11
|
+
<p>Always use <code>attr_reader</code>, <code>attr_writer</code> or <code>attr_accessor</code>. Do not use <code>for...in</code>; use each instead. Do not use <code>and</code>/<code>or</code>; use <code>&&</code>/<code>||</code> instead.</p>
|
12
|
+
|
13
|
+
<p>Bar</p>
|
14
|
+
|
15
|
+
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.TH "TEST" "1" "January 1979" "" ""
|
2
|
+
.
|
3
|
+
.SH "NAME"
|
4
|
+
\fBtest\fR \- just a ron test
|
5
|
+
.
|
6
|
+
.SH "TEST"
|
7
|
+
Foo
|
8
|
+
.
|
9
|
+
.P
|
10
|
+
Always use \fBattr_reader\fR, \fBattr_writer\fR or \fBattr_accessor\fR\. Do not use \fBfor\|\.\|\.\|\.in\fR; use each instead\. Do not use \fBand\fR/\fBor\fR; use \fB&&\fR/\fB||\fR instead\.
|
11
|
+
.
|
12
|
+
.P
|
13
|
+
Bar
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class='mp'>
|
2
|
+
<h2 id="NAME">NAME</h2>
|
3
|
+
<p class="man-name">
|
4
|
+
<code>section_reference_links</code> - <span class="man-whatis">linking to sections</span>
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<h2 id="SECTION-1">SECTION 1</h2>
|
8
|
+
|
9
|
+
<p>See the following section.</p>
|
10
|
+
|
11
|
+
<h2 id="SECTION-2">SECTION 2</h2>
|
12
|
+
|
13
|
+
<p>See <a href="#SECTION-1" title="SECTION 1" data-bare-link="true">SECTION 1</a>
|
14
|
+
or <a href="#SECTION-1" title="SECTION 1" data-bare-link="true">to put it another way</a>
|
15
|
+
or even <a href="#SECTION-1" data-bare-link="true">link this</a></p>
|
16
|
+
|
17
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.TH "SECTION_REFERENCE_LINKS" "1" "January 1979" "" ""
|
2
|
+
.
|
3
|
+
.SH "NAME"
|
4
|
+
\fBsection_reference_links\fR \- linking to sections
|
5
|
+
.
|
6
|
+
.SH "SECTION 1"
|
7
|
+
See the following section\.
|
8
|
+
.
|
9
|
+
.SH "SECTION 2"
|
10
|
+
See \fISECTION 1\fR or \fIto put it another way\fR or even \fIlink this\fR
|
@@ -0,0 +1,12 @@
|
|
1
|
+
section_reference_links(1) - linking to sections
|
2
|
+
================================================
|
3
|
+
|
4
|
+
## SECTION 1
|
5
|
+
|
6
|
+
See the following section.
|
7
|
+
|
8
|
+
## SECTION 2
|
9
|
+
|
10
|
+
See [SECTION 1][]
|
11
|
+
or [to put it another way][SECTION 1]
|
12
|
+
or even [link this](#SECTION-1)
|
data/test/test_ronn.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'contest'
|
2
|
+
|
3
|
+
class RonnTest < Test::Unit::TestCase
|
4
|
+
testdir = File.dirname(__FILE__)
|
5
|
+
|
6
|
+
# setup PATH so that we execute the right ronn command
|
7
|
+
bindir = File.dirname(testdir) + "/bin"
|
8
|
+
ENV['PATH'] = "#{bindir}:#{ENV['PATH']}"
|
9
|
+
|
10
|
+
# make sure the load path is setup correctly
|
11
|
+
libdir = File.expand_path("#{testdir}/../lib")
|
12
|
+
$:.unshift(libdir) unless $:.any? { |path| File.expand_path(path) == libdir }
|
13
|
+
ENV['RUBYLIB'] = $:.join(':')
|
14
|
+
|
15
|
+
require 'ronn'
|
16
|
+
|
17
|
+
test "takes ronn text on stdin and produces roff on stdout" do
|
18
|
+
output = `echo '# hello(1) -- hello world' | ronn --date=2009-11-23`
|
19
|
+
lines = output.split("\n")
|
20
|
+
assert_equal 7, lines.size
|
21
|
+
assert_equal %[.\\" generated with Ronn-NG/v#{Ronn::version}], lines.shift
|
22
|
+
assert_equal %[.\\" http://github.com/apjanke/ronn-ng/tree/#{Ronn::revision}], lines.shift
|
23
|
+
assert_equal %[.], lines.shift
|
24
|
+
assert_equal %[.TH "HELLO" "1" "November 2009" "" ""], lines.shift
|
25
|
+
assert_equal %[.], lines.shift
|
26
|
+
assert_equal %[.SH "NAME"], lines.shift
|
27
|
+
assert_equal %[\\fBhello\\fR \\- hello world], lines.shift
|
28
|
+
assert_equal 0, lines.size
|
29
|
+
end
|
30
|
+
|
31
|
+
def canonicalize(text)
|
32
|
+
text.
|
33
|
+
gsub(/^ +/, '').
|
34
|
+
gsub(/\n/m, '').
|
35
|
+
gsub(/ +/, ' ').
|
36
|
+
gsub(/"/, "'")
|
37
|
+
end
|
38
|
+
|
39
|
+
test "produces html instead of roff with the --html argument" do
|
40
|
+
output = `echo '# hello(1) -- hello world' | ronn --html`
|
41
|
+
output = canonicalize(output)
|
42
|
+
assert_match(/<h2 id='NAME'>NAME<\/h2>/, output)
|
43
|
+
advertising = "<meta name='generator' content='Ronn-NG/v" + Ronn::version +
|
44
|
+
" (http://github.com/apjanke/ronn-ng/tree/" + Ronn::revision + ")'>"
|
45
|
+
assert_match(/#{Regexp.escape(advertising)}/, output)
|
46
|
+
end
|
47
|
+
|
48
|
+
test "produces html fragment with the --fragment argument" do
|
49
|
+
output = `echo '# hello(1) -- hello world' | ronn --fragment`
|
50
|
+
assert_equal [
|
51
|
+
"<div class='mp'>",
|
52
|
+
"<h2 id='NAME'>NAME</h2>",
|
53
|
+
"<p class='man-name'><code>hello</code>",
|
54
|
+
" - <span class='man-whatis'>hello world</span>",
|
55
|
+
"</p></div>"
|
56
|
+
].join, canonicalize(output)
|
57
|
+
end
|
58
|
+
|
59
|
+
test "abides by the RONN_MANUAL environment variable" do
|
60
|
+
output = `echo '# hello(1) -- hello world' | RONN_MANUAL='Some Manual' ronn --html`
|
61
|
+
assert_match(/Some Manual/, output)
|
62
|
+
end
|
63
|
+
|
64
|
+
test "abides by the RONN_DATE environment variable" do
|
65
|
+
output = `echo '# hello(1) -- hello world' | RONN_DATE=1979-01-01 ronn --html`
|
66
|
+
assert_match(/January 1979/, output)
|
67
|
+
end
|
68
|
+
|
69
|
+
test "abides by the RONN_ORGANIZATION environment variable" do
|
70
|
+
output = `echo '# hello(1) -- hello world' | RONN_ORGANIZATION='GitHub' ronn --html`
|
71
|
+
assert_match(/GitHub/, output)
|
72
|
+
end
|
73
|
+
|
74
|
+
# ronn -> HTML file based tests
|
75
|
+
Dir[testdir + '/*.ronn'].each do |source|
|
76
|
+
dest = source.sub(/ronn$/, 'html')
|
77
|
+
next unless File.exist?(dest)
|
78
|
+
wrong = dest + '.wrong'
|
79
|
+
test File.basename(source, '.ronn') + ' HTML' do
|
80
|
+
output = `ronn --pipe --html --fragment #{source}`
|
81
|
+
expected = File.read(dest) rescue ''
|
82
|
+
if expected != output
|
83
|
+
File.open(wrong, 'wb') { |f| f.write(output) }
|
84
|
+
diff = `diff -u #{dest} #{wrong} 2>/dev/null`
|
85
|
+
flunk diff
|
86
|
+
elsif File.exist?(wrong)
|
87
|
+
File.unlink(wrong)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# ronn -> roff file based tests
|
93
|
+
Dir[testdir + '/*.ronn'].each do |source|
|
94
|
+
dest = source.sub(/ronn$/, 'roff')
|
95
|
+
next unless File.exist?(dest)
|
96
|
+
wrong = dest + '.wrong'
|
97
|
+
test File.basename(source, '.ronn') + ' roff' do
|
98
|
+
output = `ronn --pipe --roff --date=1979-01-01 #{source}`.
|
99
|
+
split("\n", 4).last # remove ronn version comments
|
100
|
+
expected = File.read(dest) rescue ''
|
101
|
+
if expected != output
|
102
|
+
File.open(wrong, 'wb') { |f| f.write(output) }
|
103
|
+
diff = `diff -u #{dest} #{wrong} 2>/dev/null`
|
104
|
+
flunk diff
|
105
|
+
elsif File.exist?(wrong)
|
106
|
+
File.unlink(wrong)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
require 'contest'
|
2
|
+
require 'ronn/document'
|
3
|
+
|
4
|
+
class DocumentTest < Test::Unit::TestCase
|
5
|
+
SIMPLE_FILE = "#{File.dirname(__FILE__)}/basic_document.ronn"
|
6
|
+
|
7
|
+
def canonicalize(text)
|
8
|
+
text.
|
9
|
+
gsub(/^ +/, '').
|
10
|
+
gsub(/\n/m, '').
|
11
|
+
gsub(/ +/, ' ').
|
12
|
+
gsub(/"/, "'")
|
13
|
+
end
|
14
|
+
|
15
|
+
test "new with path" do
|
16
|
+
doc = Ronn::Document.new(SIMPLE_FILE)
|
17
|
+
assert_equal File.read(SIMPLE_FILE), doc.data
|
18
|
+
end
|
19
|
+
|
20
|
+
test "new with path and block" do
|
21
|
+
doc = Ronn::Document.new('hello.1.ronn') { "# hello(1) -- hello world" }
|
22
|
+
assert_equal "# hello(1) -- hello world", doc.data
|
23
|
+
end
|
24
|
+
|
25
|
+
test "new with path and block but missing name section" do
|
26
|
+
doc = Ronn::Document.new('foo.7.ronn') { '' }
|
27
|
+
assert_equal 'foo', doc.name
|
28
|
+
assert_equal '7', doc.section
|
29
|
+
end
|
30
|
+
|
31
|
+
test "new with non conventional path and missing name section" do
|
32
|
+
doc = Ronn::Document.new('bar.ronn') { '' }
|
33
|
+
assert_equal 'bar', doc.name
|
34
|
+
assert_equal nil, doc.section
|
35
|
+
assert_equal "./bar.html", doc.path_for('html')
|
36
|
+
assert_equal "./bar", doc.path_for('roff')
|
37
|
+
assert_equal "./bar", doc.path_for('')
|
38
|
+
assert_equal "./bar", doc.path_for(nil)
|
39
|
+
end
|
40
|
+
|
41
|
+
test "new with path and name section mismatch" do
|
42
|
+
doc = Ronn::Document.new('foo/rick.7.ronn') { "# randy(3) -- I'm confused." }
|
43
|
+
assert_equal 'randy', doc.name
|
44
|
+
assert_equal 'rick', doc.path_name
|
45
|
+
assert_equal '3', doc.section
|
46
|
+
assert_equal '7', doc.path_section
|
47
|
+
assert_equal 'rick.7', doc.basename
|
48
|
+
assert_equal 'foo/rick.7.bar', doc.path_for(:bar)
|
49
|
+
end
|
50
|
+
|
51
|
+
test "new with no path and a name section" do
|
52
|
+
doc = Ronn::Document.new { "# brandy(5) -- wootderitis" }
|
53
|
+
assert_equal nil, doc.path_name
|
54
|
+
assert_equal nil, doc.path_section
|
55
|
+
assert_equal 'brandy', doc.name
|
56
|
+
assert_equal '5', doc.section
|
57
|
+
assert_equal 'brandy.5', doc.basename
|
58
|
+
assert_equal 'brandy.5.foo', doc.path_for(:foo)
|
59
|
+
end
|
60
|
+
|
61
|
+
1.upto(5) do |i|
|
62
|
+
dashes = '-' * i
|
63
|
+
|
64
|
+
test "new with no path and #{i} dashes in name" do
|
65
|
+
doc = Ronn::Document.new { "# brandy #{dashes} wootderitis" }
|
66
|
+
assert_equal 'brandy', doc.name
|
67
|
+
assert_equal nil, doc.section
|
68
|
+
assert_equal 'wootderitis', doc.tagline
|
69
|
+
end
|
70
|
+
|
71
|
+
test "new with no path and a name section and #{i} dashes in name" do
|
72
|
+
doc = Ronn::Document.new { "# brandy(5) #{dashes} wootderitis" }
|
73
|
+
assert_equal 'brandy', doc.name
|
74
|
+
assert_equal '5', doc.section
|
75
|
+
assert_equal 'wootderitis', doc.tagline
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "simple conventionally named document" do
|
80
|
+
setup do
|
81
|
+
@now = Time.now
|
82
|
+
@doc = Ronn::Document.new('hello.1.ronn') { "# hello(1) -- hello world" }
|
83
|
+
@doc.date = @now
|
84
|
+
end
|
85
|
+
|
86
|
+
should "load data" do
|
87
|
+
assert_equal "# hello(1) -- hello world", @doc.data
|
88
|
+
end
|
89
|
+
|
90
|
+
should "extract the manual page name from the filename or document" do
|
91
|
+
assert_equal 'hello', @doc.name
|
92
|
+
end
|
93
|
+
|
94
|
+
should "extract the manual page section from the filename or document" do
|
95
|
+
assert_equal '1', @doc.section
|
96
|
+
end
|
97
|
+
|
98
|
+
should "convert to an HTML fragment with no wrap div" do
|
99
|
+
assert_equal %[<h2 id='NAME'>NAME</h2><p class='man-name'><code>hello</code> - <span class='man-whatis'>hello world</span></p>],
|
100
|
+
canonicalize(@doc.to_html_fragment(wrap=nil))
|
101
|
+
end
|
102
|
+
|
103
|
+
should "convert to an HTML fragment with a wrap class" do
|
104
|
+
assert_equal %[<div class='pm'><h2 id='NAME'>NAME</h2><p class='man-name'><code>hello</code> - <span class='man-whatis'>hello world</span></p></div>],
|
105
|
+
canonicalize(@doc.to_html_fragment(wrap_class='pm'))
|
106
|
+
end
|
107
|
+
|
108
|
+
should "convert to HTML with a layout" do
|
109
|
+
assert_match %r{^<!DOCTYPE html.*}m, @doc.to_html
|
110
|
+
assert_match %[<h2 id='NAME'>NAME</h2><p class='man-name'><code>hello</code> - <span class='man-whatis'>hello world</span></p>],
|
111
|
+
canonicalize(@doc.to_html)
|
112
|
+
end
|
113
|
+
|
114
|
+
should "construct a path to related documents" do
|
115
|
+
assert_equal "./hello.1.html", @doc.path_for(:html)
|
116
|
+
assert_equal "./hello.1", @doc.path_for(:roff)
|
117
|
+
assert_equal "./hello.1", @doc.path_for('')
|
118
|
+
assert_equal "./hello.1", @doc.path_for(nil)
|
119
|
+
end
|
120
|
+
|
121
|
+
test "uses default styles" do
|
122
|
+
assert_equal %w[man], @doc.styles
|
123
|
+
end
|
124
|
+
|
125
|
+
test "converting to a hash" do
|
126
|
+
assert_equal({
|
127
|
+
"section" => "1",
|
128
|
+
"name" => "hello",
|
129
|
+
"date" => @now,
|
130
|
+
"tagline" => "hello world",
|
131
|
+
"styles" => ["man"],
|
132
|
+
"toc" => [["NAME", "NAME"]],
|
133
|
+
"organization" => nil,
|
134
|
+
"manual" => nil
|
135
|
+
}, @doc.to_h)
|
136
|
+
end
|
137
|
+
|
138
|
+
test "converting to yaml" do
|
139
|
+
require 'yaml'
|
140
|
+
assert_equal({
|
141
|
+
"section" => "1",
|
142
|
+
"name" => "hello",
|
143
|
+
"date" => @now,
|
144
|
+
"tagline" => "hello world",
|
145
|
+
"styles" => ["man"],
|
146
|
+
"toc" => [["NAME", "NAME"]],
|
147
|
+
"organization" => nil,
|
148
|
+
"manual" => nil
|
149
|
+
}, YAML.load(@doc.to_yaml))
|
150
|
+
end
|
151
|
+
|
152
|
+
test "converting to json" do
|
153
|
+
require 'json'
|
154
|
+
assert_equal({
|
155
|
+
"section" => "1",
|
156
|
+
"name" => "hello",
|
157
|
+
"date" => @now.iso8601,
|
158
|
+
"tagline" => "hello world",
|
159
|
+
"styles" => ["man"],
|
160
|
+
"toc" => [["NAME", "NAME"]],
|
161
|
+
"organization" => nil,
|
162
|
+
"manual" => nil
|
163
|
+
}, JSON.parse(@doc.to_json))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
test 'extracting toc' do
|
168
|
+
@doc = Ronn::Document.new(File.expand_path('../markdown_syntax.ronn', __FILE__))
|
169
|
+
expected = [
|
170
|
+
["NAME", "NAME"],
|
171
|
+
["SYNOPSIS", "SYNOPSIS"],
|
172
|
+
["DESCRIPTION", "DESCRIPTION"],
|
173
|
+
["BLOCK-ELEMENTS", "BLOCK ELEMENTS"],
|
174
|
+
["SPAN-ELEMENTS", "SPAN ELEMENTS"],
|
175
|
+
["MISCELLANEOUS", "MISCELLANEOUS"],
|
176
|
+
["AUTHOR", "AUTHOR"],
|
177
|
+
["SEE-ALSO", "SEE ALSO"]
|
178
|
+
]
|
179
|
+
assert_equal expected, @doc.toc
|
180
|
+
end
|
181
|
+
|
182
|
+
test "passing a list of styles" do
|
183
|
+
@doc = Ronn::Document.new('hello.1.ronn', :styles => %w[test boom test]) { '' }
|
184
|
+
assert_equal %w[man test boom], @doc.styles
|
185
|
+
end
|
186
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'contest'
|
2
|
+
require 'ronn'
|
3
|
+
|
4
|
+
class IndexTest < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
@index_path = File.expand_path('../index.txt', __FILE__)
|
7
|
+
@missing_path = File.expand_path('../missing-index.txt', __FILE__)
|
8
|
+
end
|
9
|
+
|
10
|
+
def expand_path(path, rel=File.dirname(__FILE__))
|
11
|
+
File.expand_path(path, rel)
|
12
|
+
end
|
13
|
+
|
14
|
+
test "creating with a non-existant file" do
|
15
|
+
index = Ronn::Index.new(@missing_path)
|
16
|
+
assert_equal @missing_path, index.path
|
17
|
+
assert_equal 0, index.size
|
18
|
+
assert index.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
test "creating with an index file and no block" do
|
22
|
+
index = Ronn::Index.new(@index_path)
|
23
|
+
assert_equal 3, index.size
|
24
|
+
assert_equal 2, index.manuals.size
|
25
|
+
|
26
|
+
ref = index.references[0]
|
27
|
+
assert_equal 'basic_document(7)', ref.name
|
28
|
+
assert_equal 'basic_document.ronn', ref.location
|
29
|
+
assert_equal 'basic_document.html', ref.url
|
30
|
+
assert_equal expand_path('basic_document.ronn'), ref.path
|
31
|
+
assert ref.manual?
|
32
|
+
assert ref.ronn?
|
33
|
+
assert !ref.remote?
|
34
|
+
|
35
|
+
ref = index.references[1]
|
36
|
+
assert_equal 'definition_list_syntax(5)', ref.name
|
37
|
+
assert_equal 'definition_list_syntax.ronn', ref.location
|
38
|
+
assert_equal 'definition_list_syntax.html', ref.url
|
39
|
+
assert_equal expand_path('definition_list_syntax.ronn'), ref.path
|
40
|
+
|
41
|
+
ref = index.references[2]
|
42
|
+
assert_equal 'grep(1)', ref.name
|
43
|
+
assert_equal 'http://man.cx/grep(1)', ref.url
|
44
|
+
assert ref.manual?
|
45
|
+
assert ref.remote?
|
46
|
+
assert !ref.ronn?
|
47
|
+
end
|
48
|
+
|
49
|
+
test "creating with a block reader" do
|
50
|
+
index = Ronn::Index.new(@index_path) { "hello(1) hello.1.ronn" }
|
51
|
+
assert_equal @index_path, index.path
|
52
|
+
assert_equal 1, index.size
|
53
|
+
ref = index.first
|
54
|
+
assert_equal 'hello(1)', ref.name
|
55
|
+
assert_equal 'hello.1.ronn', ref.location
|
56
|
+
assert_equal 'hello.1.html', ref.url
|
57
|
+
assert_equal expand_path('hello.1.ronn'), ref.path
|
58
|
+
end
|
59
|
+
|
60
|
+
test "adding manual paths" do
|
61
|
+
index = Ronn::Index.new(@index_path)
|
62
|
+
index << expand_path("angle_bracket_syntax.ronn")
|
63
|
+
assert_equal 'angle_bracket_syntax(5)', index.last.name
|
64
|
+
assert_equal expand_path('angle_bracket_syntax.ronn'), index.last.path
|
65
|
+
end
|
66
|
+
|
67
|
+
test "adding manual paths that are already present" do
|
68
|
+
index = Ronn::Index.new(@index_path)
|
69
|
+
size = index.size
|
70
|
+
index << expand_path("basic_document.ronn")
|
71
|
+
assert_equal size, index.size
|
72
|
+
end
|
73
|
+
end
|