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
data/lib/rdoc/context/section.rb
CHANGED
@@ -11,11 +11,18 @@ class RDoc::Context::Section
|
|
11
11
|
|
12
12
|
include RDoc::Text
|
13
13
|
|
14
|
+
MARSHAL_VERSION = 0 # :nodoc:
|
15
|
+
|
14
16
|
##
|
15
17
|
# Section comment
|
16
18
|
|
17
19
|
attr_reader :comment
|
18
20
|
|
21
|
+
##
|
22
|
+
# Section comments
|
23
|
+
|
24
|
+
attr_reader :comments
|
25
|
+
|
19
26
|
##
|
20
27
|
# Context this Section lives in
|
21
28
|
|
@@ -38,8 +45,9 @@ class RDoc::Context::Section
|
|
38
45
|
@@sequence.succ!
|
39
46
|
@sequence = @@sequence.dup
|
40
47
|
|
41
|
-
@
|
42
|
-
|
48
|
+
@comments = []
|
49
|
+
|
50
|
+
add_comment comment
|
43
51
|
end
|
44
52
|
|
45
53
|
##
|
@@ -50,30 +58,34 @@ class RDoc::Context::Section
|
|
50
58
|
end
|
51
59
|
|
52
60
|
##
|
53
|
-
#
|
54
|
-
|
55
|
-
def aref
|
56
|
-
title = @title || '[untitled]'
|
57
|
-
|
58
|
-
CGI.escape(title).gsub('%', '-').sub(/^-/, '')
|
59
|
-
end
|
60
|
-
|
61
|
-
##
|
62
|
-
# Appends +comment+ to the current comment separated by a rule.
|
61
|
+
# Adds +comment+ to this section
|
63
62
|
|
64
|
-
def
|
63
|
+
def add_comment comment
|
65
64
|
comment = extract_comment comment
|
66
65
|
|
67
66
|
return if comment.empty?
|
68
67
|
|
69
|
-
|
70
|
-
|
71
|
-
@
|
68
|
+
case comment
|
69
|
+
when RDoc::Comment then
|
70
|
+
@comments << comment
|
71
|
+
when RDoc::Markup::Document then
|
72
|
+
@comments.concat comment.parts
|
73
|
+
when Array then
|
74
|
+
@comments.concat comment
|
72
75
|
else
|
73
|
-
|
76
|
+
raise TypeError, "unknown comment type: #{comment.inspect}"
|
74
77
|
end
|
75
78
|
end
|
76
79
|
|
80
|
+
##
|
81
|
+
# Anchor reference for linking to this section
|
82
|
+
|
83
|
+
def aref
|
84
|
+
title = @title || '[untitled]'
|
85
|
+
|
86
|
+
CGI.escape(title).gsub('%', '-').sub(/^-/, '')
|
87
|
+
end
|
88
|
+
|
77
89
|
##
|
78
90
|
# Extracts the comment for this section from the original comment block.
|
79
91
|
# If the first line contains :section:, strip it and use the rest.
|
@@ -84,24 +96,106 @@ class RDoc::Context::Section
|
|
84
96
|
# # The body
|
85
97
|
|
86
98
|
def extract_comment comment
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
99
|
+
case comment
|
100
|
+
when Array then
|
101
|
+
comment.map do |c|
|
102
|
+
extract_comment c
|
103
|
+
end
|
104
|
+
when nil
|
105
|
+
RDoc::Comment.new ''
|
106
|
+
when RDoc::Comment then
|
107
|
+
if comment.text =~ /^#[ \t]*:section:.*\n/ then
|
108
|
+
start = $`
|
109
|
+
rest = $'
|
110
|
+
|
111
|
+
comment.text = if start.empty? then
|
112
|
+
rest
|
113
|
+
else
|
114
|
+
rest.sub(/#{start.chomp}\Z/, '')
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
comment
|
119
|
+
when RDoc::Markup::Document then
|
120
|
+
comment
|
121
|
+
else
|
122
|
+
raise TypeError, "unknown comment #{comment.inspect}"
|
96
123
|
end
|
97
|
-
|
98
|
-
comment
|
99
124
|
end
|
100
125
|
|
101
126
|
def inspect # :nodoc:
|
102
127
|
"#<%s:0x%x %p>" % [self.class, object_id, title]
|
103
128
|
end
|
104
129
|
|
130
|
+
##
|
131
|
+
# The files comments in this section come from
|
132
|
+
|
133
|
+
def in_files
|
134
|
+
return [] if @comments.empty?
|
135
|
+
|
136
|
+
case @comments
|
137
|
+
when Array then
|
138
|
+
@comments.map do |comment|
|
139
|
+
comment.file
|
140
|
+
end
|
141
|
+
when RDoc::Markup::Document then
|
142
|
+
@comment.parts.map do |document|
|
143
|
+
document.file
|
144
|
+
end
|
145
|
+
else
|
146
|
+
raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# Serializes this Section. The title and parsed comment are saved, but not
|
152
|
+
# the section parent which must be restored manually.
|
153
|
+
|
154
|
+
def marshal_dump
|
155
|
+
[
|
156
|
+
MARSHAL_VERSION,
|
157
|
+
@title,
|
158
|
+
parse,
|
159
|
+
]
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# De-serializes this Section. The section parent must be restored manually.
|
164
|
+
|
165
|
+
def marshal_load array
|
166
|
+
@parent = nil
|
167
|
+
|
168
|
+
@title = array[1]
|
169
|
+
@comments = array[2]
|
170
|
+
end
|
171
|
+
|
172
|
+
##
|
173
|
+
# Parses +comment_location+ into an RDoc::Markup::Document composed of
|
174
|
+
# multiple RDoc::Markup::Documents with their file set.
|
175
|
+
|
176
|
+
def parse
|
177
|
+
case @comments
|
178
|
+
when String then
|
179
|
+
super
|
180
|
+
when Array then
|
181
|
+
docs = @comments.map do |comment, location|
|
182
|
+
doc = super comment
|
183
|
+
doc.file = location if location
|
184
|
+
doc
|
185
|
+
end
|
186
|
+
|
187
|
+
RDoc::Markup::Document.new(*docs)
|
188
|
+
when RDoc::Comment then
|
189
|
+
doc = super @comments.text, comments.format
|
190
|
+
doc.file = @comments.location
|
191
|
+
doc
|
192
|
+
when RDoc::Markup::Document then
|
193
|
+
return @comments
|
194
|
+
else
|
195
|
+
raise ArgumentError, "unknown comment class #{comments.class}"
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
105
199
|
##
|
106
200
|
# The section's title, or 'Top Section' if the title is nil.
|
107
201
|
#
|
@@ -111,6 +205,27 @@ class RDoc::Context::Section
|
|
111
205
|
@title || 'Top Section'
|
112
206
|
end
|
113
207
|
|
208
|
+
##
|
209
|
+
# Removes a comment from this section if it is from the same file as
|
210
|
+
# +comment+
|
211
|
+
|
212
|
+
def remove_comment comment
|
213
|
+
return if @comments.empty?
|
214
|
+
|
215
|
+
case @comments
|
216
|
+
when Array then
|
217
|
+
@comments.delete_if do |my_comment|
|
218
|
+
my_comment.file == comment.file
|
219
|
+
end
|
220
|
+
when RDoc::Markup::Document then
|
221
|
+
@comments.parts.delete_if do |document|
|
222
|
+
document.file == comment.file.name
|
223
|
+
end
|
224
|
+
else
|
225
|
+
raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
114
229
|
##
|
115
230
|
# Section sequence number (deprecated)
|
116
231
|
|
data/lib/rdoc/cross_reference.rb
CHANGED
@@ -27,69 +27,76 @@ class RDoc::CrossReference
|
|
27
27
|
# have been suppressed, since the suppression characters are removed by the
|
28
28
|
# code that is triggered.
|
29
29
|
|
30
|
-
CROSSREF_REGEXP = /(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
30
|
+
CROSSREF_REGEXP = /(?:^|\s)
|
31
|
+
(
|
32
|
+
(?:
|
33
|
+
# A::B::C.meth
|
34
|
+
#{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
|
35
|
+
|
36
|
+
# Stand-alone method (preceded by a #)
|
37
|
+
| \\?\##{METHOD_REGEXP_STR}
|
38
|
+
|
39
|
+
# Stand-alone method (preceded by ::)
|
40
|
+
| ::#{METHOD_REGEXP_STR}
|
41
|
+
|
42
|
+
# A::B::C
|
43
|
+
# The stuff after CLASS_REGEXP_STR is a
|
44
|
+
# nasty hack. CLASS_REGEXP_STR unfortunately matches
|
45
|
+
# words like dog and cat (these are legal "class"
|
46
|
+
# names in Fortran 95). When a word is flagged as a
|
47
|
+
# potential cross-reference, limitations in the markup
|
48
|
+
# engine suppress other processing, such as typesetting.
|
49
|
+
# This is particularly noticeable for contractions.
|
50
|
+
# In order that words like "can't" not
|
51
|
+
# be flagged as potential cross-references, only
|
52
|
+
# flag potential class cross-references if the character
|
53
|
+
# after the cross-reference is a space, sentence
|
54
|
+
# punctuation, tag start character, or attribute
|
55
|
+
# marker.
|
56
|
+
| #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
|
57
|
+
|
58
|
+
# Things that look like filenames
|
59
|
+
# The key thing is that there must be at least
|
60
|
+
# one special character (period, slash, or
|
61
|
+
# underscore).
|
62
|
+
| (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
|
63
|
+
|
64
|
+
# Things that have markup suppressed
|
65
|
+
# Don't process things like '\<' in \<tt>, though.
|
66
|
+
# TODO: including < is a hack, not very satisfying.
|
67
|
+
| \\[^\s<]
|
66
68
|
)
|
67
69
|
|
68
70
|
# labels for headings
|
69
|
-
(?:@[\w+%-]+)
|
71
|
+
(?:@[\w+%-]+(?:\.[\w|%-]+)?)?
|
72
|
+
)/x
|
70
73
|
|
71
74
|
##
|
72
75
|
# Version of CROSSREF_REGEXP used when <tt>--hyperlink-all</tt> is specified.
|
73
76
|
|
74
|
-
ALL_CROSSREF_REGEXP = /
|
75
|
-
|
76
|
-
|
77
|
+
ALL_CROSSREF_REGEXP = /
|
78
|
+
(?:^|\s)
|
79
|
+
(
|
80
|
+
(?:
|
81
|
+
# A::B::C.meth
|
82
|
+
#{CLASS_REGEXP_STR}(?:[.#]|::)#{METHOD_REGEXP_STR}
|
77
83
|
|
78
|
-
|
79
|
-
|
84
|
+
# Stand-alone method
|
85
|
+
| \\?#{METHOD_REGEXP_STR}
|
80
86
|
|
81
|
-
|
82
|
-
|
87
|
+
# A::B::C
|
88
|
+
| #{CLASS_REGEXP_STR}(?=[@\s).?!,;<\000]|\z)
|
83
89
|
|
84
|
-
|
85
|
-
|
90
|
+
# Things that look like filenames
|
91
|
+
| (?:\.\.\/)*[-\/\w]+[_\/.][-\w\/.]+
|
86
92
|
|
87
|
-
|
88
|
-
|
93
|
+
# Things that have markup suppressed
|
94
|
+
| \\[^\s<]
|
89
95
|
)
|
90
96
|
|
91
97
|
# labels for headings
|
92
|
-
(?:@[\w+%-]+)
|
98
|
+
(?:@[\w+%-]+)?
|
99
|
+
)/x
|
93
100
|
|
94
101
|
##
|
95
102
|
# Hash of references that have been looked-up to their replacements
|
@@ -102,6 +109,7 @@ class RDoc::CrossReference
|
|
102
109
|
|
103
110
|
def initialize context
|
104
111
|
@context = context
|
112
|
+
@store = context.store
|
105
113
|
|
106
114
|
@seen = {}
|
107
115
|
end
|
@@ -146,7 +154,7 @@ class RDoc::CrossReference
|
|
146
154
|
end unless ref
|
147
155
|
|
148
156
|
# Try a page name
|
149
|
-
ref =
|
157
|
+
ref = @store.page name if not ref and name =~ /^\w+$/
|
150
158
|
|
151
159
|
ref = nil if RDoc::Alias === ref # external alias, can't link to it
|
152
160
|
|
data/lib/rdoc/encoding.rb
CHANGED
@@ -25,26 +25,40 @@ module RDoc::Encoding
|
|
25
25
|
RDoc::Encoding.set_encoding content
|
26
26
|
|
27
27
|
if Object.const_defined? :Encoding then
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
begin
|
29
|
+
encoding ||= Encoding.default_external
|
30
|
+
orig_encoding = content.encoding
|
31
|
+
|
32
|
+
if utf8 then
|
33
|
+
content.force_encoding Encoding::UTF_8
|
34
|
+
content.encode! encoding
|
35
|
+
else
|
36
|
+
# assume the content is in our output encoding
|
37
|
+
content.force_encoding encoding
|
38
|
+
end
|
39
|
+
|
40
|
+
unless content.valid_encoding? then
|
41
|
+
# revert and try to transcode
|
42
|
+
content.force_encoding orig_encoding
|
43
|
+
content.encode! encoding
|
44
|
+
end
|
45
|
+
|
46
|
+
unless content.valid_encoding? then
|
47
|
+
warn "unable to convert #{filename} to #{encoding}, skipping"
|
48
|
+
content = nil
|
49
|
+
end
|
50
|
+
rescue Encoding::InvalidByteSequenceError,
|
51
|
+
Encoding::UndefinedConversionError => e
|
52
|
+
if force_transcode then
|
53
|
+
content.force_encoding orig_encoding
|
54
|
+
content.encode!(encoding,
|
55
|
+
:invalid => :replace, :undef => :replace,
|
56
|
+
:replace => '?')
|
57
|
+
return content
|
58
|
+
else
|
59
|
+
warn "unable to convert #{e.message} for #{filename}, skipping"
|
60
|
+
return nil
|
61
|
+
end
|
48
62
|
end
|
49
63
|
end
|
50
64
|
|
@@ -53,15 +67,6 @@ module RDoc::Encoding
|
|
53
67
|
raise unless e.message =~ /unknown encoding name - (.*)/
|
54
68
|
warn "unknown encoding name \"#{$1}\" for #{filename}, skipping"
|
55
69
|
nil
|
56
|
-
rescue Encoding::UndefinedConversionError => e
|
57
|
-
if force_transcode then
|
58
|
-
content.force_encoding orig_encoding
|
59
|
-
content.encode! encoding, :undef => :replace, :replace => '?'
|
60
|
-
content
|
61
|
-
else
|
62
|
-
warn "unable to convert #{e.message} for #{filename}, skipping"
|
63
|
-
nil
|
64
|
-
end
|
65
70
|
rescue Errno::EISDIR, Errno::ENOENT
|
66
71
|
nil
|
67
72
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
##
|
2
|
+
# Allows an ERB template to be rendered in the context (binding) of an
|
3
|
+
# existing ERB template evaluation.
|
4
|
+
|
5
|
+
class RDoc::ERBPartial < ERB
|
6
|
+
|
7
|
+
##
|
8
|
+
# Overrides +compiler+ startup to set the +eoutvar+ to an empty string only
|
9
|
+
# if it isn't already set.
|
10
|
+
|
11
|
+
def set_eoutvar compiler, eoutvar = '_erbout'
|
12
|
+
super
|
13
|
+
|
14
|
+
compiler.pre_cmd = ["#{eoutvar} ||= ''"]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|