rdoc 3.12.2 → 4.0.0.preview2

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 (200) hide show
  1. checksums.yaml +6 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.autotest +3 -2
  5. data/DEVELOPERS.rdoc +53 -0
  6. data/History.rdoc +159 -25
  7. data/LEGAL.rdoc +12 -0
  8. data/Manifest.txt +56 -3
  9. data/README.rdoc +87 -19
  10. data/Rakefile +11 -2
  11. data/TODO.rdoc +20 -13
  12. data/bin/rdoc +4 -0
  13. data/lib/gauntlet_rdoc.rb +1 -1
  14. data/lib/rdoc.rb +32 -71
  15. data/lib/rdoc/any_method.rb +75 -21
  16. data/lib/rdoc/attr.rb +49 -10
  17. data/lib/rdoc/class_module.rb +182 -32
  18. data/lib/rdoc/code_object.rb +54 -12
  19. data/lib/rdoc/comment.rb +8 -1
  20. data/lib/rdoc/constant.rb +100 -6
  21. data/lib/rdoc/context.rb +93 -41
  22. data/lib/rdoc/context/section.rb +143 -28
  23. data/lib/rdoc/cross_reference.rb +58 -50
  24. data/lib/rdoc/encoding.rb +34 -29
  25. data/lib/rdoc/erb_partial.rb +18 -0
  26. data/lib/rdoc/extend.rb +117 -0
  27. data/lib/rdoc/generator.rb +11 -6
  28. data/lib/rdoc/generator/darkfish.rb +250 -62
  29. data/lib/rdoc/generator/json_index.rb +20 -12
  30. data/lib/rdoc/generator/markup.rb +10 -12
  31. data/lib/rdoc/generator/ri.rb +7 -60
  32. data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
  34. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
  35. data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
  36. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
  37. data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
  38. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
  39. data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  40. data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
  41. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
  42. data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
  43. data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
  44. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
  45. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
  46. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
  47. data/lib/rdoc/include.rb +12 -3
  48. data/lib/rdoc/markdown.kpeg +1186 -0
  49. data/lib/rdoc/markdown.rb +16336 -0
  50. data/lib/rdoc/markdown/entities.rb +2128 -0
  51. data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
  52. data/lib/rdoc/markdown/literals_1_8.rb +454 -0
  53. data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
  54. data/lib/rdoc/markdown/literals_1_9.rb +417 -0
  55. data/lib/rdoc/markup.rb +69 -10
  56. data/lib/rdoc/markup/attr_changer.rb +2 -5
  57. data/lib/rdoc/markup/attribute_manager.rb +23 -14
  58. data/lib/rdoc/markup/attributes.rb +70 -0
  59. data/lib/rdoc/markup/block_quote.rb +14 -0
  60. data/lib/rdoc/markup/document.rb +20 -4
  61. data/lib/rdoc/markup/formatter.rb +17 -6
  62. data/lib/rdoc/markup/formatter_test_case.rb +93 -24
  63. data/lib/rdoc/markup/hard_break.rb +31 -0
  64. data/lib/rdoc/markup/heading.rb +1 -1
  65. data/lib/rdoc/markup/indented_paragraph.rb +14 -0
  66. data/lib/rdoc/markup/list.rb +23 -4
  67. data/lib/rdoc/markup/list_item.rb +17 -4
  68. data/lib/rdoc/markup/paragraph.rb +14 -0
  69. data/lib/rdoc/markup/parser.rb +107 -60
  70. data/lib/rdoc/markup/raw.rb +4 -4
  71. data/lib/rdoc/markup/special.rb +3 -3
  72. data/lib/rdoc/markup/to_ansi.rb +7 -1
  73. data/lib/rdoc/markup/to_html.rb +42 -14
  74. data/lib/rdoc/markup/to_html_crossref.rb +10 -9
  75. data/lib/rdoc/markup/to_html_snippet.rb +20 -4
  76. data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
  77. data/lib/rdoc/markup/to_label.rb +20 -1
  78. data/lib/rdoc/markup/to_markdown.rb +134 -0
  79. data/lib/rdoc/markup/to_rdoc.rb +36 -5
  80. data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
  81. data/lib/rdoc/markup/to_tt_only.rb +11 -2
  82. data/lib/rdoc/markup/verbatim.rb +19 -0
  83. data/lib/rdoc/method_attr.rb +33 -19
  84. data/lib/rdoc/normal_class.rb +26 -7
  85. data/lib/rdoc/normal_module.rb +10 -5
  86. data/lib/rdoc/options.rb +95 -21
  87. data/lib/rdoc/parser.rb +6 -2
  88. data/lib/rdoc/parser/c.rb +212 -97
  89. data/lib/rdoc/parser/markdown.rb +23 -0
  90. data/lib/rdoc/parser/ruby.rb +115 -35
  91. data/lib/rdoc/parser/ruby_tools.rb +8 -3
  92. data/lib/rdoc/rd.rb +8 -4
  93. data/lib/rdoc/rd/block_parser.rb +1 -1
  94. data/lib/rdoc/rd/block_parser.ry +1 -1
  95. data/lib/rdoc/rdoc.rb +45 -21
  96. data/lib/rdoc/ri/driver.rb +322 -76
  97. data/lib/rdoc/ri/paths.rb +90 -31
  98. data/lib/rdoc/ri/store.rb +2 -353
  99. data/lib/rdoc/ruby_lex.rb +5 -21
  100. data/lib/rdoc/ruby_token.rb +2 -3
  101. data/lib/rdoc/rubygems_hook.rb +21 -9
  102. data/lib/rdoc/servlet.rb +302 -0
  103. data/lib/rdoc/stats.rb +28 -20
  104. data/lib/rdoc/store.rb +881 -0
  105. data/lib/rdoc/task.rb +2 -1
  106. data/lib/rdoc/test_case.rb +103 -1
  107. data/lib/rdoc/text.rb +5 -4
  108. data/lib/rdoc/tom_doc.rb +17 -16
  109. data/lib/rdoc/top_level.rb +43 -285
  110. data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
  111. data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
  112. data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
  113. data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
  114. data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
  115. data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
  116. data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
  117. data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
  118. data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
  119. data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
  120. data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
  121. data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
  122. data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
  123. data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
  124. data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
  125. data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
  126. data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
  127. data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
  128. data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
  129. data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
  130. data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
  131. data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
  132. data/test/test_attribute_manager.rb +7 -4
  133. data/test/test_rdoc_any_method.rb +84 -13
  134. data/test/test_rdoc_attr.rb +59 -9
  135. data/test/test_rdoc_class_module.rb +670 -73
  136. data/test/test_rdoc_code_object.rb +21 -1
  137. data/test/test_rdoc_comment.rb +1 -1
  138. data/test/test_rdoc_constant.rb +132 -0
  139. data/test/test_rdoc_context.rb +84 -18
  140. data/test/test_rdoc_context_section.rb +99 -15
  141. data/test/test_rdoc_cross_reference.rb +1 -1
  142. data/test/test_rdoc_encoding.rb +17 -1
  143. data/test/test_rdoc_extend.rb +94 -0
  144. data/test/test_rdoc_generator_darkfish.rb +45 -19
  145. data/test/test_rdoc_generator_json_index.rb +27 -7
  146. data/test/test_rdoc_generator_markup.rb +3 -3
  147. data/test/test_rdoc_generator_ri.rb +11 -9
  148. data/test/test_rdoc_include.rb +12 -0
  149. data/test/test_rdoc_markdown.rb +977 -0
  150. data/test/test_rdoc_markdown_test.rb +1891 -0
  151. data/test/test_rdoc_markup.rb +1 -1
  152. data/test/test_rdoc_markup_attribute_manager.rb +2 -2
  153. data/test/test_rdoc_markup_attributes.rb +39 -0
  154. data/test/test_rdoc_markup_document.rb +16 -1
  155. data/test/test_rdoc_markup_formatter.rb +7 -4
  156. data/test/test_rdoc_markup_hard_break.rb +31 -0
  157. data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
  158. data/test/test_rdoc_markup_paragraph.rb +15 -1
  159. data/test/test_rdoc_markup_parser.rb +152 -89
  160. data/test/test_rdoc_markup_to_ansi.rb +23 -2
  161. data/test/test_rdoc_markup_to_bs.rb +24 -0
  162. data/test/test_rdoc_markup_to_html.rb +50 -19
  163. data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
  164. data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
  165. data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
  166. data/test/test_rdoc_markup_to_label.rb +63 -1
  167. data/test/test_rdoc_markup_to_markdown.rb +352 -0
  168. data/test/test_rdoc_markup_to_rdoc.rb +22 -2
  169. data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
  170. data/test/test_rdoc_markup_to_tt_only.rb +20 -0
  171. data/test/test_rdoc_markup_verbatim.rb +13 -0
  172. data/test/test_rdoc_method_attr.rb +5 -0
  173. data/test/test_rdoc_normal_class.rb +24 -5
  174. data/test/test_rdoc_normal_module.rb +1 -1
  175. data/test/test_rdoc_options.rb +21 -6
  176. data/test/test_rdoc_parser.rb +24 -0
  177. data/test/test_rdoc_parser_c.rb +151 -26
  178. data/test/test_rdoc_parser_markdown.rb +55 -0
  179. data/test/test_rdoc_parser_rd.rb +2 -2
  180. data/test/test_rdoc_parser_ruby.rb +468 -109
  181. data/test/test_rdoc_parser_simple.rb +2 -2
  182. data/test/test_rdoc_rd_block_parser.rb +0 -4
  183. data/test/test_rdoc_rdoc.rb +110 -22
  184. data/test/test_rdoc_ri_driver.rb +415 -80
  185. data/test/test_rdoc_ri_paths.rb +122 -13
  186. data/test/test_rdoc_ruby_lex.rb +5 -61
  187. data/test/test_rdoc_ruby_token.rb +19 -0
  188. data/test/test_rdoc_rubygems_hook.rb +64 -43
  189. data/test/test_rdoc_servlet.rb +429 -0
  190. data/test/test_rdoc_stats.rb +83 -24
  191. data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
  192. data/test/test_rdoc_task.rb +2 -2
  193. data/test/test_rdoc_text.rb +37 -11
  194. data/test/test_rdoc_tom_doc.rb +59 -62
  195. data/test/test_rdoc_top_level.rb +71 -113
  196. data/test/xref_test_case.rb +7 -9
  197. metadata +122 -39
  198. metadata.gz.sig +0 -0
  199. data/CVE-2013-0256.rdoc +0 -49
  200. data/lib/rdoc/markup/attribute.rb +0 -51
@@ -15,6 +15,10 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
15
15
  assert_equal "\e[0m\n", @to.res.join
16
16
  end
17
17
 
18
+ def accept_block_quote
19
+ assert_equal "\e[0m> quote\n", @to.res.join
20
+ end
21
+
18
22
  def accept_document
19
23
  assert_equal "\e[0mhello\n", @to.res.join
20
24
  end
@@ -242,10 +246,28 @@ class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase
242
246
  @to.res.join
243
247
  end
244
248
 
249
+ def accept_list_item_start_note_multi_description
250
+ assert_equal "\e[0mlabel:\n description one\n\n description two\n\n",
251
+ @to.res.join
252
+ end
253
+
254
+ def accept_list_item_start_note_multi_label
255
+ assert_equal "\e[0mone\ntwo:\n two headers\n\n",
256
+ @to.res.join
257
+ end
258
+
245
259
  def accept_paragraph_b
246
260
  assert_equal "\e[0mreg \e[1mbold words\e[m reg\n", @to.end_accepting
247
261
  end
248
262
 
263
+ def accept_paragraph_br
264
+ assert_equal "\e[0mone\ntwo\n", @to.end_accepting
265
+ end
266
+
267
+ def accept_paragraph_break
268
+ assert_equal "\e[0mhello\nworld\n", @to.end_accepting
269
+ end
270
+
249
271
  def accept_paragraph_i
250
272
  assert_equal "\e[0mreg \e[4mitalic words\e[m reg\n", @to.end_accepting
251
273
  end
@@ -334,8 +356,7 @@ bar ::
334
356
  NOTE_LIST
335
357
 
336
358
  expected = <<-EXPECTED
337
- \e[0m
338
- foo:
359
+ \e[0mfoo
339
360
  bar:
340
361
  hi
341
362
 
@@ -15,6 +15,10 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
15
15
  assert_equal "\n", @to.res.join
16
16
  end
17
17
 
18
+ def accept_block_quote
19
+ assert_equal "> quote\n", @to.res.join
20
+ end
21
+
18
22
  def accept_document
19
23
  assert_equal "hello\n", @to.res.join
20
24
  end
@@ -249,12 +253,32 @@ class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase
249
253
  assert_equal "teletype:\n teletype description\n\n", @to.res.join
250
254
  end
251
255
 
256
+ def accept_list_item_start_note_multi_description
257
+ assert_equal "label:\n description one\n\n description two\n\n",
258
+ @to.res.join
259
+ end
260
+
261
+ def accept_list_item_start_note_multi_label
262
+ assert_equal "one\ntwo:\n two headers\n\n", @to.res.join
263
+ end
264
+
252
265
  def accept_paragraph_b
253
266
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
254
267
  assert_equal "reg b\bbo\bol\bld\bd \b w\bwo\bor\brd\bds\bs reg\n",
255
268
  @to.end_accepting
256
269
  end
257
270
 
271
+ def accept_paragraph_br
272
+ skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
273
+ assert_equal "one\ntwo\n", @to.end_accepting
274
+ end
275
+
276
+ def accept_paragraph_break
277
+ skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
278
+ assert_equal "hello\nworld\n",
279
+ @to.end_accepting
280
+ end
281
+
258
282
  def accept_paragraph_i
259
283
  skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars
260
284
  assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc_\b _\bw_\bo_\br_\bd_\bs reg\n",
@@ -7,7 +7,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
7
7
  def setup
8
8
  super
9
9
 
10
- @to = RDoc::Markup::ToHtml.new
10
+ @to = RDoc::Markup::ToHtml.new @options
11
11
  end
12
12
 
13
13
  def test_class_gen_relative_url
@@ -27,6 +27,10 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
27
27
  assert_empty @to.res.join
28
28
  end
29
29
 
30
+ def accept_block_quote
31
+ assert_equal "\n<blockquote>\n<p>quote</p>\n</blockquote>\n", @to.res.join
32
+ end
33
+
30
34
  def accept_document
31
35
  assert_equal "\n<p>hello</p>\n", @to.res.join
32
36
  end
@@ -154,6 +158,31 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
154
158
  assert_equal expected, @to.res.join
155
159
  end
156
160
 
161
+ def accept_list_item_start_note_multi_description
162
+ expected = <<-EXPECTED
163
+ <dl class="rdoc-list note-list"><dt>label
164
+ <dd>
165
+ <p>description one</p>
166
+ </dd><dd>
167
+ <p>description two</p>
168
+ </dd></dl>
169
+ EXPECTED
170
+
171
+ assert_equal expected, @to.res.join
172
+ end
173
+
174
+ def accept_list_item_start_note_multi_label
175
+ expected = <<-EXPECTED
176
+ <dl class="rdoc-list note-list"><dt>one
177
+ <dt>two
178
+ <dd>
179
+ <p>two headers</p>
180
+ </dd></dl>
181
+ EXPECTED
182
+
183
+ assert_equal expected, @to.res.join
184
+ end
185
+
157
186
  def accept_list_item_start_number
158
187
  assert_equal "<ol><li>", @to.res.join
159
188
  end
@@ -212,6 +241,14 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
212
241
  assert_equal "\n<p>reg <strong>bold words</strong> reg</p>\n", @to.res.join
213
242
  end
214
243
 
244
+ def accept_paragraph_br
245
+ assert_equal "\n<p>one<br>two</p>\n", @to.res.join
246
+ end
247
+
248
+ def accept_paragraph_break
249
+ assert_equal "\n<p>hello<br>\nworld</p>\n", @to.res.join
250
+ end
251
+
215
252
  def accept_paragraph_i
216
253
  assert_equal "\n<p>reg <em>italic words</em> reg</p>\n", @to.res.join
217
254
  end
@@ -324,11 +361,6 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
324
361
  end
325
362
 
326
363
  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
364
  verb = @RM::Verbatim.new("class C\n", "end\n")
333
365
 
334
366
  @to.start_accepting
@@ -345,19 +377,16 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
345
377
  end
346
378
 
347
379
  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
380
  verb = @RM::Verbatim.new("a % 09 # => blah\n")
354
381
 
355
382
  @to.start_accepting
356
383
  @to.accept_verbatim verb
357
384
 
385
+ inner = CGI.escapeHTML "a % 09 # => blah"
386
+
358
387
  expected = <<-EXPECTED
359
388
 
360
- <pre>a % 09 # =&gt; blah
389
+ <pre>#{inner}
361
390
  </pre>
362
391
  EXPECTED
363
392
 
@@ -365,11 +394,6 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
365
394
  end
366
395
 
367
396
  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
397
  verb = @RM::Verbatim.new("1 + 1\n")
374
398
  verb.format = :ruby
375
399
 
@@ -419,6 +443,12 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
419
443
  assert_equal "\n<p>C</p>\n", result
420
444
  end
421
445
 
446
+ def test_convert_TIDYLINK_footnote
447
+ result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]'
448
+
449
+ assert_equal "\n<p>text<a id=\"footmark-1\" href=\"#foottext-1\">*1</a></p>\n", result
450
+ end
451
+
422
452
  def test_convert_TIDYLINK_rdoc_label
423
453
  result = @to.convert '{foo}[rdoc-label:foottext-1]'
424
454
 
@@ -446,11 +476,11 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
446
476
  @to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
447
477
  end
448
478
 
449
- def test_gem_url_image_url
479
+ def test_gen_url_image_url
450
480
  assert_equal '<img src="http://example.com/image.png" />', @to.gen_url('http://example.com/image.png', 'ignored')
451
481
  end
452
482
 
453
- def test_gem_url_ssl_image_url
483
+ def test_gen_url_ssl_image_url
454
484
  assert_equal '<img src="https://example.com/image.png" />', @to.gen_url('https://example.com/image.png', 'ignored')
455
485
  end
456
486
 
@@ -497,6 +527,7 @@ verb2</pre>
497
527
  refute @to.parseable?('* 1'), '* 1'
498
528
  refute @to.parseable?('# only a comment'), '# only a comment'
499
529
  refute @to.parseable?('<% require "foo" %>'), 'ERB'
530
+ refute @to.parseable?('class="foo"'), 'HTML class'
500
531
  end
501
532
 
502
533
  def test_to_html
@@ -5,7 +5,9 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
5
5
  def setup
6
6
  super
7
7
 
8
- @to = RDoc::Markup::ToHtmlCrossref.new 'index.html', @c1, true
8
+ @options.hyperlink_all = true
9
+
10
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
9
11
  end
10
12
 
11
13
  def test_convert_CROSSREF
@@ -117,10 +119,10 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
117
119
  end
118
120
 
119
121
  def test_handle_special_HYPERLINK_rdoc
120
- readme = RDoc::TopLevel.new 'README.txt'
122
+ readme = @store.add_file 'README.txt'
121
123
  readme.parser = RDoc::Parser::Simple
122
124
 
123
- @to = RDoc::Markup::ToHtmlCrossref.new 'C2.html', @c2, true
125
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
124
126
 
125
127
  link = @to.handle_special_HYPERLINK hyper 'C2::C3'
126
128
 
@@ -136,10 +138,10 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
136
138
  end
137
139
 
138
140
  def test_handle_special_TIDYLINK_rdoc
139
- readme = RDoc::TopLevel.new 'README.txt'
141
+ readme = @store.add_file 'README.txt'
140
142
  readme.parser = RDoc::Parser::Simple
141
143
 
142
- @to = RDoc::Markup::ToHtmlCrossref.new 'C2.html', @c2, true
144
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2
143
145
 
144
146
  link = @to.handle_special_TIDYLINK tidy 'C2::C3'
145
147
 
@@ -165,6 +167,22 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
165
167
  link, 'C1#m@foo'
166
168
  end
167
169
 
170
+ def test_to_html_CROSSREF_email
171
+ @options.hyperlink_all = false
172
+
173
+ @to = RDoc::Markup::ToHtmlCrossref.new @options, 'index.html', @c1
174
+
175
+ result = @to.to_html 'first.last@example.com'
176
+
177
+ assert_equal 'first.last@example.com', result
178
+ end
179
+
180
+ def test_to_html_CROSSREF_email_hyperlink_all
181
+ result = @to.to_html 'first.last@example.com'
182
+
183
+ assert_equal 'first.last@example.com', result
184
+ end
185
+
168
186
  def test_link
169
187
  assert_equal 'n', @to.link('n', 'n')
170
188
 
@@ -7,7 +7,7 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
7
7
  def setup
8
8
  super
9
9
 
10
- @to = RDoc::Markup::ToHtmlSnippet.new 100, 100
10
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 100, 100
11
11
  @ellipsis = @to.to_html '...'
12
12
  end
13
13
 
@@ -15,6 +15,12 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
15
15
  assert_empty @to.res.join
16
16
  end
17
17
 
18
+ def accept_block_quote
19
+ assert_equal "\n<blockquote><p>quote\n</blockquote>\n", @to.res.join
20
+
21
+ assert_equal 5, @to.characters
22
+ end
23
+
18
24
  def accept_document
19
25
  assert_equal "<p>hello\n", @to.res.join
20
26
  assert_equal 5, @to.characters
@@ -165,6 +171,27 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
165
171
  assert_equal 29, @to.characters
166
172
  end
167
173
 
174
+ def accept_list_item_start_note_multi_description
175
+ expected = <<-EXPECTED
176
+ <p>label &mdash; description one
177
+ <p>description two
178
+
179
+ EXPECTED
180
+
181
+ assert_equal expected, @to.res.join
182
+ assert_equal 37, @to.characters
183
+ end
184
+
185
+ def accept_list_item_start_note_multi_label
186
+ expected = <<-EXPECTED
187
+ <p>one, two &mdash; two headers
188
+
189
+ EXPECTED
190
+
191
+ assert_equal expected, @to.res.join
192
+ assert_equal 18, @to.characters
193
+ end
194
+
168
195
  def accept_list_item_start_number
169
196
  assert_equal "<p>", @to.res.join
170
197
  assert_equal 0, @to.characters
@@ -235,6 +262,18 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
235
262
  assert_equal 18, @to.characters
236
263
  end
237
264
 
265
+ def accept_paragraph_br
266
+ assert_equal "<p>one<br>two\n", @to.res.join
267
+
268
+ assert_equal 6, @to.characters
269
+ end
270
+
271
+ def accept_paragraph_break
272
+ assert_equal "<p>hello<br>\nworld\n", @to.res.join
273
+
274
+ assert_equal 11, @to.characters
275
+ end
276
+
238
277
  def accept_paragraph_i
239
278
  assert_equal "<p>reg <em>italic words</em> reg\n", @to.res.join
240
279
 
@@ -384,9 +423,11 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
384
423
  @to.start_accepting
385
424
  @to.accept_verbatim verb
386
425
 
426
+ inner = CGI.escapeHTML "a % 09 # => blah"
427
+
387
428
  expected = <<-EXPECTED
388
429
 
389
- <pre>a % 09 # =&gt; blah
430
+ <pre>#{inner}
390
431
  </pre>
391
432
  EXPECTED
392
433
 
@@ -395,7 +436,7 @@ class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase
395
436
  end
396
437
 
397
438
  def test_add_paragraph
398
- @to = RDoc::Markup::ToHtmlSnippet.new 0, 3
439
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 0, 3
399
440
  assert_throws :done do
400
441
  @to.add_paragraph
401
442
  @to.add_paragraph
@@ -424,8 +465,8 @@ and an ellipsis must follow
424
465
 
425
466
  actual = @to.convert rdoc
426
467
 
427
- assert_equal 111, @to.characters
428
468
  assert_equal expected, actual
469
+ assert_equal 111, @to.characters, 'snippet character length'
429
470
  end
430
471
 
431
472
  def test_convert_limit_2
@@ -444,11 +485,11 @@ be guessed, raises an error if +name+ couldn't be guessed.
444
485
  actual = @to.convert rdoc
445
486
 
446
487
  assert_equal expected, actual
447
- assert_equal 159, @to.characters
488
+ assert_equal 159, @to.characters, 'snippet character length'
448
489
  end
449
490
 
450
491
  def test_convert_limit_paragraphs
451
- @to = RDoc::Markup::ToHtmlSnippet.new 100, 3
492
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 100, 3
452
493
 
453
494
  rdoc = <<-RDOC
454
495
  = \RDoc - Ruby Documentation System
@@ -479,7 +520,7 @@ See RDoc for a description of RDoc's markup and basic use.
479
520
  end
480
521
 
481
522
  def test_convert_limit_in_tag
482
- @to = RDoc::Markup::ToHtmlSnippet.new 4
523
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 4
483
524
  rdoc = "* ab *c* d\n"
484
525
 
485
526
  expected = "<p>ab <strong>c</strong> #{@ellipsis}\n\n"
@@ -558,7 +599,7 @@ This routine modifies its +comment+ parameter.
558
599
  end
559
600
 
560
601
  def test_convert_limit_over
561
- @to = RDoc::Markup::ToHtmlSnippet.new 4
602
+ @to = RDoc::Markup::ToHtmlSnippet.new @options, 4
562
603
  rdoc = "* text\n" * 2
563
604
 
564
605
  expected = "<p>text\n"
@@ -0,0 +1,32 @@
1
+ require 'rdoc/test_case'
2
+
3
+ class TestRDocMarkupToJoinedParagraph < RDoc::TestCase
4
+
5
+ def setup
6
+ super
7
+
8
+ @to = RDoc::Markup::ToJoinedParagraph.new
9
+ end
10
+
11
+ def test_accept_paragraph
12
+ parsed = para('hello', ' ', 'world')
13
+
14
+ @to.accept_paragraph parsed
15
+
16
+ expected = para('hello world')
17
+
18
+ assert_equal expected, parsed
19
+ end
20
+
21
+ def test_accept_paragraph_break
22
+ parsed = para('hello', ' ', 'world', hard_break, 'everyone')
23
+
24
+ @to.accept_paragraph parsed
25
+
26
+ expected = para('hello world', hard_break, 'everyone')
27
+
28
+ assert_equal expected, parsed
29
+ end
30
+
31
+ end
32
+