rdoc 3.9.5 → 3.10.pre.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (183) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +6 -3
  3. data/History.txt +63 -13
  4. data/LICENSE.rdoc +57 -0
  5. data/Manifest.txt +60 -6
  6. data/Rakefile +24 -12
  7. data/TODO.rdoc +30 -0
  8. data/bin/rdoc +0 -2
  9. data/lib/rdoc.rb +55 -2
  10. data/lib/rdoc/alias.rb +0 -2
  11. data/lib/rdoc/anon_class.rb +0 -2
  12. data/lib/rdoc/any_method.rb +0 -3
  13. data/lib/rdoc/attr.rb +0 -2
  14. data/lib/rdoc/class_module.rb +40 -7
  15. data/lib/rdoc/code_object.rb +1 -3
  16. data/lib/rdoc/code_objects.rb +3 -21
  17. data/lib/rdoc/comment.rb +225 -0
  18. data/lib/rdoc/constant.rb +0 -2
  19. data/lib/rdoc/context.rb +37 -120
  20. data/lib/rdoc/context/section.rb +114 -0
  21. data/lib/rdoc/cross_reference.rb +16 -7
  22. data/lib/rdoc/encoding.rb +0 -2
  23. data/lib/rdoc/gauntlet.rb +1 -1
  24. data/lib/rdoc/generator.rb +7 -2
  25. data/lib/rdoc/generator/darkfish.rb +126 -20
  26. data/lib/rdoc/generator/json_index.rb +240 -0
  27. data/lib/rdoc/generator/markup.rb +17 -54
  28. data/lib/rdoc/generator/ri.rb +0 -3
  29. data/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  30. data/lib/rdoc/generator/template/darkfish/_head.rhtml +16 -0
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +18 -0
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +9 -0
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +8 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +16 -0
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +12 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +7 -0
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +12 -0
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +10 -0
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +10 -0
  40. data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +10 -0
  41. data/lib/rdoc/generator/template/darkfish/class.rhtml +161 -0
  42. data/lib/rdoc/generator/template/darkfish/fileinfo.rhtml +32 -0
  43. data/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  44. data/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  45. data/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  46. data/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  47. data/lib/rdoc/generator/template/darkfish/index.rhtml +16 -61
  48. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +99 -64
  49. data/lib/rdoc/generator/template/darkfish/js/jquery.js +15 -29
  50. data/lib/rdoc/generator/template/darkfish/js/search.js +94 -0
  51. data/lib/rdoc/generator/template/darkfish/page.rhtml +16 -0
  52. data/lib/rdoc/generator/template/darkfish/rdoc.css +126 -286
  53. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +50 -0
  54. data/lib/rdoc/generator/template/json_index/js/navigation.js +142 -0
  55. data/lib/rdoc/generator/template/json_index/js/searcher.js +228 -0
  56. data/lib/rdoc/ghost_method.rb +0 -2
  57. data/lib/rdoc/include.rb +0 -2
  58. data/lib/rdoc/markup.rb +204 -43
  59. data/lib/rdoc/markup/attr_changer.rb +25 -0
  60. data/lib/rdoc/markup/attr_span.rb +29 -0
  61. data/lib/rdoc/markup/attribute.rb +51 -0
  62. data/lib/rdoc/markup/document.rb +22 -1
  63. data/lib/rdoc/markup/formatter.rb +4 -11
  64. data/lib/rdoc/markup/formatter_test_case.rb +1 -2
  65. data/lib/rdoc/markup/heading.rb +44 -0
  66. data/lib/rdoc/markup/include.rb +42 -0
  67. data/lib/rdoc/markup/inline.rb +1 -144
  68. data/lib/rdoc/markup/list.rb +2 -1
  69. data/lib/rdoc/markup/parser.rb +6 -16
  70. data/lib/rdoc/markup/pre_process.rb +64 -10
  71. data/lib/rdoc/markup/raw.rb +1 -1
  72. data/lib/rdoc/markup/special.rb +40 -0
  73. data/lib/rdoc/markup/text_formatter_test_case.rb +0 -2
  74. data/lib/rdoc/markup/to_ansi.rb +0 -2
  75. data/lib/rdoc/markup/to_bs.rb +0 -2
  76. data/lib/rdoc/markup/to_html.rb +102 -34
  77. data/lib/rdoc/markup/to_html_crossref.rb +36 -5
  78. data/lib/rdoc/markup/to_html_snippet.rb +270 -0
  79. data/lib/rdoc/markup/to_label.rb +55 -0
  80. data/lib/rdoc/markup/to_rdoc.rb +0 -3
  81. data/lib/rdoc/markup/to_table_of_contents.rb +62 -0
  82. data/lib/rdoc/markup/to_test.rb +0 -3
  83. data/lib/rdoc/markup/to_tt_only.rb +0 -3
  84. data/lib/rdoc/markup/verbatim.rb +18 -0
  85. data/lib/rdoc/meta_method.rb +0 -2
  86. data/lib/rdoc/method_attr.rb +17 -1
  87. data/lib/rdoc/normal_class.rb +0 -2
  88. data/lib/rdoc/normal_module.rb +0 -2
  89. data/lib/rdoc/options.rb +18 -3
  90. data/lib/rdoc/parser.rb +74 -42
  91. data/lib/rdoc/parser/c.rb +79 -118
  92. data/lib/rdoc/parser/rd.rb +22 -0
  93. data/lib/rdoc/parser/ruby.rb +86 -54
  94. data/lib/rdoc/parser/simple.rb +21 -9
  95. data/lib/rdoc/parser/text.rb +11 -0
  96. data/lib/rdoc/rd.rb +95 -0
  97. data/lib/rdoc/rd/block_parser.ry +638 -0
  98. data/lib/rdoc/rd/inline.rb +71 -0
  99. data/lib/rdoc/rd/inline_parser.ry +575 -0
  100. data/lib/rdoc/rdoc.rb +8 -23
  101. data/lib/rdoc/require.rb +0 -2
  102. data/lib/rdoc/ri.rb +4 -2
  103. data/lib/rdoc/ri/driver.rb +2 -6
  104. data/lib/rdoc/ri/store.rb +0 -1
  105. data/lib/rdoc/ruby_lex.rb +43 -20
  106. data/lib/rdoc/ruby_token.rb +44 -2
  107. data/lib/rdoc/single_class.rb +0 -2
  108. data/lib/rdoc/stats.rb +0 -5
  109. data/lib/rdoc/task.rb +2 -6
  110. data/lib/rdoc/test_case.rb +59 -0
  111. data/lib/rdoc/text.rb +42 -30
  112. data/lib/rdoc/token_stream.rb +45 -0
  113. data/lib/rdoc/tom_doc.rb +232 -0
  114. data/lib/rdoc/top_level.rb +36 -4
  115. data/test/test_attribute_manager.rb +26 -29
  116. data/test/test_rdoc_any_method.rb +2 -26
  117. data/test/test_rdoc_attr.rb +4 -4
  118. data/test/test_rdoc_class_module.rb +95 -12
  119. data/test/test_rdoc_code_object.rb +10 -3
  120. data/test/test_rdoc_comment.rb +504 -0
  121. data/test/test_rdoc_context.rb +60 -11
  122. data/test/test_rdoc_context_section.rb +16 -17
  123. data/test/test_rdoc_cross_reference.rb +17 -2
  124. data/test/test_rdoc_encoding.rb +4 -7
  125. data/test/test_rdoc_generator_darkfish.rb +12 -11
  126. data/test/test_rdoc_generator_json_index.rb +255 -0
  127. data/test/test_rdoc_generator_markup.rb +56 -0
  128. data/test/test_rdoc_generator_ri.rb +8 -11
  129. data/test/test_rdoc_markup.rb +9 -5
  130. data/test/test_rdoc_markup_attribute_manager.rb +5 -8
  131. data/test/test_rdoc_markup_document.rb +34 -6
  132. data/test/test_rdoc_markup_formatter.rb +11 -13
  133. data/test/test_rdoc_markup_heading.rb +20 -0
  134. data/test/test_rdoc_markup_include.rb +19 -0
  135. data/test/test_rdoc_markup_indented_paragraph.rb +4 -5
  136. data/test/test_rdoc_markup_paragraph.rb +2 -5
  137. data/test/test_rdoc_markup_parser.rb +87 -7
  138. data/test/test_rdoc_markup_pre_process.rb +60 -9
  139. data/test/test_rdoc_markup_raw.rb +4 -6
  140. data/test/test_rdoc_markup_to_ansi.rb +1 -4
  141. data/test/test_rdoc_markup_to_bs.rb +1 -4
  142. data/test/test_rdoc_markup_to_html.rb +170 -31
  143. data/test/test_rdoc_markup_to_html_crossref.rb +89 -11
  144. data/test/test_rdoc_markup_to_html_snippet.rb +668 -0
  145. data/test/test_rdoc_markup_to_label.rb +50 -0
  146. data/test/test_rdoc_markup_to_rdoc.rb +1 -4
  147. data/test/test_rdoc_markup_to_table_of_contents.rb +90 -0
  148. data/test/test_rdoc_markup_to_tt_only.rb +1 -4
  149. data/test/test_rdoc_markup_verbatim.rb +16 -0
  150. data/test/test_rdoc_method_attr.rb +16 -1
  151. data/test/test_rdoc_options.rb +17 -7
  152. data/test/test_rdoc_parser.rb +75 -6
  153. data/test/test_rdoc_parser_c.rb +56 -104
  154. data/test/test_rdoc_parser_rd.rb +52 -0
  155. data/test/test_rdoc_parser_ruby.rb +264 -323
  156. data/test/test_rdoc_parser_simple.rb +33 -17
  157. data/test/test_rdoc_rd.rb +30 -0
  158. data/test/test_rdoc_rd_block_parser.rb +527 -0
  159. data/test/test_rdoc_rd_inline.rb +63 -0
  160. data/test/test_rdoc_rd_inline_parser.rb +173 -0
  161. data/test/test_rdoc_rdoc.rb +7 -9
  162. data/test/test_rdoc_ri_driver.rb +10 -15
  163. data/test/test_rdoc_ri_paths.rb +6 -6
  164. data/test/test_rdoc_ri_store.rb +6 -13
  165. data/test/test_rdoc_ruby_lex.rb +53 -5
  166. data/test/test_rdoc_rubygems_hook.rb +2 -1
  167. data/test/test_rdoc_stats.rb +83 -103
  168. data/test/test_rdoc_task.rb +5 -4
  169. data/test/test_rdoc_text.rb +156 -11
  170. data/test/test_rdoc_token_stream.rb +42 -0
  171. data/test/test_rdoc_tom_doc.rb +458 -0
  172. data/test/test_rdoc_top_level.rb +49 -2
  173. data/test/xref_test_case.rb +4 -8
  174. metadata +217 -111
  175. metadata.gz.sig +0 -0
  176. checksums.yaml +0 -7
  177. checksums.yaml.gz.sig +0 -0
  178. data/CVE-2013-0256.rdoc +0 -49
  179. data/LICENSE.txt +0 -57
  180. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +0 -321
  181. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +0 -124
  182. data/lib/rdoc/generator/template/darkfish/js/quicksearch.js +0 -114
  183. data/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +0 -10
@@ -1,16 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
- require 'tempfile'
4
- require 'rubygems'
5
- require 'minitest/autorun'
6
- require 'rdoc/markup/pre_process'
7
- require 'rdoc/code_objects'
8
- require 'rdoc/options'
3
+ require 'rdoc/test_case'
9
4
 
10
- class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
5
+ class TestRDocMarkupPreProcess < RDoc::TestCase
11
6
 
12
7
  def setup
13
- RDoc::Markup::PreProcess.registered.clear
8
+ super
14
9
 
15
10
  @tempfile = Tempfile.new 'test_rdoc_markup_pre_process'
16
11
  @file_name = File.basename @tempfile.path
@@ -20,11 +15,23 @@ class TestRDocMarkupPreProcess < MiniTest::Unit::TestCase
20
15
  end
21
16
 
22
17
  def teardown
23
- RDoc::Markup::PreProcess.registered.clear
18
+ super
24
19
 
25
20
  @tempfile.close
26
21
  end
27
22
 
23
+ def test_class_register
24
+ RDoc::Markup::PreProcess.register 'for_test' do raise 'fail' end
25
+
26
+ assert_equal %w[for_test], RDoc::Markup::PreProcess.registered.keys
27
+ end
28
+
29
+ def test_class_post_process
30
+ RDoc::Markup::PreProcess.post_process do end
31
+
32
+ assert_equal 1, RDoc::Markup::PreProcess.post_processors.length
33
+ end
34
+
28
35
  def test_include_file
29
36
  @tempfile.write <<-INCLUDE
30
37
  # -*- mode: rdoc; coding: utf-8; fill-column: 74; -*-
@@ -83,6 +90,50 @@ contents of a string.
83
90
  assert_equal "#\n", text
84
91
  end
85
92
 
93
+ def test_handle_comment
94
+ text = "# :main: M\n"
95
+ c = comment text
96
+
97
+ out = @pp.handle c
98
+
99
+ assert_same out, text
100
+ assert_equal "#\n", text
101
+ end
102
+
103
+ def test_handle_markup
104
+ c = comment ':markup: rd'
105
+
106
+ @pp.handle c
107
+
108
+ assert_equal 'rd', c.format
109
+ end
110
+
111
+ def test_handle_markup_empty
112
+ c = comment ':markup:'
113
+
114
+ @pp.handle c
115
+
116
+ assert_equal 'rdoc', c.format
117
+ end
118
+
119
+ def test_handle_post_process
120
+ cd = RDoc::CodeObject.new
121
+
122
+ RDoc::Markup::PreProcess.post_process do |text, code_object|
123
+ code_object.metadata[:stuff] = text
124
+
125
+ :junk
126
+ end
127
+
128
+ text = "# a b c\n"
129
+
130
+ out = @pp.handle text, cd
131
+
132
+ assert_same out, text
133
+ assert_equal "# a b c\n", text
134
+ assert_equal "# a b c\n", cd.metadata[:stuff]
135
+ end
136
+
86
137
  def test_handle_unregistered
87
138
  text = "# :x: y\n"
88
139
  out = @pp.handle text
@@ -1,12 +1,10 @@
1
- require 'pp'
2
- require 'rubygems'
3
- require 'minitest/autorun'
4
- require 'rdoc/markup'
1
+ require 'rdoc/test_case'
5
2
 
6
- class TestRDocMarkupRaw < MiniTest::Unit::TestCase
3
+ class TestRDocMarkupRaw < RDoc::TestCase
7
4
 
8
5
  def setup
9
- @RM = RDoc::Markup
6
+ super
7
+
10
8
  @p = @RM::Raw.new
11
9
  end
12
10
 
@@ -1,7 +1,4 @@
1
- require 'rubygems'
2
- require 'rdoc/markup/text_formatter_test_case'
3
- require 'rdoc/markup/to_ansi'
4
- require 'minitest/autorun'
1
+ require 'rdoc/test_case'
5
2
 
6
3
  class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
7
4
 
@@ -1,7 +1,4 @@
1
- require 'rubygems'
2
- require 'rdoc/markup/text_formatter_test_case'
3
- require 'rdoc/markup/to_bs'
4
- require 'minitest/autorun'
1
+ require 'rdoc/test_case'
5
2
 
6
3
  class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
7
4
 
@@ -1,7 +1,4 @@
1
- require 'rubygems'
2
- require 'rdoc/markup/formatter_test_case'
3
- require 'rdoc/markup/to_html'
4
- require 'minitest/autorun'
1
+ require 'rdoc/test_case'
5
2
 
6
3
  class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
7
4
 
@@ -35,31 +32,32 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
35
32
  end
36
33
 
37
34
  def accept_heading
38
- assert_equal "\n<h5>Hello</h5>\n", @to.res.join
35
+ assert_equal "\n<h5 id=\"label-Hello\">Hello</h5>\n", @to.res.join
39
36
  end
40
37
 
41
38
  def accept_heading_1
42
- assert_equal "\n<h1>Hello</h1>\n", @to.res.join
39
+ assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join
43
40
  end
44
41
 
45
42
  def accept_heading_2
46
- assert_equal "\n<h2>Hello</h2>\n", @to.res.join
43
+ assert_equal "\n<h2 id=\"label-Hello\">Hello</h2>\n", @to.res.join
47
44
  end
48
45
 
49
46
  def accept_heading_3
50
- assert_equal "\n<h3>Hello</h3>\n", @to.res.join
47
+ assert_equal "\n<h3 id=\"label-Hello\">Hello</h3>\n", @to.res.join
51
48
  end
52
49
 
53
50
  def accept_heading_4
54
- assert_equal "\n<h4>Hello</h4>\n", @to.res.join
51
+ assert_equal "\n<h4 id=\"label-Hello\">Hello</h4>\n", @to.res.join
55
52
  end
56
53
 
57
54
  def accept_heading_b
58
- assert_equal "\n<h1><b>Hello</b></h1>\n", @to.res.join
55
+ assert_equal "\n<h1 id=\"label-Hello\"><strong>Hello</strong></h1>\n",
56
+ @to.res.join
59
57
  end
60
58
 
61
59
  def accept_heading_suppressed_crossref
62
- assert_equal "\n<h1>Hello</h1>\n", @to.res.join
60
+ assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join
63
61
  end
64
62
 
65
63
  def accept_list_end_bullet
@@ -73,14 +71,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
73
71
  assert_equal [], @to.list
74
72
  assert_equal [], @to.in_list_entry
75
73
 
76
- assert_equal "<dl class=\"rdoc-list\"></dl>\n", @to.res.join
74
+ assert_equal "<dl class=\"rdoc-list label-list\"></dl>\n", @to.res.join
77
75
  end
78
76
 
79
77
  def accept_list_end_lalpha
80
78
  assert_equal [], @to.list
81
79
  assert_equal [], @to.in_list_entry
82
80
 
83
- assert_equal "<ol style=\"display: lower-alpha\"></ol>\n", @to.res.join
81
+ assert_equal "<ol style=\"list-style-type: lower-alpha\"></ol>\n", @to.res.join
84
82
  end
85
83
 
86
84
  def accept_list_end_number
@@ -94,14 +92,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
94
92
  assert_equal [], @to.list
95
93
  assert_equal [], @to.in_list_entry
96
94
 
97
- assert_equal "<table class=\"rdoc-list\"></table>\n", @to.res.join
95
+ assert_equal "<dl class=\"rdoc-list note-list\"></dl>\n", @to.res.join
98
96
  end
99
97
 
100
98
  def accept_list_end_ualpha
101
99
  assert_equal [], @to.list
102
100
  assert_equal [], @to.in_list_entry
103
101
 
104
- assert_equal "<ol style=\"display: upper-alpha\"></ol>\n", @to.res.join
102
+ assert_equal "<ol style=\"list-style-type: upper-alpha\"></ol>\n", @to.res.join
105
103
  end
106
104
 
107
105
  def accept_list_item_end_bullet
@@ -117,7 +115,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
117
115
  end
118
116
 
119
117
  def accept_list_item_end_note
120
- assert_equal %w[</td></tr>], @to.in_list_entry
118
+ assert_equal %w[</dd>], @to.in_list_entry
121
119
  end
122
120
 
123
121
  def accept_list_item_end_number
@@ -133,24 +131,24 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
133
131
  end
134
132
 
135
133
  def accept_list_item_start_label
136
- assert_equal "<dl class=\"rdoc-list\"><dt>cat</dt>\n<dd>", @to.res.join
134
+ assert_equal "<dl class=\"rdoc-list label-list\"><dt>cat\n<dd>", @to.res.join
137
135
  end
138
136
 
139
137
  def accept_list_item_start_lalpha
140
- assert_equal "<ol style=\"display: lower-alpha\"><li>", @to.res.join
138
+ assert_equal "<ol style=\"list-style-type: lower-alpha\"><li>", @to.res.join
141
139
  end
142
140
 
143
141
  def accept_list_item_start_note
144
- assert_equal "<table class=\"rdoc-list\"><tr><td class=\"rdoc-term\"><p>cat</p></td>\n<td>",
142
+ assert_equal "<dl class=\"rdoc-list note-list\"><dt>cat\n<dd>",
145
143
  @to.res.join
146
144
  end
147
145
 
148
146
  def accept_list_item_start_note_2
149
147
  expected = <<-EXPECTED
150
- <table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>teletype</tt></p></td>
151
- <td>
148
+ <dl class="rdoc-list note-list"><dt><code>teletype</code>
149
+ <dd>
152
150
  <p>teletype description</p>
153
- </td></tr></table>
151
+ </dd></dl>
154
152
  EXPECTED
155
153
 
156
154
  assert_equal expected, @to.res.join
@@ -161,7 +159,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
161
159
  end
162
160
 
163
161
  def accept_list_item_start_ualpha
164
- assert_equal "<ol style=\"display: upper-alpha\"><li>", @to.res.join
162
+ assert_equal "<ol style=\"list-style-type: upper-alpha\"><li>", @to.res.join
165
163
  end
166
164
 
167
165
  def accept_list_start_bullet
@@ -175,21 +173,21 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
175
173
  assert_equal [:LABEL], @to.list
176
174
  assert_equal [false], @to.in_list_entry
177
175
 
178
- assert_equal '<dl class="rdoc-list">', @to.res.join
176
+ assert_equal '<dl class="rdoc-list label-list">', @to.res.join
179
177
  end
180
178
 
181
179
  def accept_list_start_lalpha
182
180
  assert_equal [:LALPHA], @to.list
183
181
  assert_equal [false], @to.in_list_entry
184
182
 
185
- assert_equal "<ol style=\"display: lower-alpha\">", @to.res.join
183
+ assert_equal "<ol style=\"list-style-type: lower-alpha\">", @to.res.join
186
184
  end
187
185
 
188
186
  def accept_list_start_note
189
187
  assert_equal [:NOTE], @to.list
190
188
  assert_equal [false], @to.in_list_entry
191
189
 
192
- assert_equal "<table class=\"rdoc-list\">", @to.res.join
190
+ assert_equal "<dl class=\"rdoc-list note-list\">", @to.res.join
193
191
  end
194
192
 
195
193
  def accept_list_start_number
@@ -203,7 +201,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
203
201
  assert_equal [:UALPHA], @to.list
204
202
  assert_equal [false], @to.in_list_entry
205
203
 
206
- assert_equal "<ol style=\"display: upper-alpha\">", @to.res.join
204
+ assert_equal "<ol style=\"list-style-type: upper-alpha\">", @to.res.join
207
205
  end
208
206
 
209
207
  def accept_paragraph
@@ -211,7 +209,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
211
209
  end
212
210
 
213
211
  def accept_paragraph_b
214
- assert_equal "\n<p>reg <b>bold words</b> reg</p>\n", @to.res.join
212
+ assert_equal "\n<p>reg <strong>bold words</strong> reg</p>\n", @to.res.join
215
213
  end
216
214
 
217
215
  def accept_paragraph_i
@@ -219,11 +217,11 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
219
217
  end
220
218
 
221
219
  def accept_paragraph_plus
222
- assert_equal "\n<p>reg <tt>teletype</tt> reg</p>\n", @to.res.join
220
+ assert_equal "\n<p>reg <code>teletype</code> reg</p>\n", @to.res.join
223
221
  end
224
222
 
225
223
  def accept_paragraph_star
226
- assert_equal "\n<p>reg <b>bold</b> reg</p>\n", @to.res.join
224
+ assert_equal "\n<p>reg <strong>bold</strong> reg</p>\n", @to.res.join
227
225
  end
228
226
 
229
227
  def accept_paragraph_underscore
@@ -297,15 +295,145 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
297
295
  assert_equal expected, @to.end_accepting
298
296
  end
299
297
 
298
+ def test_accept_heading_7
299
+ @to.start_accepting
300
+
301
+ @to.accept_heading @RM::Heading.new(7, 'Hello')
302
+
303
+ assert_equal "\n<h6 id=\"label-Hello\">Hello</h6>\n", @to.res.join
304
+ end
305
+
306
+ def test_accept_heading_aref_class
307
+ @to.code_object = RDoc::NormalClass.new 'Foo'
308
+ @to.start_accepting
309
+
310
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
311
+
312
+ assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n",
313
+ @to.res.join
314
+ end
315
+
316
+ def test_accept_heading_aref_method
317
+ @to.code_object = RDoc::AnyMethod.new nil, 'foo'
318
+ @to.start_accepting
319
+
320
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
321
+
322
+ assert_equal "\n<h1 id=\"method-i-foo-label-Hello\">Hello</h1>\n",
323
+ @to.res.join
324
+ end
325
+
326
+ def test_accept_verbatim_parseable
327
+ options = RDoc::Options.new
328
+ rdoc = RDoc::RDoc.new
329
+ rdoc.options = options
330
+ RDoc::RDoc.current = rdoc
331
+
332
+ verb = @RM::Verbatim.new("class C\n", "end\n")
333
+
334
+ @to.start_accepting
335
+ @to.accept_verbatim verb
336
+
337
+ expected = <<-EXPECTED
338
+
339
+ <pre class="ruby"><span class="ruby-keyword">class</span> <span class="ruby-constant">C</span>
340
+ <span class="ruby-keyword">end</span>
341
+ </pre>
342
+ EXPECTED
343
+
344
+ assert_equal expected, @to.res.join
345
+ end
346
+
347
+ def test_accept_verbatim_parseable_error
348
+ options = RDoc::Options.new
349
+ rdoc = RDoc::RDoc.new
350
+ rdoc.options = options
351
+ RDoc::RDoc.current = rdoc
352
+
353
+ verb = @RM::Verbatim.new("a %z'foo' # => blah\n")
354
+
355
+ @to.start_accepting
356
+ @to.accept_verbatim verb
357
+
358
+ expected = <<-EXPECTED
359
+
360
+ <pre>a %z'foo' # =&gt; blah
361
+ </pre>
362
+ EXPECTED
363
+
364
+ assert_equal expected, @to.res.join
365
+ end
366
+
367
+ def test_accept_verbatim_ruby
368
+ options = RDoc::Options.new
369
+ rdoc = RDoc::RDoc.new
370
+ rdoc.options = options
371
+ RDoc::RDoc.current = rdoc
372
+
373
+ verb = @RM::Verbatim.new("1 + 1\n")
374
+ verb.format = :ruby
375
+
376
+ @to.start_accepting
377
+ @to.accept_verbatim verb
378
+
379
+ expected = <<-EXPECTED
380
+
381
+ <pre class="ruby"><span class="ruby-value">1</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
382
+ </pre>
383
+ EXPECTED
384
+
385
+ assert_equal expected, @to.res.join
386
+ end
387
+
300
388
  def test_convert_string
301
389
  assert_equal '&lt;&gt;', @to.convert_string('<>')
302
390
  end
303
391
 
392
+ def test_convert_RDOCLINK_label_label
393
+ result = @to.convert 'rdoc-label:label-One'
394
+
395
+ assert_equal "\n<p><a href=\"#label-One\">One</a></p>\n", result
396
+ end
397
+
398
+ def test_convert_RDOCLINK_label_foottext
399
+ result = @to.convert 'rdoc-label:foottext-1'
400
+
401
+ assert_equal "\n<p><a href=\"#foottext-1\">*1</a></p>\n", result
402
+ end
403
+
404
+ def test_convert_RDOCLINK_label_footmark
405
+ result = @to.convert 'rdoc-label:footmark-1'
406
+
407
+ assert_equal "\n<p><a href=\"#footmark-1\">^1</a></p>\n", result
408
+ end
409
+
410
+ def test_convert_RDOCLINK_ref
411
+ result = @to.convert 'rdoc-ref:C'
412
+
413
+ assert_equal "\n<p>C</p>\n", result
414
+ end
415
+
416
+ def test_convert_TIDYLINK_rdoc_label
417
+ result = @to.convert '{foo}[rdoc-label:foottext-1]'
418
+
419
+ assert_equal "\n<p><a href=\"#foottext-1\">foo</a></p>\n", result
420
+ end
421
+
304
422
  def test_gen_url
305
423
  assert_equal '<a href="example">example</a>',
306
424
  @to.gen_url('link:example', 'example')
307
425
  end
308
426
 
427
+ def test_gen_url_rdoc_label
428
+ assert_equal '<a href="#foottext-1">example</a>',
429
+ @to.gen_url('rdoc-label:foottext-1', 'example')
430
+ end
431
+
432
+ def test_gen_url_rdoc_label_id
433
+ assert_equal '<a id="footmark-1" href="#foottext-1">example</a>',
434
+ @to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
435
+ end
436
+
309
437
  def test_gem_url_image_url
310
438
  assert_equal '<img src="http://example.com/image.png" />', @to.gen_url('http://example.com/image.png', 'ignored')
311
439
  end
@@ -339,8 +467,19 @@ verb2</pre>
339
467
  assert_equal expected, @m.convert(str, @to)
340
468
  end
341
469
 
470
+ def test_parseable_eh
471
+ assert @to.parseable?('def x() end'), 'def'
472
+ assert @to.parseable?('class C end'), 'class'
473
+ assert @to.parseable?('module M end'), 'module'
474
+ assert @to.parseable?('a # => blah'), '=>'
475
+ assert @to.parseable?('x { |y| ... }'), '{ |x|'
476
+ assert @to.parseable?('x do |y| ... end'), 'do |x|'
477
+ refute @to.parseable?('* 1'), '* 1'
478
+ refute @to.parseable?('# only a comment'), '# only a comment'
479
+ end
480
+
342
481
  def test_to_html
343
- assert_equal "\n<p><tt>--</tt></p>\n", util_format("<tt>--</tt>")
482
+ assert_equal "\n<p><code>--</code></p>\n", util_format("<tt>--</tt>")
344
483
  end
345
484
 
346
485
  def util_format text