ronn-ng 0.10.0.pre.SNAPSHOT → 0.10.1.pre2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS +11 -7
  3. data/CHANGES +12 -1
  4. data/INSTALLING.md +29 -27
  5. data/LICENSE.txt +1 -1
  6. data/README.md +48 -32
  7. data/Rakefile +1 -1
  8. data/bin/ronn +1 -1
  9. data/lib/ronn/document.rb +4 -1
  10. data/lib/ronn/roff.rb +8 -0
  11. data/lib/ronn/template/default.html +1 -1
  12. data/lib/ronn.rb +4 -6
  13. data/man/index.html +14 -14
  14. data/man/index.txt +9 -9
  15. data/man/ronn-format.7 +7 -7
  16. data/man/ronn.1 +25 -25
  17. data/man/ronn.1.ronn +7 -6
  18. data/ronn-ng.gemspec +6 -59
  19. metadata +19 -70
  20. data/Gemfile +0 -2
  21. data/test/angle_bracket_syntax.html +0 -27
  22. data/test/angle_bracket_syntax.ronn +0 -22
  23. data/test/backticks.html +0 -14
  24. data/test/backticks.ronn +0 -10
  25. data/test/basic_document.html +0 -8
  26. data/test/basic_document.ronn +0 -4
  27. data/test/circumflexes.ronn +0 -1
  28. data/test/code_blocks.ronn +0 -41
  29. data/test/contest.rb +0 -70
  30. data/test/custom_title_document.html +0 -6
  31. data/test/custom_title_document.ronn +0 -5
  32. data/test/definition_list_syntax.html +0 -25
  33. data/test/definition_list_syntax.roff +0 -19
  34. data/test/definition_list_syntax.ronn +0 -18
  35. data/test/dots_at_line_start_test.roff +0 -19
  36. data/test/dots_at_line_start_test.ronn +0 -12
  37. data/test/ellipses.roff +0 -7
  38. data/test/ellipses.ronn +0 -7
  39. data/test/entity_encoding_test.html +0 -42
  40. data/test/entity_encoding_test.roff +0 -51
  41. data/test/entity_encoding_test.ronn +0 -34
  42. data/test/index.txt +0 -8
  43. data/test/markdown_syntax.html +0 -954
  44. data/test/markdown_syntax.roff +0 -907
  45. data/test/markdown_syntax.ronn +0 -881
  46. data/test/middle_paragraph.html +0 -14
  47. data/test/middle_paragraph.roff +0 -9
  48. data/test/middle_paragraph.ronn +0 -10
  49. data/test/missing_spaces.roff +0 -7
  50. data/test/missing_spaces.ronn +0 -2
  51. data/test/nested_list.ronn +0 -19
  52. data/test/nested_list_with_code.html +0 -14
  53. data/test/nested_list_with_code.roff +0 -11
  54. data/test/nested_list_with_code.ronn +0 -6
  55. data/test/ordered_list.html +0 -28
  56. data/test/ordered_list.roff +0 -25
  57. data/test/ordered_list.ronn +0 -21
  58. data/test/page.with.periods.in.name.5.ronn +0 -4
  59. data/test/pre_block_with_quotes.roff +0 -8
  60. data/test/pre_block_with_quotes.ronn +0 -6
  61. data/test/section_reference_links.html +0 -16
  62. data/test/section_reference_links.roff +0 -7
  63. data/test/section_reference_links.ronn +0 -12
  64. data/test/tables.ronn +0 -24
  65. data/test/test_ronn.rb +0 -124
  66. data/test/test_ronn_document.rb +0 -186
  67. data/test/test_ronn_index.rb +0 -73
  68. data/test/titleless_document.html +0 -9
  69. data/test/titleless_document.ronn +0 -3
  70. data/test/underline_spacing_test.roff +0 -13
  71. data/test/underline_spacing_test.ronn +0 -11
@@ -1,14 +0,0 @@
1
- <div class='mp'>
2
-
3
- <h2 id="NAME">NAME</h2>
4
- <p class="man-name">
5
- <code>test</code> - <span class="man-whatis">just a ronn test</span>
6
- </p>
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>&amp;&amp;</code>/<code>||</code> instead.</p>
12
-
13
- <p>Bar</p>
14
- </div>
@@ -1,9 +0,0 @@
1
- .TH "TEST" "1" "January 1979" ""
2
- .SH "NAME"
3
- \fBtest\fR \- just a ronn test
4
- .SH "TEST"
5
- Foo
6
- .P
7
- 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\.
8
- .P
9
- Bar
@@ -1,10 +0,0 @@
1
- test(1) -- just a ronn test
2
- ==========================
3
-
4
- ## TEST
5
-
6
- Foo
7
-
8
- Always use `attr_reader`, `attr_writer` or `attr_accessor`. Do not use `for...in`; use each instead. Do not use `and`/`or`; use `&&`/`||` instead.
9
-
10
- Bar
@@ -1,7 +0,0 @@
1
- .TH "MISSING_SPACES" "" "January 1979" ""
2
- .SH "NAME"
3
- \fBmissing_spaces\fR
4
- .TP
5
- \fB\-S\fR \fItext\fR, \fBsearch\fR \fItext\fR
6
- Performs a substring search of formula names for \fItext\fR\.
7
-
@@ -1,2 +0,0 @@
1
- * `-S` <text>, `search` <text>:
2
- Performs a substring search of formula names for <text>.
@@ -1,19 +0,0 @@
1
- nested_list test
2
- ================
3
-
4
- ## TEST
5
-
6
- * foo:
7
- Blablabla.
8
-
9
- * bar:
10
- Blablabla.
11
-
12
- - bar-foo:
13
- Bububu.
14
-
15
- - bar-baz:
16
- Bububu.
17
-
18
- * baz:
19
- Blablabla.
@@ -1,14 +0,0 @@
1
- <div class='mp'>
2
-
3
- <h1 id="a-1-">a(1)</h1>
4
- <ul>
5
- <li>
6
- <code>toggle_status</code>
7
- <ul>
8
- <li>Toggle the display of the status bar.</li>
9
- </ul>
10
- </li>
11
- <li>
12
- <code>spawn &lt;executable&gt; &lt;additional args&gt;</code> TODO explain path-alike expansion</li>
13
- </ul>
14
- </div>
@@ -1,11 +0,0 @@
1
- .TH "NESTED_LIST_WITH_CODE" "" "January 1979" ""
2
- .IP "\(bu" 4
3
- \fBtoggle_status\fR
4
- .IP "\(bu" 4
5
- Toggle the display of the status bar\.
6
- .IP "" 0
7
-
8
- .IP "\(bu" 4
9
- \fBspawn <executable> <additional args>\fR TODO explain path\-alike expansion
10
- .IP "" 0
11
-
@@ -1,6 +0,0 @@
1
- a(1)
2
- ====
3
-
4
- * `toggle_status`
5
- - Toggle the display of the status bar.
6
- * `spawn <executable> <additional args>` TODO explain path-alike expansion
@@ -1,28 +0,0 @@
1
- <div class='mp'>
2
-
3
- <h1 id="Ordered-Lists">Ordered Lists</h1>
4
- <h2 id="Simple-ordered-lists">Simple ordered lists</h2>
5
-
6
- <h3 id="One-item-list">One-item list</h3>
7
-
8
- <ol>
9
- <li>Hello, world!</li>
10
- </ol>
11
-
12
- <h3 id="Three-item-list">Three-item list</h3>
13
-
14
- <ol>
15
- <li>Hello, world!</li>
16
- <li>Item 2</li>
17
- <li>Item 3</li>
18
- </ol>
19
-
20
- <h3 id="Four-item-list-with-all-1s">Four-item list with all 1s</h3>
21
-
22
- <ol>
23
- <li>Item 1</li>
24
- <li>Item 2</li>
25
- <li>Item 3</li>
26
- <li>Item 4</li>
27
- </ol>
28
- </div>
@@ -1,25 +0,0 @@
1
- .TH "ORDERED_LIST" "" "January 1979" ""
2
- .SH "Simple ordered lists"
3
- .SS "One\-item list"
4
- .IP "1." 4
5
- Hello, world!
6
- .IP "" 0
7
- .SS "Three\-item list"
8
- .IP "1." 4
9
- Hello, world!
10
- .IP "2." 4
11
- Item 2
12
- .IP "3." 4
13
- Item 3
14
- .IP "" 0
15
- .SS "Four\-item list with all 1s"
16
- .IP "1." 4
17
- Item 1
18
- .IP "2." 4
19
- Item 2
20
- .IP "3." 4
21
- Item 3
22
- .IP "4." 4
23
- Item 4
24
- .IP "" 0
25
-
@@ -1,21 +0,0 @@
1
- Ordered Lists
2
- =============
3
-
4
- ## Simple ordered lists
5
-
6
- ### One-item list
7
-
8
- 1. Hello, world!
9
-
10
- ### Three-item list
11
-
12
- 1. Hello, world!
13
- 2. Item 2
14
- 3. Item 3
15
-
16
- ### Four-item list with all 1s
17
-
18
- 1. Item 1
19
- 1. Item 2
20
- 1. Item 3
21
- 1. Item 4
@@ -1,4 +0,0 @@
1
- Example
2
- =======
3
-
4
- Hello, world!
@@ -1,8 +0,0 @@
1
- .TH "T" "1" "January 1979" ""
2
- .SH "NAME"
3
- \fBt\fR \- test
4
- .SH "test"
5
- .nf
6
- [ "$11" ]
7
- .fi
8
-
@@ -1,6 +0,0 @@
1
- t(1) - test
2
- ===========
3
-
4
- ## test
5
-
6
- [ "$11" ]
@@ -1,16 +0,0 @@
1
- <div class='mp'>
2
-
3
- <h2 id="NAME">NAME</h2>
4
- <p class="man-name">
5
- <code>section_reference_links</code> - <span class="man-whatis">linking to sections</span>
6
- </p>
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">like this</a></p>
16
- </div>
@@ -1,7 +0,0 @@
1
- .TH "SECTION_REFERENCE_LINKS" "1" "January 1979" ""
2
- .SH "NAME"
3
- \fBsection_reference_links\fR \- linking to sections
4
- .SH "SECTION 1"
5
- See the following section\.
6
- .SH "SECTION 2"
7
- See \fISECTION 1\fR or \fIto put it another way\fR or even \fIlike this\fR
@@ -1,12 +0,0 @@
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 [like this](#SECTION-1)
data/test/tables.ronn DELETED
@@ -1,24 +0,0 @@
1
- Hello, world with tables
2
- ========================
3
-
4
-
5
- ## Simple table
6
-
7
- | Syntax | Description |
8
- | ----------- | ----------- |
9
- | Header | Title |
10
- | Paragraph | Text |
11
-
12
- ## Table with column alignment
13
-
14
- | Syntax | Description | Test Text With A Long Header Name |
15
- | :--- | :----: | ---: |
16
- | Header | Title | Here's this |
17
- | Paragraph | Text | And more |
18
-
19
- ## Table with embedded markup
20
-
21
- | Header |
22
- | ------ |
23
- | Code: `some code` |
24
- | Emphasis: *foo* and *bar* |
data/test/test_ronn.rb DELETED
@@ -1,124 +0,0 @@
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
- $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.any? { |path| File.expand_path(path) == libdir }
13
- ENV['RUBYLIB'] = $LOAD_PATH.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 5, 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 %(.TH "HELLO" "1" "November 2009" ""), lines.shift
24
- assert_equal %(.SH "NAME"), lines.shift
25
- assert_equal %(\\fBhello\\fR \\- hello world), lines.shift
26
- assert_equal 0, lines.size
27
- end
28
-
29
- def canonicalize(text)
30
- text
31
- .gsub(/^ +/, '')
32
- .gsub(/\n/m, '')
33
- .gsub(/ +/, ' ')
34
- .tr('"', "'")
35
- end
36
-
37
- def flunk_with_diff(dest, wrong, output)
38
- File.open(wrong, 'wb') { |f| f.write(output) }
39
- if ENV['RONN_QUIET_TEST'] == '1'
40
- flunk 'Output did not match expected.'
41
- else
42
- diff = `diff -u #{dest} #{wrong} 2>/dev/null`
43
- flunk diff
44
- end
45
- end
46
-
47
- test 'produces html instead of roff with the --html argument' do
48
- output = `echo '# hello(1) -- hello world' | ronn --html`
49
- output = canonicalize(output)
50
- assert_match(/<h2 id='NAME'>NAME<\/h2>/, output)
51
- advertising = "<meta name='generator' content='Ronn-NG/v" + Ronn.version +
52
- ' (http://github.com/apjanke/ronn-ng/tree/' + Ronn.revision + ")'>"
53
- assert_match(/#{Regexp.escape(advertising)}/, output)
54
- end
55
-
56
- test 'produces html fragment with the --fragment argument' do
57
- output = `echo '# hello(1) -- hello world' | ronn --fragment`
58
- assert_equal [
59
- "<div class='mp'>",
60
- "<h2 id='NAME'>NAME</h2>",
61
- "<p class='man-name'><code>hello</code>",
62
- " - <span class='man-whatis'>hello world</span>",
63
- '</p></div>'
64
- ].join, canonicalize(output)
65
- end
66
-
67
- test 'abides by the RONN_MANUAL environment variable' do
68
- output = `echo '# hello(1) -- hello world' | RONN_MANUAL='Some Manual' ronn --html`
69
- assert_match(/Some Manual/, output)
70
- end
71
-
72
- test 'abides by the RONN_DATE environment variable' do
73
- output = `echo '# hello(1) -- hello world' | RONN_DATE=1979-01-01 ronn --html`
74
- assert_match(/January 1979/, output)
75
- end
76
-
77
- test 'abides by the RONN_ORGANIZATION environment variable' do
78
- output = `echo '# hello(1) -- hello world' | RONN_ORGANIZATION='GitHub' ronn --html`
79
- assert_match(/GitHub/, output)
80
- end
81
-
82
- # ronn -> HTML file based tests
83
- Dir[testdir + '/*.ronn'].each do |source|
84
- dest = source.sub(/ronn$/, 'html')
85
- next unless File.exist?(dest)
86
-
87
- wrong = dest + '.wrong'
88
- test File.basename(source, '.ronn') + ' HTML' do
89
- output = `ronn --pipe --html --fragment #{source}`
90
- expected = begin
91
- File.read(dest)
92
- rescue IOError
93
- ''
94
- end
95
- if expected != output
96
- flunk_with_diff(dest, wrong, output)
97
- elsif File.exist?(wrong)
98
- File.unlink(wrong)
99
- end
100
- end
101
- end
102
-
103
- # ronn -> roff file based tests
104
- Dir[testdir + '/*.ronn'].each do |source|
105
- dest = source.sub(/ronn$/, 'roff')
106
- next unless File.exist?(dest)
107
-
108
- wrong = dest + '.wrong'
109
- test File.basename(source, '.ronn') + ' roff' do
110
- output = `ronn --pipe --roff --date=1979-01-01 #{source}`
111
- .split("\n", 3).last # remove ronn version comments
112
- expected = begin
113
- File.read(dest)
114
- rescue IOError
115
- ''
116
- end
117
- if expected != output
118
- flunk_with_diff(dest, wrong, output)
119
- elsif File.exist?(wrong)
120
- File.unlink(wrong)
121
- end
122
- end
123
- end
124
- end
@@ -1,186 +0,0 @@
1
- require 'contest'
2
- require 'ronn/document'
3
-
4
- class DocumentTest < Test::Unit::TestCase
5
- SIMPLE_FILE = "#{File.dirname(__FILE__)}/basic_document.ronn".freeze
6
-
7
- def canonicalize(text)
8
- text
9
- .gsub(/^ +/, '')
10
- .gsub(/\n/m, '')
11
- .gsub(/ +/, ' ')
12
- .tr('"', "'")
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(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('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', __dir__))
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
@@ -1,73 +0,0 @@
1
- require 'contest'
2
- require 'ronn'
3
-
4
- class IndexTest < Test::Unit::TestCase
5
- setup do
6
- @index_path = File.expand_path('index.txt', __dir__)
7
- @missing_path = File.expand_path('missing-index.txt', __dir__)
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-existent 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
@@ -1,9 +0,0 @@
1
- <div class='mp'>
2
- <h2 id="NAME">NAME</h2>
3
- <p class="man-name">
4
- <code>titleless_document</code>
5
- </p>
6
- <p>This is a document without a level 1 heading. It generates
7
- a <code>NAME</code> section from the filename but does not include an
8
- <code>&lt;h1&gt;</code> element.</p>
9
- </div>
@@ -1,3 +0,0 @@
1
- This is a document without a level 1 heading. It generates
2
- a `NAME` section from the filename but does not include an
3
- `<h1>` element.