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
@@ -11,14 +11,11 @@ end
11
11
  class RDoc::Markup::AttrChanger
12
12
 
13
13
  def to_s # :nodoc:
14
- "Attr: +#{RDoc::Markup::Attribute.as_string turn_on}/-#{RDoc::Markup::Attribute.as_string turn_off}"
14
+ "Attr: +#{turn_on}/-#{turn_off}"
15
15
  end
16
16
 
17
17
  def inspect # :nodoc:
18
- "+%s/-%s" % [
19
- RDoc::Markup::Attribute.as_string(turn_on),
20
- RDoc::Markup::Attribute.as_string(turn_off),
21
- ]
18
+ '+%d/-%d' % [turn_on, turn_off]
22
19
  end
23
20
 
24
21
  end
@@ -22,6 +22,11 @@ class RDoc::Markup::AttributeManager
22
22
 
23
23
  PROTECT_ATTR = A_PROTECT.chr # :nodoc:
24
24
 
25
+ ##
26
+ # The attributes enabled for this markup object.
27
+
28
+ attr_reader :attributes
29
+
25
30
  ##
26
31
  # This maps delimiters that occur around words (such as *bold* or +tt+)
27
32
  # where the start and end delimiters and the same. This lets us optimize
@@ -60,8 +65,9 @@ class RDoc::Markup::AttributeManager
60
65
  @html_tags = {}
61
66
  @matching_word_pairs = {}
62
67
  @protectable = %w[<]
63
- @special = {}
68
+ @special = []
64
69
  @word_pair_map = {}
70
+ @attributes = RDoc::Markup::Attributes.new
65
71
 
66
72
  add_word_pair "*", "*", :BOLD
67
73
  add_word_pair "_", "_", :EM
@@ -96,11 +102,11 @@ class RDoc::Markup::AttributeManager
96
102
  def changed_attribute_by_name current_set, new_set
97
103
  current = new = 0
98
104
  current_set.each do |name|
99
- current |= RDoc::Markup::Attribute.bitmap_for(name)
105
+ current |= @attributes.bitmap_for(name)
100
106
  end
101
107
 
102
108
  new_set.each do |name|
103
- new |= RDoc::Markup::Attribute.bitmap_for(name)
109
+ new |= @attributes.bitmap_for(name)
104
110
  end
105
111
 
106
112
  change_attribute(current, new)
@@ -161,12 +167,15 @@ class RDoc::Markup::AttributeManager
161
167
  ##
162
168
  # Converts special sequences to RDoc attributes
163
169
 
164
- def convert_specials(str, attrs)
170
+ def convert_specials str, attrs
165
171
  unless @special.empty?
166
- @special.each do |regexp, attr|
172
+ @special.each do |regexp, attribute|
167
173
  str.scan(regexp) do
168
- attrs.set_attrs($`.length, $&.length,
169
- attr | RDoc::Markup::Attribute::SPECIAL)
174
+ capture = $~.size == 1 ? 0 : 1
175
+
176
+ s, e = $~.offset capture
177
+
178
+ attrs.set_attrs s, e - s, attribute | @attributes.special
170
179
  end
171
180
  end
172
181
  end
@@ -200,7 +209,7 @@ class RDoc::Markup::AttributeManager
200
209
  raise ArgumentError, "Word flags may not start with '<'" if
201
210
  start[0,1] == '<'
202
211
 
203
- bitmap = RDoc::Markup::Attribute.bitmap_for name
212
+ bitmap = @attributes.bitmap_for name
204
213
 
205
214
  if start == stop then
206
215
  @matching_word_pairs[start] = bitmap
@@ -220,7 +229,7 @@ class RDoc::Markup::AttributeManager
220
229
  # am.add_html 'em', :EM
221
230
 
222
231
  def add_html(tag, name)
223
- @html_tags[tag.downcase] = RDoc::Markup::Attribute.bitmap_for name
232
+ @html_tags[tag.downcase] = @attributes.bitmap_for name
224
233
  end
225
234
 
226
235
  ##
@@ -229,14 +238,14 @@ class RDoc::Markup::AttributeManager
229
238
  #
230
239
  # @am.add_special(/((https?:)\S+\w)/, :HYPERLINK)
231
240
 
232
- def add_special(pattern, name)
233
- @special[pattern] = RDoc::Markup::Attribute.bitmap_for name
241
+ def add_special pattern, name
242
+ @special << [pattern, @attributes.bitmap_for(name)]
234
243
  end
235
244
 
236
245
  ##
237
246
  # Processes +str+ converting attributes, HTML and specials
238
247
 
239
- def flow(str)
248
+ def flow str
240
249
  @str = str
241
250
 
242
251
  mask_protected_sequences
@@ -303,9 +312,9 @@ class RDoc::Markup::AttributeManager
303
312
  res << change_attribute(current_attr, new_attr)
304
313
  current_attr = new_attr
305
314
 
306
- if (current_attr & RDoc::Markup::Attribute::SPECIAL) != 0 then
315
+ if (current_attr & @attributes.special) != 0 then
307
316
  i += 1 while
308
- i < str_len and (@attrs[i] & RDoc::Markup::Attribute::SPECIAL) != 0
317
+ i < str_len and (@attrs[i] & @attributes.special) != 0
309
318
 
310
319
  res << RDoc::Markup::Special.new(current_attr,
311
320
  copy_string(start_pos, i))
@@ -0,0 +1,70 @@
1
+ ##
2
+ # We manage a set of attributes. Each attribute has a symbol name and a bit
3
+ # value.
4
+
5
+ class RDoc::Markup::Attributes
6
+
7
+ ##
8
+ # The special attribute type. See RDoc::Markup#add_special
9
+
10
+ attr_reader :special
11
+
12
+ ##
13
+ # Creates a new attributes set.
14
+
15
+ def initialize
16
+ @special = 1
17
+
18
+ @name_to_bitmap = [
19
+ [:_SPECIAL_, @special],
20
+ ]
21
+
22
+ @next_bitmap = @special << 1
23
+ end
24
+
25
+ ##
26
+ # Returns a unique bit for +name+
27
+
28
+ def bitmap_for name
29
+ bitmap = @name_to_bitmap.assoc name
30
+
31
+ unless bitmap then
32
+ bitmap = @next_bitmap
33
+ @next_bitmap <<= 1
34
+ @name_to_bitmap << [name, bitmap]
35
+ else
36
+ bitmap = bitmap.last
37
+ end
38
+
39
+ bitmap
40
+ end
41
+
42
+ ##
43
+ # Returns a string representation of +bitmap+
44
+
45
+ def as_string bitmap
46
+ return 'none' if bitmap.zero?
47
+ res = []
48
+
49
+ @name_to_bitmap.each do |name, bit|
50
+ res << name if (bitmap & bit) != 0
51
+ end
52
+
53
+ res.join ','
54
+ end
55
+
56
+ ##
57
+ # yields each attribute name in +bitmap+
58
+
59
+ def each_name_of bitmap
60
+ return enum_for __method__, bitmap unless block_given?
61
+
62
+ @name_to_bitmap.each do |name, bit|
63
+ next if bit == @special
64
+
65
+ yield name.to_s if (bitmap & bit) != 0
66
+ end
67
+ end
68
+
69
+ end
70
+
@@ -0,0 +1,14 @@
1
+ ##
2
+ # A quoted section which contains markup items.
3
+
4
+ class RDoc::Markup::BlockQuote < RDoc::Markup::Raw
5
+
6
+ ##
7
+ # Calls #accept_block_quote on +visitor+
8
+
9
+ def accept visitor
10
+ visitor.accept_block_quote self
11
+ end
12
+
13
+ end
14
+
@@ -3,6 +3,8 @@
3
3
 
4
4
  class RDoc::Markup::Document
5
5
 
6
+ include Enumerable
7
+
6
8
  ##
7
9
  # The file this document was created from. See also
8
10
  # RDoc::ClassModule#add_comment
@@ -19,7 +21,7 @@ class RDoc::Markup::Document
19
21
 
20
22
  def initialize *parts
21
23
  @parts = []
22
- @parts.push(*parts)
24
+ @parts.concat parts
23
25
 
24
26
  @file = nil
25
27
  end
@@ -31,7 +33,7 @@ class RDoc::Markup::Document
31
33
  case part
32
34
  when RDoc::Markup::Document then
33
35
  unless part.empty? then
34
- parts.push(*part.parts)
36
+ parts.concat part.parts
35
37
  parts << RDoc::Markup::BlankLine.new
36
38
  end
37
39
  when String then
@@ -67,6 +69,20 @@ class RDoc::Markup::Document
67
69
  visitor.end_accepting
68
70
  end
69
71
 
72
+ ##
73
+ # Concatenates the given +parts+ onto the document
74
+
75
+ def concat parts
76
+ self.parts.concat parts
77
+ end
78
+
79
+ ##
80
+ # Enumerator for the parts of this document
81
+
82
+ def each &block
83
+ @parts.each(&block)
84
+ end
85
+
70
86
  ##
71
87
  # Does this document have no parts?
72
88
 
@@ -80,7 +96,7 @@ class RDoc::Markup::Document
80
96
  def file= location
81
97
  @file = case location
82
98
  when RDoc::TopLevel then
83
- location.absolute_name
99
+ location.relative_name
84
100
  else
85
101
  location
86
102
  end
@@ -132,7 +148,7 @@ class RDoc::Markup::Document
132
148
  # Appends +parts+ to the document
133
149
 
134
150
  def push *parts
135
- self.parts.push(*parts)
151
+ self.parts.concat parts
136
152
  end
137
153
 
138
154
  ##
@@ -20,14 +20,21 @@ class RDoc::Markup::Formatter
20
20
  ##
21
21
  # Creates a new Formatter
22
22
 
23
- def initialize markup = nil
23
+ def initialize options, markup = nil
24
+ @options = options
25
+
24
26
  @markup = markup || RDoc::Markup.new
25
27
  @am = @markup.attribute_manager
28
+ @am.add_special(/<br>/, :HARD_BREAK)
29
+
30
+ @attributes = @am.attributes
26
31
 
27
32
  @attr_tags = []
28
33
 
29
34
  @in_tt = 0
30
- @tt_bit = RDoc::Markup::Attribute.bitmap_for :TT
35
+ @tt_bit = @attributes.bitmap_for :TT
36
+
37
+ @hard_break = ''
31
38
  end
32
39
 
33
40
  ##
@@ -44,7 +51,7 @@ class RDoc::Markup::Formatter
44
51
  # tags for flexibility
45
52
 
46
53
  def add_tag(name, start, stop)
47
- attr = RDoc::Markup::Attribute.bitmap_for name
54
+ attr = @attributes.bitmap_for name
48
55
  @attr_tags << InlineTag.new(attr, start, stop)
49
56
  end
50
57
 
@@ -93,7 +100,7 @@ class RDoc::Markup::Formatter
93
100
 
94
101
  handled = false
95
102
 
96
- RDoc::Markup::Attribute.each_name_of special.type do |name|
103
+ @attributes.each_name_of special.type do |name|
97
104
  method_name = "handle_special_#{name}"
98
105
 
99
106
  if respond_to? method_name then
@@ -102,7 +109,11 @@ class RDoc::Markup::Formatter
102
109
  end
103
110
  end
104
111
 
105
- raise "Unhandled special: #{special}" unless handled
112
+ unless handled then
113
+ special_name = @attributes.as_string special.type
114
+
115
+ raise RDoc::Error, "Unhandled special #{special_name}: #{special}"
116
+ end
106
117
 
107
118
  special.text
108
119
  end
@@ -122,7 +133,7 @@ class RDoc::Markup::Formatter
122
133
  #
123
134
  # alias accept_raw ignore
124
135
 
125
- def ignore node
136
+ def ignore *node
126
137
  end
127
138
 
128
139
  ##
@@ -34,7 +34,7 @@ require 'minitest/unit'
34
34
  #
35
35
  # end
36
36
 
37
- class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
37
+ class RDoc::Markup::FormatterTestCase < RDoc::TestCase
38
38
 
39
39
  ##
40
40
  # Call #setup when inheriting from this test case.
@@ -53,7 +53,8 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
53
53
  def setup
54
54
  super
55
55
 
56
- @RM = RDoc::Markup
56
+ @options = RDoc::Options.new
57
+
57
58
  @m = @RM.new
58
59
 
59
60
  @bullet_list = @RM::List.new(:BULLET,
@@ -85,7 +86,7 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
85
86
  # Call to add the visitor tests to your test case
86
87
 
87
88
  def self.add_visitor_tests
88
- self.class_eval do
89
+ class_eval do
89
90
 
90
91
  ##
91
92
  # Calls start_accepting which needs to verify startup state
@@ -118,6 +119,16 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
118
119
  accept_blank_line
119
120
  end
120
121
 
122
+ ##
123
+ # Calls accept_block_quote
124
+
125
+ def test_accept_block_quote
126
+ @to.start_accepting
127
+
128
+ @to.accept_block_quote block para 'quote'
129
+
130
+ accept_block_quote
131
+ end
121
132
  ##
122
133
  # Test case that calls <tt>@to.accept_document</tt>
123
134
 
@@ -232,6 +243,29 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
232
243
  accept_paragraph_b
233
244
  end
234
245
 
246
+ ##
247
+ # Calls accept_paragraph_br with a RDoc::Markup::Paragraph containing
248
+ # a \<br>
249
+
250
+ def test_accept_paragraph_br
251
+ @to.start_accepting
252
+
253
+ @to.accept_paragraph para 'one<br>two'
254
+
255
+ accept_paragraph_br
256
+ end
257
+
258
+ ##
259
+ # Calls accept_paragraph with a Paragraph containing a hard break
260
+
261
+ def test_accept_paragraph_break
262
+ @to.start_accepting
263
+
264
+ @to.accept_paragraph para('hello', hard_break, 'world')
265
+
266
+ accept_paragraph_break
267
+ end
268
+
235
269
  ##
236
270
  # Calls accept_paragraph_i with a RDoc::Markup::Paragraph containing
237
271
  # emphasized words
@@ -373,9 +407,9 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
373
407
  # Calls accept_list_item_start_note_2
374
408
 
375
409
  def test_accept_list_item_start_note_2
376
- list = @RM::List.new(:NOTE,
377
- @RM::ListItem.new('<tt>teletype</tt>',
378
- @RM::Paragraph.new('teletype description')))
410
+ list = list(:NOTE,
411
+ item('<tt>teletype</tt>',
412
+ para('teletype description')))
379
413
 
380
414
  @to.start_accepting
381
415
 
@@ -386,6 +420,41 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
386
420
  accept_list_item_start_note_2
387
421
  end
388
422
 
423
+ ##
424
+ # Calls accept_list_item_start_note_multi_description
425
+
426
+ def test_accept_list_item_start_note_multi_description
427
+ list = list(:NOTE,
428
+ item(%w[label],
429
+ para('description one')),
430
+ item(nil, para('description two')))
431
+
432
+ @to.start_accepting
433
+
434
+ list.accept @to
435
+
436
+ @to.end_accepting
437
+
438
+ accept_list_item_start_note_multi_description
439
+ end
440
+
441
+ ##
442
+ # Calls accept_list_item_start_note_multi_label
443
+
444
+ def test_accept_list_item_start_note_multi_label
445
+ list = list(:NOTE,
446
+ item(%w[one two],
447
+ para('two headers')))
448
+
449
+ @to.start_accepting
450
+
451
+ list.accept @to
452
+
453
+ @to.end_accepting
454
+
455
+ accept_list_item_start_note_multi_label
456
+ end
457
+
389
458
  ##
390
459
  # Calls accept_list_item_start_number
391
460
 
@@ -634,7 +703,7 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
634
703
  end
635
704
 
636
705
  ##
637
- # Calls accept_list_end_ulpha
706
+ # Calls accept_list_end_ualpha
638
707
 
639
708
  def test_accept_list_end_ualpha
640
709
  @to.start_accepting
@@ -669,28 +738,28 @@ class RDoc::Markup::FormatterTestCase < MiniTest::Unit::TestCase
669
738
  # Calls list_verbatim with a list containing a verbatim block
670
739
 
671
740
  def test_list_verbatim # HACK overblown
672
- doc = @RM::Document.new(
673
- @RM::List.new(:BULLET,
674
- @RM::ListItem.new(nil,
675
- @RM::Paragraph.new('list', 'stuff'),
676
- @RM::BlankLine.new,
677
- @RM::Verbatim.new("* list\n",
678
- " with\n",
679
- "\n",
680
- " second\n",
681
- "\n",
682
- " 1. indented\n",
683
- " 2. numbered\n",
684
- "\n",
685
- " third\n",
686
- "\n",
687
- "* second\n"))))
741
+ doc =
742
+ doc(
743
+ list(:BULLET,
744
+ item(nil,
745
+ para('list stuff'),
746
+ blank_line,
747
+ verb("* list\n",
748
+ " with\n",
749
+ "\n",
750
+ " second\n",
751
+ "\n",
752
+ " 1. indented\n",
753
+ " 2. numbered\n",
754
+ "\n",
755
+ " third\n",
756
+ "\n",
757
+ "* second\n"))))
688
758
 
689
759
  doc.accept @to
690
760
 
691
761
  list_verbatim
692
762
  end
693
-
694
763
  end
695
764
  end
696
765