rdoc 6.14.2 → 6.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.rdoc +1 -1
- data/README.md +112 -0
- data/RI.md +1 -1
- data/lib/rdoc/code_object/top_level.rb +18 -25
- data/lib/rdoc/comment.rb +190 -8
- data/lib/rdoc/cross_reference.rb +1 -1
- data/lib/rdoc/generator/aliki.rb +42 -0
- data/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
- data/lib/rdoc/generator/template/aliki/_head.rhtml +158 -0
- data/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +6 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +5 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +21 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +37 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +11 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/aliki/class.rhtml +219 -0
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +1612 -0
- data/lib/rdoc/generator/template/aliki/index.rhtml +21 -0
- data/lib/rdoc/generator/template/aliki/js/aliki.js +483 -0
- data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
- data/lib/rdoc/generator/template/aliki/js/search.js +120 -0
- data/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
- data/lib/rdoc/generator/template/aliki/page.rhtml +17 -0
- data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
- data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +14 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +8 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +8 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +19 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +3 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +14 -14
- data/lib/rdoc/generator/template/darkfish/class.rhtml +62 -60
- data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -3
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +21 -1
- data/lib/rdoc/generator/template/darkfish/js/search.js +11 -1
- data/lib/rdoc/generator/template/darkfish/page.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +2 -1
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +19 -19
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +19 -17
- data/lib/rdoc/generator/template/json_index/js/searcher.js +48 -6
- data/lib/rdoc/generator.rb +1 -0
- data/lib/rdoc/markdown.kpeg +28 -17
- data/lib/rdoc/markdown.rb +365 -544
- data/lib/rdoc/markup/pre_process.rb +34 -10
- data/lib/rdoc/markup/to_html.rb +162 -14
- data/lib/rdoc/markup/to_html_crossref.rb +53 -23
- data/lib/rdoc/options.rb +22 -11
- data/lib/rdoc/parser/c.rb +15 -46
- data/lib/rdoc/parser/prism_ruby.rb +121 -113
- data/lib/rdoc/parser/ruby.rb +8 -8
- data/lib/rdoc/parser/ruby_tools.rb +5 -7
- data/lib/rdoc/parser/simple.rb +4 -21
- data/lib/rdoc/rdoc.rb +1 -0
- data/lib/rdoc/ri/task.rb +2 -2
- data/lib/rdoc/store.rb +2 -2
- data/lib/rdoc/task.rb +4 -4
- data/lib/rdoc/text.rb +1 -1
- data/lib/rdoc/token_stream.rb +13 -1
- data/lib/rdoc/tom_doc.rb +1 -1
- data/lib/rdoc/version.rb +1 -1
- data/rdoc.gemspec +3 -2
- metadata +44 -5
- data/README.rdoc +0 -144
|
@@ -97,18 +97,15 @@ class RDoc::Markup::PreProcess
|
|
|
97
97
|
# RDoc::CodeObject#metadata for details.
|
|
98
98
|
|
|
99
99
|
def handle(text, code_object = nil, &block)
|
|
100
|
-
first_line = 1
|
|
101
100
|
if RDoc::Comment === text then
|
|
102
101
|
comment = text
|
|
103
102
|
text = text.text
|
|
104
|
-
first_line = comment.line || 1
|
|
105
103
|
end
|
|
106
104
|
|
|
107
105
|
# regexp helper (square brackets for optional)
|
|
108
106
|
# $1 $2 $3 $4 $5
|
|
109
107
|
# [prefix][\]:directive:[spaces][param]newline
|
|
110
|
-
text = text.
|
|
111
|
-
next line unless line =~ /\A([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):([\w-]+):([ \t]*)(.+)?(\r?\n|$)/
|
|
108
|
+
text = text.gsub(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):([\w-]+):([ \t]*)(.+)?(\r?\n|$)/) do
|
|
112
109
|
# skip something like ':toto::'
|
|
113
110
|
next $& if $4.empty? and $5 and $5[0, 1] == ':'
|
|
114
111
|
|
|
@@ -122,9 +119,8 @@ class RDoc::Markup::PreProcess
|
|
|
122
119
|
comment.format = $5.downcase
|
|
123
120
|
next "#{$1.strip}\n"
|
|
124
121
|
end
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
end.join
|
|
122
|
+
handle_directive $1, $3, $5, code_object, text.encoding, &block
|
|
123
|
+
end
|
|
128
124
|
|
|
129
125
|
if comment then
|
|
130
126
|
comment.text = text
|
|
@@ -132,11 +128,39 @@ class RDoc::Markup::PreProcess
|
|
|
132
128
|
comment = text
|
|
133
129
|
end
|
|
134
130
|
|
|
131
|
+
run_post_processes(comment, code_object)
|
|
132
|
+
|
|
133
|
+
text
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Apply directives to a code object
|
|
137
|
+
|
|
138
|
+
def run_pre_processes(comment_text, code_object, start_line_no, type)
|
|
139
|
+
comment_text, directives = parse_comment(comment_text, start_line_no, type)
|
|
140
|
+
directives.each do |directive, (param, line_no)|
|
|
141
|
+
handle_directive('', directive, param, code_object)
|
|
142
|
+
end
|
|
143
|
+
if code_object.is_a?(RDoc::AnyMethod) && (call_seq, = directives['call-seq']) && call_seq
|
|
144
|
+
code_object.call_seq = call_seq.lines.map(&:chomp).reject(&:empty?).join("\n")
|
|
145
|
+
end
|
|
146
|
+
format, = directives['markup']
|
|
147
|
+
[comment_text, format]
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Perform post preocesses to a code object
|
|
151
|
+
|
|
152
|
+
def run_post_processes(comment, code_object)
|
|
135
153
|
self.class.post_processors.each do |handler|
|
|
136
154
|
handler.call comment, code_object
|
|
137
155
|
end
|
|
156
|
+
end
|
|
138
157
|
|
|
139
|
-
|
|
158
|
+
# Parse comment and return [normalized_comment_text, directives_hash]
|
|
159
|
+
|
|
160
|
+
def parse_comment(text, line_no, type)
|
|
161
|
+
RDoc::Comment.parse(text, @input_file_name, line_no, type) do |filename, prefix_indent|
|
|
162
|
+
include_file(filename, prefix_indent, text.encoding)
|
|
163
|
+
end
|
|
140
164
|
end
|
|
141
165
|
|
|
142
166
|
##
|
|
@@ -151,7 +175,7 @@ class RDoc::Markup::PreProcess
|
|
|
151
175
|
# When 1.8.7 support is ditched prefix can be defaulted to ''
|
|
152
176
|
|
|
153
177
|
def handle_directive(prefix, directive, param, code_object = nil,
|
|
154
|
-
encoding = nil
|
|
178
|
+
encoding = nil)
|
|
155
179
|
blankline = "#{prefix.strip}\n"
|
|
156
180
|
directive = directive.downcase
|
|
157
181
|
|
|
@@ -244,7 +268,7 @@ class RDoc::Markup::PreProcess
|
|
|
244
268
|
|
|
245
269
|
blankline
|
|
246
270
|
else
|
|
247
|
-
result = yield directive, param
|
|
271
|
+
result = yield directive, param if block_given?
|
|
248
272
|
|
|
249
273
|
case result
|
|
250
274
|
when nil then
|
data/lib/rdoc/markup/to_html.rb
CHANGED
|
@@ -158,19 +158,16 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
|
158
158
|
def handle_regexp_TIDYLINK(target)
|
|
159
159
|
text = target.text
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
label = $1
|
|
165
|
-
url = CGI.escapeHTML($2)
|
|
161
|
+
if tidy_link_capturing?
|
|
162
|
+
return finish_tidy_link(text)
|
|
163
|
+
end
|
|
166
164
|
|
|
167
|
-
if
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
label = CGI.escapeHTML(label)
|
|
165
|
+
if text.start_with?('{') && !text.include?('}')
|
|
166
|
+
start_tidy_link text
|
|
167
|
+
return ''
|
|
171
168
|
end
|
|
172
169
|
|
|
173
|
-
|
|
170
|
+
convert_complete_tidy_link(text)
|
|
174
171
|
end
|
|
175
172
|
|
|
176
173
|
# :section: Visitor
|
|
@@ -315,11 +312,13 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
|
315
312
|
else
|
|
316
313
|
"\n<h#{level}>"
|
|
317
314
|
end
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
@res <<
|
|
321
|
-
|
|
315
|
+
|
|
316
|
+
if @options.pipe
|
|
317
|
+
@res << to_html(heading.text)
|
|
318
|
+
else
|
|
319
|
+
@res << "<a href=\"##{label}\">#{to_html(heading.text)}</a>"
|
|
322
320
|
end
|
|
321
|
+
|
|
323
322
|
@res << "</h#{level}>\n"
|
|
324
323
|
end
|
|
325
324
|
|
|
@@ -458,4 +457,153 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
|
|
|
458
457
|
super convert_flow @am.flow item
|
|
459
458
|
end
|
|
460
459
|
|
|
460
|
+
private
|
|
461
|
+
|
|
462
|
+
def convert_flow(flow_items)
|
|
463
|
+
res = []
|
|
464
|
+
|
|
465
|
+
flow_items.each do |item|
|
|
466
|
+
case item
|
|
467
|
+
when String
|
|
468
|
+
append_flow_fragment res, convert_string(item)
|
|
469
|
+
when RDoc::Markup::AttrChanger
|
|
470
|
+
off_tags res, item
|
|
471
|
+
on_tags res, item
|
|
472
|
+
when RDoc::Markup::RegexpHandling
|
|
473
|
+
append_flow_fragment res, convert_regexp_handling(item)
|
|
474
|
+
else
|
|
475
|
+
raise "Unknown flow element: #{item.inspect}"
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
res.join
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
def append_flow_fragment(res, fragment)
|
|
483
|
+
return if fragment.nil? || fragment.empty?
|
|
484
|
+
|
|
485
|
+
emit_tidy_link_fragment(res, fragment)
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
def append_to_tidy_label(fragment)
|
|
489
|
+
@tidy_link_buffer << fragment
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
##
|
|
493
|
+
# Matches an entire tidy link with a braced label "{label}[url]".
|
|
494
|
+
#
|
|
495
|
+
# Capture 1: label contents.
|
|
496
|
+
# Capture 2: URL text.
|
|
497
|
+
# Capture 3: trailing content.
|
|
498
|
+
TIDY_LINK_WITH_BRACES = /\A\{(.*?)\}\[(.*?)\](.*)\z/
|
|
499
|
+
|
|
500
|
+
##
|
|
501
|
+
# Matches the tail of a braced tidy link when the opening brace was
|
|
502
|
+
# consumed earlier while accumulating the label text.
|
|
503
|
+
#
|
|
504
|
+
# Capture 1: remaining label content.
|
|
505
|
+
# Capture 2: URL text.
|
|
506
|
+
# Capture 3: trailing content.
|
|
507
|
+
TIDY_LINK_WITH_BRACES_TAIL = /\A(.*?)\}\[(.*?)\](.*)\z/
|
|
508
|
+
|
|
509
|
+
##
|
|
510
|
+
# Matches a tidy link with a single-word label "label[url]".
|
|
511
|
+
#
|
|
512
|
+
# Capture 1: the single-word label (no whitespace).
|
|
513
|
+
# Capture 2: URL text between the brackets.
|
|
514
|
+
TIDY_LINK_SINGLE_WORD = /\A(\S+)\[(.*?)\](.*)\z/
|
|
515
|
+
|
|
516
|
+
def convert_complete_tidy_link(text)
|
|
517
|
+
return text unless
|
|
518
|
+
text =~ TIDY_LINK_WITH_BRACES or text =~ TIDY_LINK_SINGLE_WORD
|
|
519
|
+
|
|
520
|
+
label = $1
|
|
521
|
+
url = CGI.escapeHTML($2)
|
|
522
|
+
|
|
523
|
+
label_html = if /^rdoc-image:/ =~ label
|
|
524
|
+
handle_RDOCLINK(label)
|
|
525
|
+
else
|
|
526
|
+
render_tidy_link_label(label)
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
gen_url url, label_html
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
def emit_tidy_link_fragment(res, fragment)
|
|
533
|
+
if tidy_link_capturing?
|
|
534
|
+
append_to_tidy_label fragment
|
|
535
|
+
else
|
|
536
|
+
res << fragment
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
def finish_tidy_link(text)
|
|
541
|
+
label_tail, url, trailing = extract_tidy_link_parts(text)
|
|
542
|
+
append_to_tidy_label CGI.escapeHTML(label_tail) unless label_tail.empty?
|
|
543
|
+
|
|
544
|
+
return '' unless url
|
|
545
|
+
|
|
546
|
+
label_html = @tidy_link_buffer
|
|
547
|
+
@tidy_link_buffer = nil
|
|
548
|
+
link = gen_url(url, label_html)
|
|
549
|
+
|
|
550
|
+
return link if trailing.empty?
|
|
551
|
+
|
|
552
|
+
link + CGI.escapeHTML(trailing)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
def extract_tidy_link_parts(text)
|
|
556
|
+
if text =~ TIDY_LINK_WITH_BRACES
|
|
557
|
+
[$1, CGI.escapeHTML($2), $3]
|
|
558
|
+
elsif text =~ TIDY_LINK_WITH_BRACES_TAIL
|
|
559
|
+
[$1, CGI.escapeHTML($2), $3]
|
|
560
|
+
elsif text =~ TIDY_LINK_SINGLE_WORD
|
|
561
|
+
[$1, CGI.escapeHTML($2), $3]
|
|
562
|
+
else
|
|
563
|
+
[text, nil, '']
|
|
564
|
+
end
|
|
565
|
+
end
|
|
566
|
+
|
|
567
|
+
def on_tags(res, item)
|
|
568
|
+
each_attr_tag(item.turn_on) do |tag|
|
|
569
|
+
emit_tidy_link_fragment(res, annotate(tag.on))
|
|
570
|
+
@in_tt += 1 if tt? tag
|
|
571
|
+
end
|
|
572
|
+
end
|
|
573
|
+
|
|
574
|
+
def off_tags(res, item)
|
|
575
|
+
each_attr_tag(item.turn_off, true) do |tag|
|
|
576
|
+
emit_tidy_link_fragment(res, annotate(tag.off))
|
|
577
|
+
@in_tt -= 1 if tt? tag
|
|
578
|
+
end
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
def start_tidy_link(text)
|
|
582
|
+
@tidy_link_buffer = String.new
|
|
583
|
+
append_to_tidy_label CGI.escapeHTML(text.delete_prefix('{'))
|
|
584
|
+
end
|
|
585
|
+
|
|
586
|
+
def tidy_link_capturing?
|
|
587
|
+
!!@tidy_link_buffer
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
def render_tidy_link_label(label)
|
|
591
|
+
RDoc::Markup::LinkLabelToHtml.render(label, @options, @from_path)
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
|
|
595
|
+
##
|
|
596
|
+
# Formatter dedicated to rendering tidy link labels without mutating the
|
|
597
|
+
# calling formatter's state.
|
|
598
|
+
|
|
599
|
+
class RDoc::Markup::LinkLabelToHtml < RDoc::Markup::ToHtml
|
|
600
|
+
def self.render(label, options, from_path)
|
|
601
|
+
new(options, from_path).to_html(label)
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
def initialize(options, from_path = nil)
|
|
605
|
+
super(options)
|
|
606
|
+
|
|
607
|
+
self.from_path = from_path if from_path
|
|
608
|
+
end
|
|
461
609
|
end
|
|
@@ -184,38 +184,35 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
|
184
184
|
end
|
|
185
185
|
end
|
|
186
186
|
|
|
187
|
-
def convert_flow(
|
|
187
|
+
def convert_flow(flow_items, &block)
|
|
188
188
|
res = []
|
|
189
189
|
|
|
190
190
|
i = 0
|
|
191
|
-
while i <
|
|
192
|
-
item =
|
|
193
|
-
|
|
191
|
+
while i < flow_items.size
|
|
192
|
+
item = flow_items[i]
|
|
193
|
+
|
|
194
194
|
case item
|
|
195
|
-
when RDoc::Markup::AttrChanger
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
tt_tag?(flow[i+1].turn_off, true) and
|
|
201
|
-
(@options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP).match?(str) and
|
|
202
|
-
(text = cross_reference str) != str
|
|
203
|
-
then
|
|
204
|
-
text = yield text, res if defined?(yield)
|
|
205
|
-
res << text
|
|
206
|
-
i += 2
|
|
195
|
+
when RDoc::Markup::AttrChanger
|
|
196
|
+
if !tidy_link_capturing? && (text = convert_tt_crossref(flow_items, i))
|
|
197
|
+
text = block.call(text, res) if block
|
|
198
|
+
append_flow_fragment res, text
|
|
199
|
+
i += 3
|
|
207
200
|
next
|
|
208
201
|
end
|
|
202
|
+
|
|
209
203
|
off_tags res, item
|
|
210
|
-
on_tags
|
|
211
|
-
|
|
204
|
+
on_tags res, item
|
|
205
|
+
i += 1
|
|
206
|
+
when String
|
|
212
207
|
text = convert_string(item)
|
|
213
|
-
text =
|
|
214
|
-
res
|
|
215
|
-
|
|
208
|
+
text = block.call(text, res) if block
|
|
209
|
+
append_flow_fragment res, text
|
|
210
|
+
i += 1
|
|
211
|
+
when RDoc::Markup::RegexpHandling
|
|
216
212
|
text = convert_regexp_handling(item)
|
|
217
|
-
text =
|
|
218
|
-
res
|
|
213
|
+
text = block.call(text, res) if block
|
|
214
|
+
append_flow_fragment res, text
|
|
215
|
+
i += 1
|
|
219
216
|
else
|
|
220
217
|
raise "Unknown flow element: #{item.inspect}"
|
|
221
218
|
end
|
|
@@ -223,4 +220,37 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
|
|
|
223
220
|
|
|
224
221
|
res.join('')
|
|
225
222
|
end
|
|
223
|
+
|
|
224
|
+
private
|
|
225
|
+
|
|
226
|
+
##
|
|
227
|
+
# Detects <tt>...</tt> spans that contain a single cross-reference candidate.
|
|
228
|
+
# When the candidate occupies the whole span (aside from trailing
|
|
229
|
+
# punctuation), the tt markup is replaced by the resolved cross-reference.
|
|
230
|
+
|
|
231
|
+
def convert_tt_crossref(flow_items, index)
|
|
232
|
+
opener = flow_items[index]
|
|
233
|
+
return unless tt_tag?(opener.turn_on)
|
|
234
|
+
|
|
235
|
+
string = flow_items[index + 1]
|
|
236
|
+
closer = flow_items[index + 2]
|
|
237
|
+
|
|
238
|
+
return unless String === string
|
|
239
|
+
return unless RDoc::Markup::AttrChanger === closer
|
|
240
|
+
return unless tt_tag?(closer.turn_off, true)
|
|
241
|
+
|
|
242
|
+
crossref_regexp = @options.hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP
|
|
243
|
+
match = crossref_regexp.match(string)
|
|
244
|
+
return unless match
|
|
245
|
+
return unless match.begin(1).zero?
|
|
246
|
+
|
|
247
|
+
trailing = match.post_match
|
|
248
|
+
# Only convert when the remainder is punctuation/whitespace so other tt text stays literal.
|
|
249
|
+
return unless trailing.match?(/\A[[:punct:]\s]*\z/)
|
|
250
|
+
|
|
251
|
+
text = cross_reference(string)
|
|
252
|
+
return if text == string
|
|
253
|
+
|
|
254
|
+
text
|
|
255
|
+
end
|
|
226
256
|
end
|
data/lib/rdoc/options.rb
CHANGED
|
@@ -327,7 +327,7 @@ class RDoc::Options
|
|
|
327
327
|
|
|
328
328
|
##
|
|
329
329
|
# Warn if rdoc-ref links can't be resolved
|
|
330
|
-
# Default is +
|
|
330
|
+
# Default is +true+
|
|
331
331
|
|
|
332
332
|
attr_accessor :warn_missing_rdoc_ref
|
|
333
333
|
|
|
@@ -378,6 +378,21 @@ class RDoc::Options
|
|
|
378
378
|
|
|
379
379
|
attr_accessor :canonical_root
|
|
380
380
|
|
|
381
|
+
##
|
|
382
|
+
# Custom footer content configuration for themes that support it.
|
|
383
|
+
# Currently only supported by the Aliki theme.
|
|
384
|
+
#
|
|
385
|
+
# A hash where keys are column titles and values are hashes of link text => URL pairs.
|
|
386
|
+
# Each column will be displayed in the upper footer section.
|
|
387
|
+
#
|
|
388
|
+
# Example:
|
|
389
|
+
# {
|
|
390
|
+
# "DOCUMENTATION" => {"Home" => "/index.html", "Guide" => "/guide.html"},
|
|
391
|
+
# "RESOURCES" => {"RDoc" => "https://ruby.github.io/rdoc/", "GitHub" => "https://github.com/ruby/rdoc"}
|
|
392
|
+
# }
|
|
393
|
+
|
|
394
|
+
attr_accessor :footer_content
|
|
395
|
+
|
|
381
396
|
def initialize(loaded_options = nil) # :nodoc:
|
|
382
397
|
init_ivars
|
|
383
398
|
override loaded_options if loaded_options
|
|
@@ -396,10 +411,9 @@ class RDoc::Options
|
|
|
396
411
|
@files = nil
|
|
397
412
|
@force_output = false
|
|
398
413
|
@force_update = true
|
|
399
|
-
@
|
|
400
|
-
@generator_name = nil
|
|
401
|
-
@generator_options = []
|
|
414
|
+
@generator_name = "darkfish"
|
|
402
415
|
@generators = RDoc::RDoc::GENERATORS
|
|
416
|
+
@generator_options = []
|
|
403
417
|
@hyperlink_all = false
|
|
404
418
|
@line_numbers = false
|
|
405
419
|
@locale = nil
|
|
@@ -435,6 +449,7 @@ class RDoc::Options
|
|
|
435
449
|
@class_module_path_prefix = nil
|
|
436
450
|
@file_path_prefix = nil
|
|
437
451
|
@canonical_root = nil
|
|
452
|
+
@footer_content = nil
|
|
438
453
|
end
|
|
439
454
|
|
|
440
455
|
def init_with(map) # :nodoc:
|
|
@@ -463,6 +478,7 @@ class RDoc::Options
|
|
|
463
478
|
|
|
464
479
|
@apply_default_exclude = map['apply_default_exclude']
|
|
465
480
|
@autolink_excluded_words = map['autolink_excluded_words']
|
|
481
|
+
@footer_content = map['footer_content']
|
|
466
482
|
|
|
467
483
|
@rdoc_include = sanitize_path map['rdoc_include']
|
|
468
484
|
@static_path = sanitize_path map['static_path']
|
|
@@ -499,6 +515,7 @@ class RDoc::Options
|
|
|
499
515
|
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
|
500
516
|
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
|
501
517
|
@canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
|
|
518
|
+
@footer_content = map['footer_content'] if map.has_key?('footer_content')
|
|
502
519
|
|
|
503
520
|
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
|
504
521
|
|
|
@@ -1213,9 +1230,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1213
1230
|
opt.separator nil
|
|
1214
1231
|
end
|
|
1215
1232
|
|
|
1216
|
-
setup_generator 'darkfish' if
|
|
1217
|
-
argv.grep(/\A(-f|--fmt|--format|-r|-R|--ri|--ri-site)\b/).empty?
|
|
1218
|
-
|
|
1219
1233
|
deprecated = []
|
|
1220
1234
|
invalid = []
|
|
1221
1235
|
|
|
@@ -1233,10 +1247,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1233
1247
|
retry
|
|
1234
1248
|
end
|
|
1235
1249
|
|
|
1236
|
-
unless @generator
|
|
1237
|
-
@generator = RDoc::Generator::Darkfish
|
|
1238
|
-
@generator_name = 'darkfish'
|
|
1239
|
-
end
|
|
1250
|
+
setup_generator unless @generator
|
|
1240
1251
|
|
|
1241
1252
|
if @pipe and not argv.empty? then
|
|
1242
1253
|
@pipe = false
|
data/lib/rdoc/parser/c.rb
CHANGED
|
@@ -607,8 +607,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
607
607
|
body = args[1]
|
|
608
608
|
offset, = args[2]
|
|
609
609
|
|
|
610
|
-
comment.remove_private if comment
|
|
611
|
-
|
|
612
610
|
# try to find the whole body
|
|
613
611
|
body = $& if /#{Regexp.escape body}[^(]*?\{.*?^\}/m =~ file_content
|
|
614
612
|
|
|
@@ -621,11 +619,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
621
619
|
override_comment = find_override_comment class_name, meth_obj
|
|
622
620
|
comment = override_comment if override_comment
|
|
623
621
|
|
|
624
|
-
comment.normalize
|
|
625
622
|
find_modifiers comment, meth_obj if comment
|
|
626
623
|
|
|
627
624
|
#meth_obj.params = params
|
|
628
|
-
meth_obj.start_collecting_tokens
|
|
625
|
+
meth_obj.start_collecting_tokens(:c)
|
|
629
626
|
tk = { :line_no => 1, :char_no => 1, :text => body }
|
|
630
627
|
meth_obj.add_token tk
|
|
631
628
|
meth_obj.comment = comment
|
|
@@ -639,10 +636,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
639
636
|
|
|
640
637
|
find_body class_name, args[3], meth_obj, file_content, true
|
|
641
638
|
|
|
642
|
-
comment.normalize
|
|
643
639
|
find_modifiers comment, meth_obj
|
|
644
640
|
|
|
645
|
-
meth_obj.start_collecting_tokens
|
|
641
|
+
meth_obj.start_collecting_tokens(:c)
|
|
646
642
|
tk = { :line_no => 1, :char_no => 1, :text => body }
|
|
647
643
|
meth_obj.add_token tk
|
|
648
644
|
meth_obj.comment = comment
|
|
@@ -663,7 +659,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
663
659
|
comment = find_override_comment class_name, meth_obj
|
|
664
660
|
|
|
665
661
|
if comment then
|
|
666
|
-
comment.normalize
|
|
667
662
|
find_modifiers comment, meth_obj
|
|
668
663
|
meth_obj.comment = comment
|
|
669
664
|
|
|
@@ -742,7 +737,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
742
737
|
end
|
|
743
738
|
|
|
744
739
|
comment = new_comment comment, @top_level, :c
|
|
745
|
-
comment.normalize
|
|
746
740
|
|
|
747
741
|
look_for_directives_in class_mod, comment
|
|
748
742
|
|
|
@@ -807,9 +801,6 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
807
801
|
# Handles modifiers in +comment+ and updates +meth_obj+ as appropriate.
|
|
808
802
|
|
|
809
803
|
def find_modifiers(comment, meth_obj)
|
|
810
|
-
comment.normalize
|
|
811
|
-
meth_obj.call_seq = comment.extract_call_seq
|
|
812
|
-
|
|
813
804
|
look_for_directives_in meth_obj, comment
|
|
814
805
|
end
|
|
815
806
|
|
|
@@ -823,10 +814,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
823
814
|
comment = if @content =~ %r%Document-method:
|
|
824
815
|
\s+#{class_name}#{prefix}#{name}
|
|
825
816
|
\s*?\n((?>.*?\*/))%xm then
|
|
826
|
-
"
|
|
817
|
+
"/*\n#{$1}"
|
|
827
818
|
elsif @content =~ %r%Document-method:
|
|
828
819
|
\s#{name}\s*?\n((?>.*?\*/))%xm then
|
|
829
|
-
"
|
|
820
|
+
"/*\n#{$1}"
|
|
830
821
|
end
|
|
831
822
|
|
|
832
823
|
return unless comment
|
|
@@ -1061,10 +1052,13 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1061
1052
|
# Registers a singleton class +sclass_var+ as a singleton of +class_var+
|
|
1062
1053
|
|
|
1063
1054
|
def handle_singleton(sclass_var, class_var)
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
@
|
|
1055
|
+
if (klass = @classes[class_var])
|
|
1056
|
+
@classes[sclass_var] = klass
|
|
1057
|
+
end
|
|
1058
|
+
if (class_name = @known_classes[class_var])
|
|
1059
|
+
@known_classes[sclass_var] = class_name
|
|
1060
|
+
@singleton_classes[sclass_var] = class_name
|
|
1061
|
+
end
|
|
1068
1062
|
end
|
|
1069
1063
|
|
|
1070
1064
|
##
|
|
@@ -1102,35 +1096,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1102
1096
|
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
|
|
1103
1097
|
|
|
1104
1098
|
def look_for_directives_in(context, comment)
|
|
1105
|
-
@preprocess.
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
warn <<~MSG
|
|
1111
|
-
The :main: directive is deprecated and will be removed in RDoc 7.
|
|
1112
|
-
|
|
1113
|
-
You can use these options to specify the initial page displayed instead:
|
|
1114
|
-
- `--main=#{param}` via the command line
|
|
1115
|
-
- `rdoc.main = "#{param}"` if you use `RDoc::Task`
|
|
1116
|
-
- `main_page: #{param}` in your `.rdoc_options` file
|
|
1117
|
-
MSG
|
|
1118
|
-
''
|
|
1119
|
-
when 'title' then
|
|
1120
|
-
@options.default_title = param if @options.respond_to? :default_title=
|
|
1121
|
-
|
|
1122
|
-
warn <<~MSG
|
|
1123
|
-
The :title: directive is deprecated and will be removed in RDoc 7.
|
|
1124
|
-
|
|
1125
|
-
You can use these options to specify the title displayed instead:
|
|
1126
|
-
- `--title=#{param}` via the command line
|
|
1127
|
-
- `rdoc.title = "#{param}"` if you use `RDoc::Task`
|
|
1128
|
-
- `title: #{param}` in your `.rdoc_options` file
|
|
1129
|
-
MSG
|
|
1130
|
-
''
|
|
1131
|
-
end
|
|
1132
|
-
end
|
|
1133
|
-
|
|
1099
|
+
comment.text, format = @preprocess.run_pre_processes(comment.text, context, comment.line || 1, :c)
|
|
1100
|
+
comment.format = format if format
|
|
1101
|
+
@preprocess.run_post_processes(comment, context)
|
|
1102
|
+
comment.normalized = true
|
|
1134
1103
|
comment
|
|
1135
1104
|
end
|
|
1136
1105
|
|