rdoc 6.13.0 → 6.17.0
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/any_method.rb +4 -4
- data/lib/rdoc/code_object/attr.rb +3 -3
- data/lib/rdoc/code_object/class_module.rb +18 -16
- data/lib/rdoc/code_object/constant.rb +5 -5
- data/lib/rdoc/code_object/context/section.rb +8 -7
- data/lib/rdoc/code_object/context.rb +19 -19
- data/lib/rdoc/code_object/method_attr.rb +7 -6
- data/lib/rdoc/code_object/mixin.rb +3 -3
- data/lib/rdoc/code_object/normal_class.rb +1 -1
- data/lib/rdoc/code_object/normal_module.rb +1 -1
- data/lib/rdoc/code_object/single_class.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +28 -33
- data/lib/rdoc/code_object.rb +3 -3
- data/lib/rdoc/comment.rb +196 -14
- data/lib/rdoc/cross_reference.rb +4 -4
- data/lib/rdoc/encoding.rb +4 -4
- data/lib/rdoc/erb_partial.rb +1 -1
- data/lib/rdoc/erbio.rb +2 -2
- data/lib/rdoc/generator/aliki.rb +42 -0
- data/lib/rdoc/generator/darkfish.rb +20 -16
- data/lib/rdoc/generator/json_index.rb +3 -3
- data/lib/rdoc/generator/markup.rb +12 -0
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- data/lib/rdoc/generator/pot/po.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +7 -7
- data/lib/rdoc/generator/pot.rb +1 -1
- data/lib/rdoc/generator/ri.rb +1 -1
- 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/_icons.rhtml +208 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +25 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +25 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
- data/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/aliki/class.rhtml +220 -0
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +1737 -0
- data/lib/rdoc/generator/template/aliki/index.rhtml +22 -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 +18 -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 +16 -16
- 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/css/rdoc.css +2 -0
- 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 +72 -18
- data/lib/rdoc/markdown.rb +411 -547
- data/lib/rdoc/markup/attribute_manager.rb +5 -5
- data/lib/rdoc/markup/attributes.rb +3 -3
- data/lib/rdoc/markup/blank_line.rb +2 -2
- data/lib/rdoc/markup/block_quote.rb +1 -1
- data/lib/rdoc/markup/document.rb +8 -8
- data/lib/rdoc/markup/formatter.rb +12 -12
- data/lib/rdoc/markup/hard_break.rb +3 -3
- data/lib/rdoc/markup/heading.rb +4 -4
- data/lib/rdoc/markup/include.rb +3 -3
- data/lib/rdoc/markup/indented_paragraph.rb +3 -3
- data/lib/rdoc/markup/list.rb +4 -4
- data/lib/rdoc/markup/list_item.rb +4 -4
- data/lib/rdoc/markup/paragraph.rb +2 -2
- data/lib/rdoc/markup/parser.rb +11 -11
- data/lib/rdoc/markup/pre_process.rb +39 -15
- data/lib/rdoc/markup/raw.rb +5 -5
- data/lib/rdoc/markup/rule.rb +2 -2
- data/lib/rdoc/markup/table.rb +4 -4
- data/lib/rdoc/markup/to_ansi.rb +7 -3
- data/lib/rdoc/markup/to_bs.rb +10 -6
- data/lib/rdoc/markup/to_html.rb +182 -30
- data/lib/rdoc/markup/to_html_crossref.rb +58 -28
- data/lib/rdoc/markup/to_html_snippet.rb +17 -17
- data/lib/rdoc/markup/to_joined_paragraph.rb +1 -1
- data/lib/rdoc/markup/to_label.rb +6 -5
- data/lib/rdoc/markup/to_markdown.rb +12 -12
- data/lib/rdoc/markup/to_rdoc.rb +40 -31
- data/lib/rdoc/markup/to_table_of_contents.rb +3 -3
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +8 -8
- data/lib/rdoc/markup/verbatim.rb +3 -3
- data/lib/rdoc/markup.rb +3 -3
- data/lib/rdoc/options.rb +53 -23
- data/lib/rdoc/parser/c.rb +31 -62
- data/lib/rdoc/parser/changelog.rb +9 -9
- data/lib/rdoc/parser/prism_ruby.rb +122 -114
- data/lib/rdoc/parser/ruby.rb +51 -51
- data/lib/rdoc/parser/ruby_tools.rb +5 -7
- data/lib/rdoc/parser/simple.rb +5 -22
- data/lib/rdoc/parser.rb +8 -8
- data/lib/rdoc/rd/inline.rb +4 -4
- data/lib/rdoc/rd.rb +1 -1
- data/lib/rdoc/rdoc.rb +9 -8
- data/lib/rdoc/ri/driver.rb +49 -49
- data/lib/rdoc/ri/paths.rb +2 -2
- data/lib/rdoc/ri/task.rb +3 -3
- data/lib/rdoc/rubygems_hook.rb +14 -11
- data/lib/rdoc/servlet.rb +15 -15
- data/lib/rdoc/stats/normal.rb +1 -1
- data/lib/rdoc/stats/quiet.rb +1 -1
- data/lib/rdoc/stats/verbose.rb +3 -3
- data/lib/rdoc/stats.rb +12 -12
- data/lib/rdoc/store.rb +32 -32
- data/lib/rdoc/task.rb +6 -6
- data/lib/rdoc/text.rb +11 -11
- data/lib/rdoc/token_stream.rb +14 -2
- data/lib/rdoc/tom_doc.rb +8 -8
- data/lib/rdoc/version.rb +1 -1
- data/man/ri.1 +2 -0
- data/rdoc.gemspec +72 -0
- metadata +61 -6
- data/README.rdoc +0 -142
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
|
|
|
@@ -363,7 +363,37 @@ class RDoc::Options
|
|
|
363
363
|
# Words to be ignored in autolink cross-references
|
|
364
364
|
attr_accessor :autolink_excluded_words
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
##
|
|
367
|
+
# The prefix to use for class and module page paths
|
|
368
|
+
|
|
369
|
+
attr_accessor :class_module_path_prefix
|
|
370
|
+
|
|
371
|
+
##
|
|
372
|
+
# The prefix to use for file page paths
|
|
373
|
+
|
|
374
|
+
attr_accessor :file_path_prefix
|
|
375
|
+
|
|
376
|
+
##
|
|
377
|
+
# The preferred root URL for the documentation
|
|
378
|
+
|
|
379
|
+
attr_accessor :canonical_root
|
|
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
|
+
|
|
396
|
+
def initialize(loaded_options = nil) # :nodoc:
|
|
367
397
|
init_ivars
|
|
368
398
|
override loaded_options if loaded_options
|
|
369
399
|
end
|
|
@@ -381,10 +411,9 @@ class RDoc::Options
|
|
|
381
411
|
@files = nil
|
|
382
412
|
@force_output = false
|
|
383
413
|
@force_update = true
|
|
384
|
-
@
|
|
385
|
-
@generator_name = nil
|
|
386
|
-
@generator_options = []
|
|
414
|
+
@generator_name = "darkfish"
|
|
387
415
|
@generators = RDoc::RDoc::GENERATORS
|
|
416
|
+
@generator_options = []
|
|
388
417
|
@hyperlink_all = false
|
|
389
418
|
@line_numbers = false
|
|
390
419
|
@locale = nil
|
|
@@ -417,9 +446,13 @@ class RDoc::Options
|
|
|
417
446
|
@charset = @encoding.name
|
|
418
447
|
@skip_tests = true
|
|
419
448
|
@apply_default_exclude = true
|
|
449
|
+
@class_module_path_prefix = nil
|
|
450
|
+
@file_path_prefix = nil
|
|
451
|
+
@canonical_root = nil
|
|
452
|
+
@footer_content = nil
|
|
420
453
|
end
|
|
421
454
|
|
|
422
|
-
def init_with
|
|
455
|
+
def init_with(map) # :nodoc:
|
|
423
456
|
init_ivars
|
|
424
457
|
|
|
425
458
|
encoding = map['encoding']
|
|
@@ -445,16 +478,17 @@ class RDoc::Options
|
|
|
445
478
|
|
|
446
479
|
@apply_default_exclude = map['apply_default_exclude']
|
|
447
480
|
@autolink_excluded_words = map['autolink_excluded_words']
|
|
481
|
+
@footer_content = map['footer_content']
|
|
448
482
|
|
|
449
483
|
@rdoc_include = sanitize_path map['rdoc_include']
|
|
450
484
|
@static_path = sanitize_path map['static_path']
|
|
451
485
|
end
|
|
452
486
|
|
|
453
|
-
def yaml_initialize
|
|
487
|
+
def yaml_initialize(tag, map) # :nodoc:
|
|
454
488
|
init_with map
|
|
455
489
|
end
|
|
456
490
|
|
|
457
|
-
def override
|
|
491
|
+
def override(map) # :nodoc:
|
|
458
492
|
if map.has_key?('encoding')
|
|
459
493
|
encoding = map['encoding']
|
|
460
494
|
@encoding = encoding ? Encoding.find(encoding) : encoding
|
|
@@ -480,6 +514,8 @@ class RDoc::Options
|
|
|
480
514
|
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
|
481
515
|
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
|
482
516
|
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
|
517
|
+
@canonical_root = map['canonical_root'] if map.has_key?('canonical_root')
|
|
518
|
+
@footer_content = map['footer_content'] if map.has_key?('footer_content')
|
|
483
519
|
|
|
484
520
|
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
|
485
521
|
|
|
@@ -491,7 +527,7 @@ class RDoc::Options
|
|
|
491
527
|
end
|
|
492
528
|
end
|
|
493
529
|
|
|
494
|
-
def ==
|
|
530
|
+
def ==(other) # :nodoc:
|
|
495
531
|
self.class === other and
|
|
496
532
|
@encoding == other.encoding and
|
|
497
533
|
@embed_mixins == other.embed_mixins and
|
|
@@ -683,7 +719,7 @@ class RDoc::Options
|
|
|
683
719
|
##
|
|
684
720
|
# Parses command line options.
|
|
685
721
|
|
|
686
|
-
def parse
|
|
722
|
+
def parse(argv)
|
|
687
723
|
ignore_invalid = true
|
|
688
724
|
|
|
689
725
|
argv.insert(0, *ENV['RDOCOPT'].split) if ENV['RDOCOPT']
|
|
@@ -1194,9 +1230,6 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1194
1230
|
opt.separator nil
|
|
1195
1231
|
end
|
|
1196
1232
|
|
|
1197
|
-
setup_generator 'darkfish' if
|
|
1198
|
-
argv.grep(/\A(-f|--fmt|--format|-r|-R|--ri|--ri-site)\b/).empty?
|
|
1199
|
-
|
|
1200
1233
|
deprecated = []
|
|
1201
1234
|
invalid = []
|
|
1202
1235
|
|
|
@@ -1214,10 +1247,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1214
1247
|
retry
|
|
1215
1248
|
end
|
|
1216
1249
|
|
|
1217
|
-
unless @generator
|
|
1218
|
-
@generator = RDoc::Generator::Darkfish
|
|
1219
|
-
@generator_name = 'darkfish'
|
|
1220
|
-
end
|
|
1250
|
+
setup_generator unless @generator
|
|
1221
1251
|
|
|
1222
1252
|
if @pipe and not argv.empty? then
|
|
1223
1253
|
@pipe = false
|
|
@@ -1262,14 +1292,14 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1262
1292
|
##
|
|
1263
1293
|
# Set quietness to +bool+
|
|
1264
1294
|
|
|
1265
|
-
def quiet=
|
|
1295
|
+
def quiet=(bool)
|
|
1266
1296
|
@verbosity = bool ? 0 : 1
|
|
1267
1297
|
end
|
|
1268
1298
|
|
|
1269
1299
|
##
|
|
1270
1300
|
# Removes directories from +path+ that are outside the current directory
|
|
1271
1301
|
|
|
1272
|
-
def sanitize_path
|
|
1302
|
+
def sanitize_path(path)
|
|
1273
1303
|
require 'pathname'
|
|
1274
1304
|
dot = Pathname.new('.').expand_path
|
|
1275
1305
|
|
|
@@ -1296,7 +1326,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1296
1326
|
# the options instance. This allows generators to add custom options or set
|
|
1297
1327
|
# default options.
|
|
1298
1328
|
|
|
1299
|
-
def setup_generator
|
|
1329
|
+
def setup_generator(generator_name = @generator_name)
|
|
1300
1330
|
@generator = @generators[generator_name]
|
|
1301
1331
|
|
|
1302
1332
|
unless @generator then
|
|
@@ -1318,7 +1348,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1318
1348
|
##
|
|
1319
1349
|
# Finds the template dir for +template+
|
|
1320
1350
|
|
|
1321
|
-
def template_dir_for
|
|
1351
|
+
def template_dir_for(template)
|
|
1322
1352
|
template_path = File.join 'rdoc', 'generator', 'template', template
|
|
1323
1353
|
|
|
1324
1354
|
$LOAD_PATH.map do |path|
|
|
@@ -1335,7 +1365,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1335
1365
|
# When +:all+ is passed, visibility is set to +:private+, similarly to
|
|
1336
1366
|
# RDOCOPT="--all", see #visibility for more information.
|
|
1337
1367
|
|
|
1338
|
-
def visibility=
|
|
1368
|
+
def visibility=(visibility)
|
|
1339
1369
|
case visibility
|
|
1340
1370
|
when :all
|
|
1341
1371
|
@visibility = :private
|
|
@@ -1347,7 +1377,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1347
1377
|
##
|
|
1348
1378
|
# Displays a warning using Kernel#warn if we're being verbose
|
|
1349
1379
|
|
|
1350
|
-
def warn
|
|
1380
|
+
def warn(message)
|
|
1351
1381
|
super message if @verbosity > 1
|
|
1352
1382
|
end
|
|
1353
1383
|
|
data/lib/rdoc/parser/c.rb
CHANGED
|
@@ -168,7 +168,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
168
168
|
# Prepares for parsing a C file. See RDoc::Parser#initialize for details on
|
|
169
169
|
# the arguments.
|
|
170
170
|
|
|
171
|
-
def initialize
|
|
171
|
+
def initialize(top_level, content, options, stats)
|
|
172
172
|
super
|
|
173
173
|
|
|
174
174
|
@known_classes = RDoc::KNOWN_CLASSES.dup
|
|
@@ -193,7 +193,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
193
193
|
|
|
194
194
|
@enclosure_dependencies.extend TSort
|
|
195
195
|
|
|
196
|
-
def @enclosure_dependencies.tsort_each_node
|
|
196
|
+
def @enclosure_dependencies.tsort_each_node(&block)
|
|
197
197
|
each_key(&block)
|
|
198
198
|
rescue TSort::Cyclic => e
|
|
199
199
|
cycle_vars = e.message.scan(/"(.*?)"/).flatten
|
|
@@ -211,7 +211,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
211
211
|
retry
|
|
212
212
|
end
|
|
213
213
|
|
|
214
|
-
def @enclosure_dependencies.tsort_each_child
|
|
214
|
+
def @enclosure_dependencies.tsort_each_child(node, &block)
|
|
215
215
|
fetch(node, []).each(&block)
|
|
216
216
|
end
|
|
217
217
|
end
|
|
@@ -519,7 +519,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
519
519
|
# Finds the comment for an alias on +class_name+ from +new_name+ to
|
|
520
520
|
# +old_name+
|
|
521
521
|
|
|
522
|
-
def find_alias_comment
|
|
522
|
+
def find_alias_comment(class_name, new_name, old_name)
|
|
523
523
|
content =~ %r%((?>/\*.*?\*/\s+))
|
|
524
524
|
rb_define_alias\(\s*#{Regexp.escape class_name}\s*,
|
|
525
525
|
\s*"#{Regexp.escape new_name}"\s*,
|
|
@@ -537,7 +537,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
537
537
|
# +read+ and +write+ are the read/write flags ('1' or '0'). Either both or
|
|
538
538
|
# neither must be provided.
|
|
539
539
|
|
|
540
|
-
def find_attr_comment
|
|
540
|
+
def find_attr_comment(var_name, attr_name, read = nil, write = nil)
|
|
541
541
|
attr_name = Regexp.escape attr_name
|
|
542
542
|
|
|
543
543
|
rw = if read and write then
|
|
@@ -570,7 +570,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
570
570
|
##
|
|
571
571
|
# Generate a Ruby-method table
|
|
572
572
|
|
|
573
|
-
def gen_body_table
|
|
573
|
+
def gen_body_table(file_content)
|
|
574
574
|
table = {}
|
|
575
575
|
file_content.scan(%r{
|
|
576
576
|
((?>/\*.*?\*/\s*)?)
|
|
@@ -594,7 +594,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
594
594
|
##
|
|
595
595
|
# Find the C code corresponding to a Ruby method
|
|
596
596
|
|
|
597
|
-
def find_body
|
|
597
|
+
def find_body(class_name, meth_name, meth_obj, file_content, quiet = false)
|
|
598
598
|
if file_content
|
|
599
599
|
@body_table ||= {}
|
|
600
600
|
@body_table[file_content] ||= gen_body_table file_content
|
|
@@ -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
|
|
|
@@ -719,7 +714,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
719
714
|
# */
|
|
720
715
|
# VALUE cFoo = rb_define_class("Foo", rb_cObject);
|
|
721
716
|
|
|
722
|
-
def find_class_comment
|
|
717
|
+
def find_class_comment(class_name, class_mod)
|
|
723
718
|
comment = nil
|
|
724
719
|
|
|
725
720
|
if @content =~ %r%
|
|
@@ -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
|
|
|
@@ -752,7 +746,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
752
746
|
##
|
|
753
747
|
# Generate a const table
|
|
754
748
|
|
|
755
|
-
def gen_const_table
|
|
749
|
+
def gen_const_table(file_content)
|
|
756
750
|
table = {}
|
|
757
751
|
@content.scan(%r{
|
|
758
752
|
(?<doc>(?>^\s*/\*.*?\*/\s+))
|
|
@@ -806,27 +800,24 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
806
800
|
##
|
|
807
801
|
# Handles modifiers in +comment+ and updates +meth_obj+ as appropriate.
|
|
808
802
|
|
|
809
|
-
def find_modifiers
|
|
810
|
-
comment.normalize
|
|
811
|
-
meth_obj.call_seq = comment.extract_call_seq
|
|
812
|
-
|
|
803
|
+
def find_modifiers(comment, meth_obj)
|
|
813
804
|
look_for_directives_in meth_obj, comment
|
|
814
805
|
end
|
|
815
806
|
|
|
816
807
|
##
|
|
817
808
|
# Finds a <tt>Document-method</tt> override for +meth_obj+ on +class_name+
|
|
818
809
|
|
|
819
|
-
def find_override_comment
|
|
810
|
+
def find_override_comment(class_name, meth_obj)
|
|
820
811
|
name = Regexp.escape meth_obj.name
|
|
821
812
|
prefix = Regexp.escape meth_obj.name_prefix
|
|
822
813
|
|
|
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
|
|
@@ -1060,18 +1051,21 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1060
1051
|
##
|
|
1061
1052
|
# Registers a singleton class +sclass_var+ as a singleton of +class_var+
|
|
1062
1053
|
|
|
1063
|
-
def handle_singleton
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
@
|
|
1054
|
+
def handle_singleton(sclass_var, class_var)
|
|
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
|
##
|
|
1071
1065
|
# Loads the variable map with the given +name+ from the RDoc::Store, if
|
|
1072
1066
|
# present.
|
|
1073
1067
|
|
|
1074
|
-
def load_variable_map
|
|
1068
|
+
def load_variable_map(map_name)
|
|
1075
1069
|
return {} unless files = @store.cache[map_name]
|
|
1076
1070
|
return {} unless name_map = files[@file_name]
|
|
1077
1071
|
|
|
@@ -1101,36 +1095,11 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1101
1095
|
# This method modifies the +comment+
|
|
1102
1096
|
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
|
|
1103
1097
|
|
|
1104
|
-
def look_for_directives_in
|
|
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
|
-
|
|
1098
|
+
def look_for_directives_in(context, comment)
|
|
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
|
|
|
@@ -1138,7 +1107,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1138
1107
|
# Extracts parameters from the +method_body+ and returns a method
|
|
1139
1108
|
# parameter string. Follows 1.9.3dev's scan-arg-spec, see README.EXT
|
|
1140
1109
|
|
|
1141
|
-
def rb_scan_args
|
|
1110
|
+
def rb_scan_args(method_body)
|
|
1142
1111
|
method_body =~ /rb_scan_args\((.*?)\)/m
|
|
1143
1112
|
return '(*args)' unless $1
|
|
1144
1113
|
|
|
@@ -1249,7 +1218,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1249
1218
|
##
|
|
1250
1219
|
# Creates a RDoc::Comment instance.
|
|
1251
1220
|
|
|
1252
|
-
def new_comment
|
|
1221
|
+
def new_comment(text = nil, location = nil, language = nil)
|
|
1253
1222
|
RDoc::Comment.new(text, location, language).tap do |comment|
|
|
1254
1223
|
comment.format = @markup
|
|
1255
1224
|
end
|
|
@@ -23,7 +23,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
23
23
|
# Continued function listings are joined together as a single entry.
|
|
24
24
|
# Continued descriptions are joined to make a single paragraph.
|
|
25
25
|
|
|
26
|
-
def continue_entry_body
|
|
26
|
+
def continue_entry_body(entry_body, continuation)
|
|
27
27
|
return unless last = entry_body.last
|
|
28
28
|
|
|
29
29
|
if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then
|
|
@@ -41,7 +41,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
41
41
|
##
|
|
42
42
|
# Creates an RDoc::Markup::Document given the +groups+ of ChangeLog entries.
|
|
43
43
|
|
|
44
|
-
def create_document
|
|
44
|
+
def create_document(groups)
|
|
45
45
|
doc = RDoc::Markup::Document.new
|
|
46
46
|
doc.omit_headings_below = 2
|
|
47
47
|
doc.file = @top_level
|
|
@@ -63,7 +63,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
63
63
|
# Returns a list of ChangeLog entries an RDoc::Markup nodes for the given
|
|
64
64
|
# +entries+.
|
|
65
65
|
|
|
66
|
-
def create_entries
|
|
66
|
+
def create_entries(entries)
|
|
67
67
|
out = []
|
|
68
68
|
|
|
69
69
|
entries.each do |entry, items|
|
|
@@ -80,7 +80,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
80
80
|
# Returns an RDoc::Markup::List containing the given +items+ in the
|
|
81
81
|
# ChangeLog
|
|
82
82
|
|
|
83
|
-
def create_items
|
|
83
|
+
def create_items(items)
|
|
84
84
|
list = RDoc::Markup::List.new :NOTE
|
|
85
85
|
|
|
86
86
|
items.each do |item|
|
|
@@ -100,7 +100,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
100
100
|
##
|
|
101
101
|
# Groups +entries+ by date.
|
|
102
102
|
|
|
103
|
-
def group_entries
|
|
103
|
+
def group_entries(entries)
|
|
104
104
|
@time_cache ||= {}
|
|
105
105
|
entries.group_by do |title, _|
|
|
106
106
|
begin
|
|
@@ -260,7 +260,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
260
260
|
# RDoc::Parser::ChangeLog::Git::LogEntry list for the given
|
|
261
261
|
# +entries+.
|
|
262
262
|
|
|
263
|
-
def create_entries
|
|
263
|
+
def create_entries(entries)
|
|
264
264
|
# git log entries have no strictly itemized style like the old
|
|
265
265
|
# style, just assume Markdown.
|
|
266
266
|
entries.map do |commit, entry|
|
|
@@ -296,7 +296,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
296
296
|
"label-#{commit}"
|
|
297
297
|
end
|
|
298
298
|
|
|
299
|
-
def label
|
|
299
|
+
def label(context = nil)
|
|
300
300
|
aref
|
|
301
301
|
end
|
|
302
302
|
|
|
@@ -311,7 +311,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
311
311
|
end + " {#{author}}[mailto:#{email}]"
|
|
312
312
|
end
|
|
313
313
|
|
|
314
|
-
def accept
|
|
314
|
+
def accept(visitor)
|
|
315
315
|
visitor.accept_heading self
|
|
316
316
|
begin
|
|
317
317
|
if visitor.respond_to?(:code_object=)
|
|
@@ -328,7 +328,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
328
328
|
end
|
|
329
329
|
end
|
|
330
330
|
|
|
331
|
-
def pretty_print
|
|
331
|
+
def pretty_print(q) # :nodoc:
|
|
332
332
|
q.group(2, '[log_entry: ', ']') do
|
|
333
333
|
q.text commit
|
|
334
334
|
q.text ','
|