rdoc 2.5.11 → 3.0

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 (113) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.document +1 -0
  3. data/History.txt +95 -0
  4. data/Manifest.txt +13 -4
  5. data/README.txt +9 -3
  6. data/Rakefile +1 -1
  7. data/lib/rdoc.rb +15 -298
  8. data/lib/rdoc/alias.rb +65 -16
  9. data/lib/rdoc/any_method.rb +27 -150
  10. data/lib/rdoc/attr.rb +36 -115
  11. data/lib/rdoc/class_module.rb +236 -22
  12. data/lib/rdoc/code_object.rb +76 -31
  13. data/lib/rdoc/constant.rb +32 -4
  14. data/lib/rdoc/context.rb +494 -222
  15. data/lib/rdoc/encoding.rb +79 -0
  16. data/lib/rdoc/erbio.rb +37 -0
  17. data/lib/rdoc/gauntlet.rb +9 -5
  18. data/lib/rdoc/generator.rb +33 -1
  19. data/lib/rdoc/generator/darkfish.rb +284 -375
  20. data/lib/rdoc/generator/markup.rb +72 -36
  21. data/lib/rdoc/generator/ri.rb +4 -4
  22. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +267 -274
  23. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +91 -91
  24. data/lib/rdoc/generator/template/darkfish/index.rhtml +45 -45
  25. data/lib/rdoc/generator/template/darkfish/rdoc.css +298 -298
  26. data/lib/rdoc/include.rb +40 -1
  27. data/lib/rdoc/known_classes.rb +1 -0
  28. data/lib/rdoc/markup.rb +467 -2
  29. data/lib/rdoc/markup/attribute_manager.rb +24 -6
  30. data/lib/rdoc/markup/blank_line.rb +11 -3
  31. data/lib/rdoc/markup/document.rb +6 -0
  32. data/lib/rdoc/markup/formatter.rb +10 -0
  33. data/lib/rdoc/markup/formatter_test_case.rb +339 -3
  34. data/lib/rdoc/markup/heading.rb +3 -0
  35. data/lib/rdoc/markup/inline.rb +11 -1
  36. data/lib/rdoc/markup/list.rb +3 -0
  37. data/lib/rdoc/markup/list_item.rb +3 -0
  38. data/lib/rdoc/markup/paragraph.rb +3 -0
  39. data/lib/rdoc/markup/parser.rb +191 -237
  40. data/lib/rdoc/markup/{preprocess.rb → pre_process.rb} +50 -29
  41. data/lib/rdoc/markup/raw.rb +4 -0
  42. data/lib/rdoc/markup/rule.rb +3 -0
  43. data/lib/rdoc/markup/text_formatter_test_case.rb +116 -0
  44. data/lib/rdoc/markup/to_ansi.rb +14 -2
  45. data/lib/rdoc/markup/to_bs.rb +8 -2
  46. data/lib/rdoc/markup/to_html.rb +84 -91
  47. data/lib/rdoc/markup/to_html_crossref.rb +77 -26
  48. data/lib/rdoc/markup/to_rdoc.rb +94 -49
  49. data/lib/rdoc/markup/to_test.rb +9 -1
  50. data/lib/rdoc/markup/verbatim.rb +6 -3
  51. data/lib/rdoc/method_attr.rb +353 -0
  52. data/lib/rdoc/normal_class.rb +11 -2
  53. data/lib/rdoc/normal_module.rb +0 -5
  54. data/lib/rdoc/options.rb +373 -82
  55. data/lib/rdoc/parser.rb +59 -23
  56. data/lib/rdoc/parser/c.rb +224 -86
  57. data/lib/rdoc/parser/ruby.rb +219 -111
  58. data/lib/rdoc/parser/ruby_tools.rb +4 -1
  59. data/lib/rdoc/parser/simple.rb +9 -4
  60. data/lib/rdoc/rdoc.rb +68 -28
  61. data/lib/rdoc/require.rb +21 -0
  62. data/lib/rdoc/ri/driver.rb +20 -10
  63. data/lib/rdoc/ri/paths.rb +2 -2
  64. data/lib/rdoc/ri/store.rb +22 -5
  65. data/lib/rdoc/ruby_lex.rb +11 -12
  66. data/lib/rdoc/ruby_token.rb +2 -2
  67. data/lib/rdoc/single_class.rb +2 -1
  68. data/lib/rdoc/stats.rb +202 -162
  69. data/lib/rdoc/stats/normal.rb +51 -0
  70. data/lib/rdoc/stats/quiet.rb +59 -0
  71. data/lib/rdoc/stats/verbose.rb +45 -0
  72. data/lib/rdoc/text.rb +133 -4
  73. data/lib/rdoc/{tokenstream.rb → token_stream.rb} +0 -2
  74. data/lib/rdoc/top_level.rb +230 -39
  75. data/test/test_attribute_manager.rb +58 -7
  76. data/test/test_rdoc_alias.rb +13 -0
  77. data/test/test_rdoc_any_method.rb +43 -2
  78. data/test/test_rdoc_attr.rb +15 -8
  79. data/test/test_rdoc_class_module.rb +133 -0
  80. data/test/test_rdoc_code_object.rb +62 -5
  81. data/test/test_rdoc_context.rb +72 -26
  82. data/test/test_rdoc_encoding.rb +145 -0
  83. data/test/test_rdoc_generator_darkfish.rb +119 -0
  84. data/test/test_rdoc_generator_ri.rb +22 -2
  85. data/test/test_rdoc_include.rb +79 -0
  86. data/test/test_rdoc_markup_attribute_manager.rb +4 -4
  87. data/test/test_rdoc_markup_parser.rb +134 -95
  88. data/test/test_rdoc_markup_pre_process.rb +7 -2
  89. data/test/test_rdoc_markup_to_ansi.rb +43 -153
  90. data/test/test_rdoc_markup_to_bs.rb +42 -156
  91. data/test/test_rdoc_markup_to_html.rb +130 -58
  92. data/test/test_rdoc_markup_to_html_crossref.rb +10 -10
  93. data/test/test_rdoc_markup_to_rdoc.rb +40 -151
  94. data/test/test_rdoc_method_attr.rb +122 -0
  95. data/test/test_rdoc_normal_class.rb +1 -1
  96. data/test/test_rdoc_normal_module.rb +6 -1
  97. data/test/test_rdoc_options.rb +237 -12
  98. data/test/test_rdoc_parser.rb +3 -22
  99. data/test/test_rdoc_parser_c.rb +203 -2
  100. data/test/test_rdoc_parser_ruby.rb +403 -89
  101. data/test/test_rdoc_parser_simple.rb +25 -1
  102. data/test/test_rdoc_rdoc.rb +44 -32
  103. data/test/test_rdoc_ri_driver.rb +29 -24
  104. data/test/test_rdoc_ri_store.rb +46 -3
  105. data/test/test_rdoc_task.rb +1 -1
  106. data/test/test_rdoc_text.rb +102 -8
  107. data/test/test_rdoc_top_level.rb +13 -4
  108. data/test/xref_data.rb +8 -0
  109. data/test/xref_test_case.rb +6 -0
  110. metadata +29 -19
  111. metadata.gz.sig +0 -0
  112. data/lib/rdoc/parser/perl.rb +0 -165
  113. data/test/test_rdoc_parser_perl.rb +0 -73
@@ -31,49 +31,73 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
31
31
  end
32
32
 
33
33
  def accept_heading
34
- assert_equal "<h5>Hello</h5>\n", @to.res.join
34
+ assert_equal "\n<h5>Hello</h5>\n", @to.res.join
35
+ end
36
+
37
+ def accept_heading_1
38
+ assert_equal "\n<h1>Hello</h1>\n", @to.res.join
39
+ end
40
+
41
+ def accept_heading_2
42
+ assert_equal "\n<h2>Hello</h2>\n", @to.res.join
43
+ end
44
+
45
+ def accept_heading_3
46
+ assert_equal "\n<h3>Hello</h3>\n", @to.res.join
47
+ end
48
+
49
+ def accept_heading_4
50
+ assert_equal "\n<h4>Hello</h4>\n", @to.res.join
51
+ end
52
+
53
+ def accept_heading_b
54
+ assert_equal "\n<h1><b>Hello</b></h1>\n", @to.res.join
55
+ end
56
+
57
+ def accept_heading_suppressed_crossref
58
+ assert_equal "\n<h1>Hello</h1>\n", @to.res.join
35
59
  end
36
60
 
37
61
  def accept_list_end_bullet
38
62
  assert_equal [], @to.list
39
63
  assert_equal [], @to.in_list_entry
40
64
 
41
- assert_equal "<ul>\n</ul>\n", @to.res.join
65
+ assert_equal "<ul></ul>\n", @to.res.join
42
66
  end
43
67
 
44
68
  def accept_list_end_label
45
69
  assert_equal [], @to.list
46
70
  assert_equal [], @to.in_list_entry
47
71
 
48
- assert_equal "<dl>\n</dl>\n", @to.res.join
72
+ assert_equal "<dl></dl>\n", @to.res.join
49
73
  end
50
74
 
51
75
  def accept_list_end_lalpha
52
76
  assert_equal [], @to.list
53
77
  assert_equal [], @to.in_list_entry
54
78
 
55
- assert_equal "<ol style=\"display: lower-alpha\">\n</ol>\n", @to.res.join
79
+ assert_equal "<ol style=\"display: lower-alpha\"></ol>\n", @to.res.join
56
80
  end
57
81
 
58
82
  def accept_list_end_number
59
83
  assert_equal [], @to.list
60
84
  assert_equal [], @to.in_list_entry
61
85
 
62
- assert_equal "<ol>\n</ol>\n", @to.res.join
86
+ assert_equal "<ol></ol>\n", @to.res.join
63
87
  end
64
88
 
65
89
  def accept_list_end_note
66
90
  assert_equal [], @to.list
67
91
  assert_equal [], @to.in_list_entry
68
92
 
69
- assert_equal "<table>\n</table>\n", @to.res.join
93
+ assert_equal "<table class=\"rdoc-list\"></table>\n", @to.res.join
70
94
  end
71
95
 
72
96
  def accept_list_end_ualpha
73
97
  assert_equal [], @to.list
74
98
  assert_equal [], @to.in_list_entry
75
99
 
76
- assert_equal "<ol style=\"display: upper-alpha\">\n</ol>\n", @to.res.join
100
+ assert_equal "<ol style=\"display: upper-alpha\"></ol>\n", @to.res.join
77
101
  end
78
102
 
79
103
  def accept_list_item_end_bullet
@@ -101,73 +125,105 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
101
125
  end
102
126
 
103
127
  def accept_list_item_start_bullet
104
- assert_equal "<ul>\n<li>", @to.res.join
128
+ assert_equal "<ul><li>", @to.res.join
105
129
  end
106
130
 
107
131
  def accept_list_item_start_label
108
- assert_equal "<dl>\n<dt>cat</dt><dd>", @to.res.join
132
+ assert_equal "<dl><dt>cat</dt>\n<dd>", @to.res.join
109
133
  end
110
134
 
111
135
  def accept_list_item_start_lalpha
112
- assert_equal "<ol style=\"display: lower-alpha\">\n<li>", @to.res.join
136
+ assert_equal "<ol style=\"display: lower-alpha\"><li>", @to.res.join
113
137
  end
114
138
 
115
139
  def accept_list_item_start_note
116
- assert_equal "<table>\n<tr><td valign=\"top\">cat</td><td>", @to.res.join
140
+ assert_equal "<table class=\"rdoc-list\"><tr><td class=\"rdoc-term\"><p>cat</p></td>\n<td>",
141
+ @to.res.join
142
+ end
143
+
144
+ def accept_list_item_start_note_2
145
+ expected = <<-EXPECTED
146
+ <table class="rdoc-list"><tr><td class="rdoc-term"><p><tt>teletype</tt></p></td>
147
+ <td>
148
+ <p>teletype description</p>
149
+ </td></tr></table>
150
+ EXPECTED
151
+
152
+ assert_equal expected, @to.res.join
117
153
  end
118
154
 
119
155
  def accept_list_item_start_number
120
- assert_equal "<ol>\n<li>", @to.res.join
156
+ assert_equal "<ol><li>", @to.res.join
121
157
  end
122
158
 
123
159
  def accept_list_item_start_ualpha
124
- assert_equal "<ol style=\"display: upper-alpha\">\n<li>", @to.res.join
160
+ assert_equal "<ol style=\"display: upper-alpha\"><li>", @to.res.join
125
161
  end
126
162
 
127
163
  def accept_list_start_bullet
128
164
  assert_equal [:BULLET], @to.list
129
165
  assert_equal [false], @to.in_list_entry
130
166
 
131
- assert_equal "<ul>\n", @to.res.join
167
+ assert_equal "<ul>", @to.res.join
132
168
  end
133
169
 
134
170
  def accept_list_start_label
135
171
  assert_equal [:LABEL], @to.list
136
172
  assert_equal [false], @to.in_list_entry
137
173
 
138
- assert_equal "<dl>\n", @to.res.join
174
+ assert_equal "<dl>", @to.res.join
139
175
  end
140
176
 
141
177
  def accept_list_start_lalpha
142
178
  assert_equal [:LALPHA], @to.list
143
179
  assert_equal [false], @to.in_list_entry
144
180
 
145
- assert_equal "<ol style=\"display: lower-alpha\">\n", @to.res.join
181
+ assert_equal "<ol style=\"display: lower-alpha\">", @to.res.join
146
182
  end
147
183
 
148
184
  def accept_list_start_note
149
185
  assert_equal [:NOTE], @to.list
150
186
  assert_equal [false], @to.in_list_entry
151
187
 
152
- assert_equal "<table>\n", @to.res.join
188
+ assert_equal "<table class=\"rdoc-list\">", @to.res.join
153
189
  end
154
190
 
155
191
  def accept_list_start_number
156
192
  assert_equal [:NUMBER], @to.list
157
193
  assert_equal [false], @to.in_list_entry
158
194
 
159
- assert_equal "<ol>\n", @to.res.join
195
+ assert_equal "<ol>", @to.res.join
160
196
  end
161
197
 
162
198
  def accept_list_start_ualpha
163
199
  assert_equal [:UALPHA], @to.list
164
200
  assert_equal [false], @to.in_list_entry
165
201
 
166
- assert_equal "<ol style=\"display: upper-alpha\">\n", @to.res.join
202
+ assert_equal "<ol style=\"display: upper-alpha\">", @to.res.join
167
203
  end
168
204
 
169
205
  def accept_paragraph
170
- assert_equal "<p>\nhi\n</p>\n", @to.res.join
206
+ assert_equal "\n<p>hi</p>\n", @to.res.join
207
+ end
208
+
209
+ def accept_paragraph_b
210
+ assert_equal "\n<p>reg <b>bold words</b> reg</p>\n", @to.res.join
211
+ end
212
+
213
+ def accept_paragraph_i
214
+ assert_equal "\n<p>reg <em>italic words</em> reg</p>\n", @to.res.join
215
+ end
216
+
217
+ def accept_paragraph_plus
218
+ assert_equal "\n<p>reg <tt>teletype</tt> reg</p>\n", @to.res.join
219
+ end
220
+
221
+ def accept_paragraph_star
222
+ assert_equal "\n<p>reg <b>bold</b> reg</p>\n", @to.res.join
223
+ end
224
+
225
+ def accept_paragraph_underscore
226
+ assert_equal "\n<p>reg <em>italic</em> reg</p>\n", @to.res.join
171
227
  end
172
228
 
173
229
  def accept_raw
@@ -183,11 +239,11 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
183
239
  end
184
240
 
185
241
  def accept_rule
186
- assert_equal '<hr style="height: 4px"></hr>', @to.res.join
242
+ assert_equal "<hr style=\"height: 4px\">\n", @to.res.join
187
243
  end
188
244
 
189
245
  def accept_verbatim
190
- assert_equal "<pre>\n hi\n world\n</pre>\n", @to.res.join
246
+ assert_equal "\n<pre>hi\n world</pre>\n", @to.res.join
191
247
  end
192
248
 
193
249
  def end_accepting
@@ -200,54 +256,70 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
200
256
  assert_equal [], @to.list
201
257
  end
202
258
 
203
- def test_list_verbatim
204
- str = "* one\n verb1\n verb2\n* two\n"
205
-
259
+ def list_nested
206
260
  expected = <<-EXPECTED
207
- <ul>
208
- <li><p>
209
- one
210
- </p>
211
- <pre>
212
- verb1
213
- verb2
214
- </pre>
215
- </li>
216
- <li><p>
217
- two
218
- </p>
219
- </li>
220
- </ul>
261
+ <ul><li>
262
+ <p>l1</p>
263
+ <ul><li>
264
+ <p>l1.1</p>
265
+ </li></ul>
266
+ </li><li>
267
+ <p>l2</p>
268
+ </li></ul>
221
269
  EXPECTED
222
270
 
223
- assert_equal expected, @m.convert(str, @to)
271
+ assert_equal expected, @to.res.join
224
272
  end
225
273
 
226
- def test_tt_formatting
227
- assert_equal "<p>\n<tt>--</tt> &#8212; <tt>cats'</tt> cats&#8217;\n</p>\n",
228
- util_format("<tt>--</tt> -- <tt>cats'</tt> cats'")
274
+ def list_verbatim
275
+ expected = <<-EXPECTED
276
+ <ul><li>
277
+ <p>list stuff</p>
278
+
279
+ <pre>* list
280
+ with
281
+
282
+ second
283
+
284
+ 1. indented
285
+ 2. numbered
229
286
 
230
- assert_equal "<p>\n<b>&#8212;</b>\n</p>\n", util_format("<b>--</b>")
287
+ third
288
+
289
+ * second</pre>
290
+ </li></ul>
291
+ EXPECTED
292
+
293
+ assert_equal expected, @to.end_accepting
231
294
  end
232
295
 
233
- def test_convert_string_fancy
234
- #
235
- # The HTML typesetting is broken in a number of ways, but I have fixed
236
- # the most glaring issues for single and double quotes. Note that
237
- # "strange" symbols (periods or dashes) need to be at the end of the
238
- # test case strings in order to suppress cross-references.
239
- #
240
- assert_equal "<p>\n&#8220;cats&#8221;.\n</p>\n", util_format("\"cats\".")
241
- assert_equal "<p>\n&#8216;cats&#8217;.\n</p>\n", util_format("\'cats\'.")
242
- assert_equal "<p>\ncat&#8217;s-\n</p>\n", util_format("cat\'s-")
296
+ def test_convert_string
297
+ assert_equal '&lt;&gt;', @to.convert_string('<>')
298
+ end
299
+
300
+ def test_list_verbatim_2
301
+ str = "* one\n verb1\n verb2\n* two\n"
302
+
303
+ expected = <<-EXPECTED
304
+ <ul><li>
305
+ <p>one</p>
306
+
307
+ <pre>verb1
308
+ verb2</pre>
309
+ </li><li>
310
+ <p>two</p>
311
+ </li></ul>
312
+ EXPECTED
313
+
314
+ assert_equal expected, @m.convert(str, @to)
243
315
  end
244
316
 
245
- def util_paragraph(text)
246
- RDoc::Markup::Paragraph.new text
317
+ def test_to_html
318
+ assert_equal "\n<p><tt>--</tt></p>\n", util_format("<tt>--</tt>")
247
319
  end
248
320
 
249
- def util_format(text)
250
- paragraph = util_paragraph text
321
+ def util_format text
322
+ paragraph = RDoc::Markup::Paragraph.new text
251
323
 
252
324
  @to.start_accepting
253
325
  @to.accept_paragraph paragraph
@@ -14,12 +14,11 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
14
14
  end
15
15
 
16
16
  def assert_ref(path, ref)
17
- assert_equal "<p>\n<a href=\"#{path}\">#{ref}</a>\n</p>\n",
18
- @xref.convert(ref)
17
+ assert_equal "\n<p><a href=\"#{path}\">#{ref}</a></p>\n", @xref.convert(ref)
19
18
  end
20
19
 
21
20
  def refute_ref(body, ref)
22
- assert_equal "<p>\n#{body}\n</p>\n", @xref.convert(ref)
21
+ assert_equal "\n<p>#{body}</p>\n", @xref.convert(ref)
23
22
  end
24
23
 
25
24
  def test_handle_special_CROSSREF_C2
@@ -108,16 +107,16 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
108
107
  assert_ref 'C1.html#method-c-m', '::m'
109
108
 
110
109
  assert_ref 'C1.html#method-i-m', 'C1#m'
111
- assert_ref 'C1.html#method-i-m', 'C1.m'
110
+ assert_ref 'C1.html#method-c-m', 'C1.m'
112
111
  assert_ref 'C1.html#method-c-m', 'C1::m'
113
112
 
114
113
  assert_ref 'C1.html#method-i-m', 'C1#m'
115
114
  assert_ref 'C1.html#method-i-m', 'C1#m()'
116
115
  assert_ref 'C1.html#method-i-m', 'C1#m(*)'
117
116
 
118
- assert_ref 'C1.html#method-i-m', 'C1.m'
119
- assert_ref 'C1.html#method-i-m', 'C1.m()'
120
- assert_ref 'C1.html#method-i-m', 'C1.m(*)'
117
+ assert_ref 'C1.html#method-c-m', 'C1.m'
118
+ assert_ref 'C1.html#method-c-m', 'C1.m()'
119
+ assert_ref 'C1.html#method-c-m', 'C1.m(*)'
121
120
 
122
121
  assert_ref 'C1.html#method-c-m', 'C1::m'
123
122
  assert_ref 'C1.html#method-c-m', 'C1::m()'
@@ -127,7 +126,8 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
127
126
 
128
127
  assert_ref 'C2/C3.html#method-i-m', 'C2::C3.m'
129
128
 
130
- assert_ref 'C2/C3/H1.html#method-i-m%3F', 'C2::C3::H1#m?'
129
+ # TODO stop escaping - HTML5 allows anything but space
130
+ assert_ref 'C2/C3/H1.html#method-i-m-3F', 'C2::C3::H1#m?'
131
131
 
132
132
  assert_ref 'C2/C3.html#method-i-m', '::C2::C3#m'
133
133
  assert_ref 'C2/C3.html#method-i-m', '::C2::C3#m()'
@@ -156,12 +156,12 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
156
156
  def test_handle_special_CROSSREF_show_hash_false
157
157
  @xref.show_hash = false
158
158
 
159
- assert_equal "<p>\n<a href=\"C1.html#method-i-m\">m</a>\n</p>\n",
159
+ assert_equal "\n<p><a href=\"C1.html#method-i-m\">m</a></p>\n",
160
160
  @xref.convert('#m')
161
161
  end
162
162
 
163
163
  def test_handle_special_CROSSREF_special
164
- assert_equal "<p>\n<a href=\"C2/C3.html\">C2::C3</a>;method(*)\n</p>\n",
164
+ assert_equal "\n<p><a href=\"C2/C3.html\">C2::C3</a>;method(*)</p>\n",
165
165
  @xref.convert('C2::C3;method(*)')
166
166
  end
167
167
 
@@ -1,11 +1,12 @@
1
1
  require 'rubygems'
2
- require 'rdoc/markup/formatter_test_case'
2
+ require 'rdoc/markup/text_formatter_test_case'
3
3
  require 'rdoc/markup/to_rdoc'
4
4
  require 'minitest/autorun'
5
5
 
6
- class TestRDocMarkupToRdoc < RDoc::Markup::FormatterTestCase
6
+ class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase
7
7
 
8
8
  add_visitor_tests
9
+ add_text_tests
9
10
 
10
11
  def setup
11
12
  super
@@ -191,8 +192,8 @@ class TestRDocMarkupToRdoc < RDoc::Markup::FormatterTestCase
191
192
  assert_equal "#{'-' * 78}\n", @to.res.join
192
193
  end
193
194
 
194
- def accept_verbatim # FormatterTestCase doesn't set indent for ToAnsi
195
- assert_equal " hi\n world\n\n", @to.res.join
195
+ def accept_verbatim
196
+ assert_equal " hi\n world\n\n", @to.res.join
196
197
  end
197
198
 
198
199
  def end_accepting
@@ -207,214 +208,102 @@ class TestRDocMarkupToRdoc < RDoc::Markup::FormatterTestCase
207
208
  assert_empty @to.list_width
208
209
  end
209
210
 
210
- def test_accept_heading_1
211
- @to.start_accepting
212
- @to.accept_heading @RM::Heading.new(1, 'Hello')
213
-
211
+ def accept_heading_1
214
212
  assert_equal "= Hello\n", @to.end_accepting
215
213
  end
216
214
 
217
- def test_accept_heading_2
218
- @to.start_accepting
219
- @to.accept_heading @RM::Heading.new(2, 'Hello')
220
-
215
+ def accept_heading_2
221
216
  assert_equal "== Hello\n", @to.end_accepting
222
217
  end
223
218
 
224
- def test_accept_heading_3
225
- @to.start_accepting
226
- @to.accept_heading @RM::Heading.new(3, 'Hello')
227
-
219
+ def accept_heading_3
228
220
  assert_equal "=== Hello\n", @to.end_accepting
229
221
  end
230
222
 
231
- def test_accept_heading_4
232
- @to.start_accepting
233
- @to.accept_heading @RM::Heading.new(4, 'Hello')
234
-
223
+ def accept_heading_4
235
224
  assert_equal "==== Hello\n", @to.end_accepting
236
225
  end
237
226
 
238
- def test_accept_heading_indent
239
- @to.start_accepting
240
- @to.indent = 3
241
- @to.accept_heading @RM::Heading.new(1, 'Hello')
242
-
227
+ def accept_heading_indent
243
228
  assert_equal " = Hello\n", @to.end_accepting
244
229
  end
245
230
 
246
- def test_accept_heading_b
247
- @to.start_accepting
248
- @to.indent = 3
249
- @to.accept_heading @RM::Heading.new(1, '*Hello*')
250
-
251
- assert_equal " = <b>Hello</b>\n", @to.end_accepting
231
+ def accept_heading_b
232
+ assert_equal "= <b>Hello</b>\n", @to.end_accepting
252
233
  end
253
234
 
254
- def test_accept_list_item_start_note_2
255
- list = @RM::List.new(:NOTE,
256
- @RM::ListItem.new('<tt>teletype</tt>',
257
- @RM::Paragraph.new('teletype description')))
258
-
259
- @to.start_accepting
260
-
261
- list.accept @to
262
-
263
- expected = "<tt>teletype</tt>:\n teletype description\n\n"
264
-
265
- assert_equal expected, @to.end_accepting
235
+ def accept_heading_suppressed_crossref
236
+ assert_equal "= Hello\n", @to.end_accepting
266
237
  end
267
238
 
268
- def test_accept_paragraph_b
269
- @to.start_accepting
270
- @to.accept_paragraph @RM::Paragraph.new('reg <b>bold words</b> reg')
271
-
272
- expected = "reg <b>bold words</b> reg\n"
273
-
274
- assert_equal expected, @to.end_accepting
239
+ def accept_list_item_start_note_2
240
+ assert_equal "<tt>teletype</tt>:\n teletype description\n\n", @to.res.join
275
241
  end
276
242
 
277
- def test_accept_paragraph_i
278
- @to.start_accepting
279
- @to.accept_paragraph @RM::Paragraph.new('reg <em>italic words</em> reg')
280
-
281
- expected = "reg <em>italic words</em> reg\n"
282
-
283
- assert_equal expected, @to.end_accepting
243
+ def accept_paragraph_b
244
+ assert_equal "reg <b>bold words</b> reg\n", @to.end_accepting
284
245
  end
285
246
 
286
- def test_accept_paragraph_indent
287
- @to.start_accepting
288
- @to.indent = 3
289
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
247
+ def accept_paragraph_i
248
+ assert_equal "reg <em>italic words</em> reg\n", @to.end_accepting
249
+ end
290
250
 
251
+ def accept_paragraph_indent
291
252
  expected = <<-EXPECTED
292
253
  words words words words words words words words words words words words
293
254
  words words words words words words words words words words words words
294
- words words words words words words
255
+ words words words words words words
295
256
  EXPECTED
296
257
 
297
258
  assert_equal expected, @to.end_accepting
298
259
  end
299
260
 
300
- def test_accept_paragraph_plus
301
- @to.start_accepting
302
- @to.accept_paragraph @RM::Paragraph.new('regular +teletype+ regular')
303
-
304
- expected = "regular <tt>teletype</tt> regular\n"
305
-
306
- assert_equal expected, @to.end_accepting
261
+ def accept_paragraph_plus
262
+ assert_equal "reg <tt>teletype</tt> reg\n", @to.end_accepting
307
263
  end
308
264
 
309
- def test_accept_paragraph_star
310
- @to.start_accepting
311
- @to.accept_paragraph @RM::Paragraph.new('regular *bold* regular')
312
-
313
- expected = "regular <b>bold</b> regular\n"
314
-
315
- assert_equal expected, @to.end_accepting
265
+ def accept_paragraph_star
266
+ assert_equal "reg <b>bold</b> reg\n", @to.end_accepting
316
267
  end
317
268
 
318
- def test_accept_paragraph_underscore
319
- @to.start_accepting
320
- @to.accept_paragraph @RM::Paragraph.new('regular _italic_ regular')
321
-
322
- expected = "regular <em>italic</em> regular\n"
323
-
324
- assert_equal expected, @to.end_accepting
269
+ def accept_paragraph_underscore
270
+ assert_equal "reg <em>italic</em> reg\n", @to.end_accepting
325
271
  end
326
272
 
327
- def test_accept_paragraph_wrap
328
- @to.start_accepting
329
- @to.accept_paragraph @RM::Paragraph.new('words ' * 30)
330
-
273
+ def accept_paragraph_wrap
331
274
  expected = <<-EXPECTED
332
275
  words words words words words words words words words words words words words
333
276
  words words words words words words words words words words words words words
334
- words words words words
277
+ words words words words
335
278
  EXPECTED
336
279
 
337
280
  assert_equal expected, @to.end_accepting
338
281
  end
339
282
 
340
- def test_accept_rule_indent
341
- @to.start_accepting
342
- @to.indent = 3
343
-
344
- @to.accept_rule @RM::Rule.new(1)
345
-
283
+ def accept_rule_indent
346
284
  assert_equal " #{'-' * 75}\n", @to.end_accepting
347
285
  end
348
286
 
349
- def test_accept_verbatim_indent
350
- @to.start_accepting
351
-
352
- @to.indent = 2
353
-
354
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
355
- ' ', 'world', "\n")
356
-
287
+ def accept_verbatim_indent
357
288
  assert_equal " hi\n world\n\n", @to.end_accepting
358
289
  end
359
290
 
360
- def test_accept_verbatim_big_indent
361
- @to.start_accepting
362
-
363
- @to.indent = 2
364
-
365
- @to.accept_verbatim @RM::Verbatim.new(' ', 'hi', "\n",
366
- ' ', 'world', "\n")
367
-
291
+ def accept_verbatim_big_indent
368
292
  assert_equal " hi\n world\n\n", @to.end_accepting
369
293
  end
370
294
 
371
- def test_attributes
372
- assert_equal 'Dog', @to.attributes("\\Dog")
373
- end
374
-
375
- def test_list_nested
376
- doc = @RM::Document.new(
377
- @RM::List.new(:BULLET,
378
- @RM::ListItem.new(nil,
379
- @RM::Paragraph.new('l1'),
380
- @RM::List.new(:BULLET,
381
- @RM::ListItem.new(nil,
382
- @RM::Paragraph.new('l1.1')))),
383
- @RM::ListItem.new(nil,
384
- @RM::Paragraph.new('l2'))))
385
-
386
- output = doc.accept @to
387
-
295
+ def list_nested
388
296
  expected = <<-EXPECTED
389
297
  * l1
390
298
  * l1.1
391
299
  * l2
392
300
  EXPECTED
393
301
 
394
- assert_equal expected, output
395
- end
396
-
397
- def test_list_verbatim # HACK overblown
398
- doc = @RM::Document.new(
399
- @RM::List.new(:BULLET,
400
- @RM::ListItem.new(nil,
401
- @RM::Paragraph.new('list', 'stuff'),
402
- @RM::BlankLine.new(),
403
- @RM::Verbatim.new(' ', '*', ' ', 'list', "\n",
404
- ' ', 'with', "\n",
405
- "\n",
406
- ' ', 'second', "\n",
407
- "\n",
408
- ' ', '1.', ' ', 'indented', "\n",
409
- ' ', '2.', ' ', 'numbered', "\n",
410
- "\n",
411
- ' ', 'third', "\n",
412
- "\n",
413
- ' ', '*', ' ', 'second', "\n"))))
414
-
415
- output = doc.accept @to
302
+ assert_equal expected, @to.end_accepting
303
+ end
416
304
 
417
- expected = <<-EXPECTED
305
+ def list_verbatim
306
+ expected = <<-EXPECTED # HACK overblown
418
307
  * list stuff
419
308
 
420
309
  * list
@@ -431,7 +320,7 @@ words words words words
431
320
 
432
321
  EXPECTED
433
322
 
434
- assert_equal expected, output
323
+ assert_equal expected, @to.end_accepting
435
324
  end
436
325
 
437
326
  end