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.
- checksums.yaml +6 -6
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +3 -2
- data/DEVELOPERS.rdoc +53 -0
- data/History.rdoc +159 -25
- data/LEGAL.rdoc +12 -0
- data/Manifest.txt +56 -3
- data/README.rdoc +87 -19
- data/Rakefile +11 -2
- data/TODO.rdoc +20 -13
- data/bin/rdoc +4 -0
- data/lib/gauntlet_rdoc.rb +1 -1
- data/lib/rdoc.rb +32 -71
- data/lib/rdoc/any_method.rb +75 -21
- data/lib/rdoc/attr.rb +49 -10
- data/lib/rdoc/class_module.rb +182 -32
- data/lib/rdoc/code_object.rb +54 -12
- data/lib/rdoc/comment.rb +8 -1
- data/lib/rdoc/constant.rb +100 -6
- data/lib/rdoc/context.rb +93 -41
- data/lib/rdoc/context/section.rb +143 -28
- data/lib/rdoc/cross_reference.rb +58 -50
- data/lib/rdoc/encoding.rb +34 -29
- data/lib/rdoc/erb_partial.rb +18 -0
- data/lib/rdoc/extend.rb +117 -0
- data/lib/rdoc/generator.rb +11 -6
- data/lib/rdoc/generator/darkfish.rb +250 -62
- data/lib/rdoc/generator/json_index.rb +20 -12
- data/lib/rdoc/generator/markup.rb +10 -12
- data/lib/rdoc/generator/ri.rb +7 -60
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +16 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +14 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +13 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -1
- data/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -9
- data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -0
- data/lib/rdoc/generator/template/darkfish/rdoc.css +31 -0
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +18 -0
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +37 -0
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +3 -3
- data/lib/rdoc/include.rb +12 -3
- data/lib/rdoc/markdown.kpeg +1186 -0
- data/lib/rdoc/markdown.rb +16336 -0
- data/lib/rdoc/markdown/entities.rb +2128 -0
- data/lib/rdoc/markdown/literals_1_8.kpeg +18 -0
- data/lib/rdoc/markdown/literals_1_8.rb +454 -0
- data/lib/rdoc/markdown/literals_1_9.kpeg +22 -0
- data/lib/rdoc/markdown/literals_1_9.rb +417 -0
- data/lib/rdoc/markup.rb +69 -10
- data/lib/rdoc/markup/attr_changer.rb +2 -5
- data/lib/rdoc/markup/attribute_manager.rb +23 -14
- data/lib/rdoc/markup/attributes.rb +70 -0
- data/lib/rdoc/markup/block_quote.rb +14 -0
- data/lib/rdoc/markup/document.rb +20 -4
- data/lib/rdoc/markup/formatter.rb +17 -6
- data/lib/rdoc/markup/formatter_test_case.rb +93 -24
- data/lib/rdoc/markup/hard_break.rb +31 -0
- data/lib/rdoc/markup/heading.rb +1 -1
- data/lib/rdoc/markup/indented_paragraph.rb +14 -0
- data/lib/rdoc/markup/list.rb +23 -4
- data/lib/rdoc/markup/list_item.rb +17 -4
- data/lib/rdoc/markup/paragraph.rb +14 -0
- data/lib/rdoc/markup/parser.rb +107 -60
- data/lib/rdoc/markup/raw.rb +4 -4
- data/lib/rdoc/markup/special.rb +3 -3
- data/lib/rdoc/markup/to_ansi.rb +7 -1
- data/lib/rdoc/markup/to_html.rb +42 -14
- data/lib/rdoc/markup/to_html_crossref.rb +10 -9
- data/lib/rdoc/markup/to_html_snippet.rb +20 -4
- data/lib/rdoc/markup/to_joined_paragraph.rb +68 -0
- data/lib/rdoc/markup/to_label.rb +20 -1
- data/lib/rdoc/markup/to_markdown.rb +134 -0
- data/lib/rdoc/markup/to_rdoc.rb +36 -5
- data/lib/rdoc/markup/to_table_of_contents.rb +6 -1
- data/lib/rdoc/markup/to_tt_only.rb +11 -2
- data/lib/rdoc/markup/verbatim.rb +19 -0
- data/lib/rdoc/method_attr.rb +33 -19
- data/lib/rdoc/normal_class.rb +26 -7
- data/lib/rdoc/normal_module.rb +10 -5
- data/lib/rdoc/options.rb +95 -21
- data/lib/rdoc/parser.rb +6 -2
- data/lib/rdoc/parser/c.rb +212 -97
- data/lib/rdoc/parser/markdown.rb +23 -0
- data/lib/rdoc/parser/ruby.rb +115 -35
- data/lib/rdoc/parser/ruby_tools.rb +8 -3
- data/lib/rdoc/rd.rb +8 -4
- data/lib/rdoc/rd/block_parser.rb +1 -1
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rdoc.rb +45 -21
- data/lib/rdoc/ri/driver.rb +322 -76
- data/lib/rdoc/ri/paths.rb +90 -31
- data/lib/rdoc/ri/store.rb +2 -353
- data/lib/rdoc/ruby_lex.rb +5 -21
- data/lib/rdoc/ruby_token.rb +2 -3
- data/lib/rdoc/rubygems_hook.rb +21 -9
- data/lib/rdoc/servlet.rb +302 -0
- data/lib/rdoc/stats.rb +28 -20
- data/lib/rdoc/store.rb +881 -0
- data/lib/rdoc/task.rb +2 -1
- data/lib/rdoc/test_case.rb +103 -1
- data/lib/rdoc/text.rb +5 -4
- data/lib/rdoc/tom_doc.rb +17 -16
- data/lib/rdoc/top_level.rb +43 -285
- data/test/MarkdownTest_1.0.3/Amps and angle encoding.text +21 -0
- data/test/MarkdownTest_1.0.3/Auto links.text +13 -0
- data/test/MarkdownTest_1.0.3/Backslash escapes.text +120 -0
- data/test/MarkdownTest_1.0.3/Blockquotes with code blocks.text +11 -0
- data/test/MarkdownTest_1.0.3/Code Blocks.text +14 -0
- data/test/MarkdownTest_1.0.3/Code Spans.text +6 -0
- data/test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MarkdownTest_1.0.3/Horizontal rules.text +67 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Advanced).text +15 -0
- data/test/MarkdownTest_1.0.3/Inline HTML (Simple).text +69 -0
- data/test/MarkdownTest_1.0.3/Inline HTML comments.text +13 -0
- data/test/MarkdownTest_1.0.3/Links, inline style.text +12 -0
- data/test/MarkdownTest_1.0.3/Links, reference style.text +71 -0
- data/test/MarkdownTest_1.0.3/Links, shortcut references.text +20 -0
- data/test/MarkdownTest_1.0.3/Literal quotes in titles.text +7 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text +306 -0
- data/test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text +888 -0
- data/test/MarkdownTest_1.0.3/Nested blockquotes.text +5 -0
- data/test/MarkdownTest_1.0.3/Ordered and unordered lists.text +131 -0
- data/test/MarkdownTest_1.0.3/Strong and em together.text +7 -0
- data/test/MarkdownTest_1.0.3/Tabs.text +21 -0
- data/test/MarkdownTest_1.0.3/Tidyness.text +5 -0
- data/test/test_attribute_manager.rb +7 -4
- data/test/test_rdoc_any_method.rb +84 -13
- data/test/test_rdoc_attr.rb +59 -9
- data/test/test_rdoc_class_module.rb +670 -73
- data/test/test_rdoc_code_object.rb +21 -1
- data/test/test_rdoc_comment.rb +1 -1
- data/test/test_rdoc_constant.rb +132 -0
- data/test/test_rdoc_context.rb +84 -18
- data/test/test_rdoc_context_section.rb +99 -15
- data/test/test_rdoc_cross_reference.rb +1 -1
- data/test/test_rdoc_encoding.rb +17 -1
- data/test/test_rdoc_extend.rb +94 -0
- data/test/test_rdoc_generator_darkfish.rb +45 -19
- data/test/test_rdoc_generator_json_index.rb +27 -7
- data/test/test_rdoc_generator_markup.rb +3 -3
- data/test/test_rdoc_generator_ri.rb +11 -9
- data/test/test_rdoc_include.rb +12 -0
- data/test/test_rdoc_markdown.rb +977 -0
- data/test/test_rdoc_markdown_test.rb +1891 -0
- data/test/test_rdoc_markup.rb +1 -1
- data/test/test_rdoc_markup_attribute_manager.rb +2 -2
- data/test/test_rdoc_markup_attributes.rb +39 -0
- data/test/test_rdoc_markup_document.rb +16 -1
- data/test/test_rdoc_markup_formatter.rb +7 -4
- data/test/test_rdoc_markup_hard_break.rb +31 -0
- data/test/test_rdoc_markup_indented_paragraph.rb +14 -0
- data/test/test_rdoc_markup_paragraph.rb +15 -1
- data/test/test_rdoc_markup_parser.rb +152 -89
- data/test/test_rdoc_markup_to_ansi.rb +23 -2
- data/test/test_rdoc_markup_to_bs.rb +24 -0
- data/test/test_rdoc_markup_to_html.rb +50 -19
- data/test/test_rdoc_markup_to_html_crossref.rb +23 -5
- data/test/test_rdoc_markup_to_html_snippet.rb +49 -8
- data/test/test_rdoc_markup_to_joined_paragraph.rb +32 -0
- data/test/test_rdoc_markup_to_label.rb +63 -1
- data/test/test_rdoc_markup_to_markdown.rb +352 -0
- data/test/test_rdoc_markup_to_rdoc.rb +22 -2
- data/test/test_rdoc_markup_to_table_of_contents.rb +44 -39
- data/test/test_rdoc_markup_to_tt_only.rb +20 -0
- data/test/test_rdoc_markup_verbatim.rb +13 -0
- data/test/test_rdoc_method_attr.rb +5 -0
- data/test/test_rdoc_normal_class.rb +24 -5
- data/test/test_rdoc_normal_module.rb +1 -1
- data/test/test_rdoc_options.rb +21 -6
- data/test/test_rdoc_parser.rb +24 -0
- data/test/test_rdoc_parser_c.rb +151 -26
- data/test/test_rdoc_parser_markdown.rb +55 -0
- data/test/test_rdoc_parser_rd.rb +2 -2
- data/test/test_rdoc_parser_ruby.rb +468 -109
- data/test/test_rdoc_parser_simple.rb +2 -2
- data/test/test_rdoc_rd_block_parser.rb +0 -4
- data/test/test_rdoc_rdoc.rb +110 -22
- data/test/test_rdoc_ri_driver.rb +415 -80
- data/test/test_rdoc_ri_paths.rb +122 -13
- data/test/test_rdoc_ruby_lex.rb +5 -61
- data/test/test_rdoc_ruby_token.rb +19 -0
- data/test/test_rdoc_rubygems_hook.rb +64 -43
- data/test/test_rdoc_servlet.rb +429 -0
- data/test/test_rdoc_stats.rb +83 -24
- data/test/{test_rdoc_ri_store.rb → test_rdoc_store.rb} +395 -22
- data/test/test_rdoc_task.rb +2 -2
- data/test/test_rdoc_text.rb +37 -11
- data/test/test_rdoc_tom_doc.rb +59 -62
- data/test/test_rdoc_top_level.rb +71 -113
- data/test/xref_test_case.rb +7 -9
- metadata +122 -39
- metadata.gz.sig +0 -0
- data/CVE-2013-0256.rdoc +0 -49
- 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: +#{
|
14
|
+
"Attr: +#{turn_on}/-#{turn_off}"
|
15
15
|
end
|
16
16
|
|
17
17
|
def inspect # :nodoc:
|
18
|
-
|
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 |=
|
105
|
+
current |= @attributes.bitmap_for(name)
|
100
106
|
end
|
101
107
|
|
102
108
|
new_set.each do |name|
|
103
|
-
new |=
|
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
|
170
|
+
def convert_specials str, attrs
|
165
171
|
unless @special.empty?
|
166
|
-
@special.each do |regexp,
|
172
|
+
@special.each do |regexp, attribute|
|
167
173
|
str.scan(regexp) do
|
168
|
-
|
169
|
-
|
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 =
|
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] =
|
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
|
233
|
-
@special[pattern
|
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
|
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 &
|
315
|
+
if (current_attr & @attributes.special) != 0 then
|
307
316
|
i += 1 while
|
308
|
-
i < str_len and (@attrs[i] &
|
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
|
+
|
data/lib/rdoc/markup/document.rb
CHANGED
@@ -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.
|
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.
|
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.
|
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.
|
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 =
|
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 =
|
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
|
-
|
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
|
-
|
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 <
|
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
|
-
@
|
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
|
-
|
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 =
|
377
|
-
|
378
|
-
|
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
|
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 =
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
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
|
|