rdoc 6.7.0 → 6.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ExampleMarkdown.md +2 -0
- data/ExampleRDoc.rdoc +2 -0
- data/History.rdoc +64 -62
- data/LICENSE.rdoc +2 -0
- data/README.rdoc +13 -0
- data/RI.md +842 -0
- data/TODO.rdoc +8 -7
- data/lib/rdoc/{alias.rb → code_object/alias.rb} +1 -1
- data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +68 -1
- data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +17 -5
- data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +4 -4
- data/lib/rdoc/code_object.rb +6 -0
- data/lib/rdoc/generator/darkfish.rb +45 -3
- data/lib/rdoc/generator/pot/message_extractor.rb +1 -1
- data/lib/rdoc/generator/pot/po_entry.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +23 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +3 -8
- data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +69 -43
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +380 -399
- data/lib/rdoc/generator/template/darkfish/index.rhtml +7 -6
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +24 -1
- data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +5 -2
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +11 -0
- data/lib/rdoc/markdown.kpeg +1 -1
- data/lib/rdoc/markdown.rb +21 -11
- data/lib/rdoc/markup/attribute_manager.rb +2 -2
- data/lib/rdoc/markup/formatter.rb +19 -12
- data/lib/rdoc/markup/pre_process.rb +26 -6
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +1 -1
- data/lib/rdoc/markup/to_html_crossref.rb +63 -12
- data/lib/rdoc/markup/to_rdoc.rb +5 -5
- data/lib/rdoc/markup.rb +18 -13
- data/lib/rdoc/options.rb +78 -12
- data/lib/rdoc/parser/c.rb +25 -1
- data/lib/rdoc/parser/changelog.rb +2 -2
- data/lib/rdoc/parser/prism_ruby.rb +1028 -0
- data/lib/rdoc/parser/ripper_state_lex.rb +7 -305
- data/lib/rdoc/parser/ruby.rb +15 -6
- data/lib/rdoc/parser.rb +2 -1
- data/lib/rdoc/rd/block_parser.rb +3 -3
- data/lib/rdoc/rd/inline_parser.rb +3 -3
- data/lib/rdoc/rdoc.rb +6 -3
- data/lib/rdoc/ri/driver.rb +58 -14
- data/lib/rdoc/rubygems_hook.rb +90 -8
- data/lib/rdoc/store.rb +12 -0
- data/lib/rdoc/task.rb +2 -3
- data/lib/rdoc/tom_doc.rb +1 -7
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +22 -24
- data/lib/rubygems_plugin.rb +23 -0
- metadata +27 -26
- data/RI.rdoc +0 -57
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/json_index/.document +0 -1
- /data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +0 -0
- /data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +0 -0
- /data/lib/rdoc/{attr.rb → code_object/attr.rb} +0 -0
- /data/lib/rdoc/{constant.rb → code_object/constant.rb} +0 -0
- /data/lib/rdoc/{context → code_object/context}/section.rb +0 -0
- /data/lib/rdoc/{context.rb → code_object/context.rb} +0 -0
- /data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -0
- /data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +0 -0
- /data/lib/rdoc/{include.rb → code_object/include.rb} +0 -0
- /data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +0 -0
- /data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +0 -0
- /data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +0 -0
- /data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +0 -0
- /data/lib/rdoc/{require.rb → code_object/require.rb} +0 -0
- /data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +0 -0
data/lib/rdoc/options.rb
CHANGED
@@ -233,9 +233,9 @@ class RDoc::Options
|
|
233
233
|
attr_accessor :main_page
|
234
234
|
|
235
235
|
##
|
236
|
-
# The
|
237
|
-
#
|
238
|
-
|
236
|
+
# The markup format.
|
237
|
+
# One of: +rdoc+ (the default), +markdown+, +rd+, +tomdoc+.
|
238
|
+
# See {Markup Formats}[rdoc-ref:RDoc::Markup@Markup+Formats].
|
239
239
|
attr_accessor :markup
|
240
240
|
|
241
241
|
##
|
@@ -325,6 +325,12 @@ class RDoc::Options
|
|
325
325
|
|
326
326
|
attr_accessor :verbosity
|
327
327
|
|
328
|
+
##
|
329
|
+
# Warn if rdoc-ref links can't be resolved
|
330
|
+
# Default is +false+
|
331
|
+
|
332
|
+
attr_accessor :warn_missing_rdoc_ref
|
333
|
+
|
328
334
|
##
|
329
335
|
# URL of web cvs frontend
|
330
336
|
|
@@ -344,17 +350,34 @@ class RDoc::Options
|
|
344
350
|
# Indicates if files of test suites should be skipped
|
345
351
|
attr_accessor :skip_tests
|
346
352
|
|
353
|
+
##
|
354
|
+
# Embed mixin methods, attributes, and constants into class documentation. Set via
|
355
|
+
# +--[no-]embed-mixins+ (Default is +false+.)
|
356
|
+
attr_accessor :embed_mixins
|
357
|
+
|
358
|
+
##
|
359
|
+
# Exclude the default patterns as well if true.
|
360
|
+
attr_reader :apply_default_exclude
|
361
|
+
|
362
|
+
##
|
363
|
+
# Words to be ignored in autolink cross-references
|
364
|
+
attr_accessor :autolink_excluded_words
|
365
|
+
|
347
366
|
def initialize loaded_options = nil # :nodoc:
|
348
367
|
init_ivars
|
349
368
|
override loaded_options if loaded_options
|
350
369
|
end
|
351
370
|
|
371
|
+
DEFAULT_EXCLUDE = %w[
|
372
|
+
~\z \.orig\z \.rej\z \.bak\z
|
373
|
+
\.gemspec\z
|
374
|
+
]
|
375
|
+
|
352
376
|
def init_ivars # :nodoc:
|
377
|
+
@autolink_excluded_words = []
|
353
378
|
@dry_run = false
|
354
|
-
@
|
355
|
-
|
356
|
-
\.gemspec\z
|
357
|
-
]
|
379
|
+
@embed_mixins = false
|
380
|
+
@exclude = []
|
358
381
|
@files = nil
|
359
382
|
@force_output = false
|
360
383
|
@force_update = true
|
@@ -387,11 +410,13 @@ class RDoc::Options
|
|
387
410
|
@update_output_dir = true
|
388
411
|
@verbosity = 1
|
389
412
|
@visibility = :protected
|
413
|
+
@warn_missing_rdoc_ref = true
|
390
414
|
@webcvs = nil
|
391
415
|
@write_options = false
|
392
416
|
@encoding = Encoding::UTF_8
|
393
417
|
@charset = @encoding.name
|
394
418
|
@skip_tests = true
|
419
|
+
@apply_default_exclude = true
|
395
420
|
end
|
396
421
|
|
397
422
|
def init_with map # :nodoc:
|
@@ -401,6 +426,7 @@ class RDoc::Options
|
|
401
426
|
@encoding = encoding ? Encoding.find(encoding) : encoding
|
402
427
|
|
403
428
|
@charset = map['charset']
|
429
|
+
@embed_mixins = map['embed_mixins']
|
404
430
|
@exclude = map['exclude']
|
405
431
|
@generator_name = map['generator_name']
|
406
432
|
@hyperlink_all = map['hyperlink_all']
|
@@ -417,6 +443,9 @@ class RDoc::Options
|
|
417
443
|
@visibility = map['visibility']
|
418
444
|
@webcvs = map['webcvs']
|
419
445
|
|
446
|
+
@apply_default_exclude = map['apply_default_exclude']
|
447
|
+
@autolink_excluded_words = map['autolink_excluded_words']
|
448
|
+
|
420
449
|
@rdoc_include = sanitize_path map['rdoc_include']
|
421
450
|
@static_path = sanitize_path map['static_path']
|
422
451
|
end
|
@@ -432,6 +461,7 @@ class RDoc::Options
|
|
432
461
|
end
|
433
462
|
|
434
463
|
@charset = map['charset'] if map.has_key?('charset')
|
464
|
+
@embed_mixins = map['embed_mixins'] if map.has_key?('embed_mixins')
|
435
465
|
@exclude = map['exclude'] if map.has_key?('exclude')
|
436
466
|
@generator_name = map['generator_name'] if map.has_key?('generator_name')
|
437
467
|
@hyperlink_all = map['hyperlink_all'] if map.has_key?('hyperlink_all')
|
@@ -448,6 +478,10 @@ class RDoc::Options
|
|
448
478
|
@title = map['title'] if map.has_key?('title')
|
449
479
|
@visibility = map['visibility'] if map.has_key?('visibility')
|
450
480
|
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
481
|
+
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
482
|
+
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
483
|
+
|
484
|
+
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
451
485
|
|
452
486
|
if map.has_key?('rdoc_include')
|
453
487
|
@rdoc_include = sanitize_path map['rdoc_include']
|
@@ -460,11 +494,12 @@ class RDoc::Options
|
|
460
494
|
def == other # :nodoc:
|
461
495
|
self.class === other and
|
462
496
|
@encoding == other.encoding and
|
497
|
+
@embed_mixins == other.embed_mixins and
|
463
498
|
@generator_name == other.generator_name and
|
464
499
|
@hyperlink_all == other.hyperlink_all and
|
465
500
|
@line_numbers == other.line_numbers and
|
466
501
|
@locale == other.locale and
|
467
|
-
@locale_dir == other.locale_dir
|
502
|
+
@locale_dir == other.locale_dir and
|
468
503
|
@main_page == other.main_page and
|
469
504
|
@markup == other.markup and
|
470
505
|
@op_dir == other.op_dir and
|
@@ -475,7 +510,9 @@ class RDoc::Options
|
|
475
510
|
@template == other.template and
|
476
511
|
@title == other.title and
|
477
512
|
@visibility == other.visibility and
|
478
|
-
@webcvs == other.webcvs
|
513
|
+
@webcvs == other.webcvs and
|
514
|
+
@apply_default_exclude == other.apply_default_exclude and
|
515
|
+
@autolink_excluded_words == other.autolink_excluded_words
|
479
516
|
end
|
480
517
|
|
481
518
|
##
|
@@ -546,10 +583,12 @@ class RDoc::Options
|
|
546
583
|
if @exclude.nil? or Regexp === @exclude then
|
547
584
|
# done, #finish is being re-run
|
548
585
|
@exclude
|
549
|
-
elsif @exclude.empty? then
|
586
|
+
elsif !@apply_default_exclude and @exclude.empty? then
|
550
587
|
nil
|
551
588
|
else
|
552
|
-
|
589
|
+
exclude = @exclude
|
590
|
+
exclude |= DEFAULT_EXCLUDE if @apply_default_exclude
|
591
|
+
Regexp.new(exclude.join("|"))
|
553
592
|
end
|
554
593
|
end
|
555
594
|
|
@@ -683,7 +722,7 @@ Usage: #{opt.program_name} [options] [names...]
|
|
683
722
|
|
684
723
|
EOF
|
685
724
|
|
686
|
-
parsers = Hash.new { |h,parser| h[parser] = [] }
|
725
|
+
parsers = Hash.new { |h, parser| h[parser] = [] }
|
687
726
|
|
688
727
|
RDoc::Parser.parsers.each do |regexp, parser|
|
689
728
|
parsers[parser.name.sub('RDoc::Parser::', '')] << regexp.source
|
@@ -783,6 +822,11 @@ Usage: #{opt.program_name} [options] [names...]
|
|
783
822
|
@exclude << value
|
784
823
|
end
|
785
824
|
|
825
|
+
opt.on("--[no-]apply-default-exclude",
|
826
|
+
"Use default PATTERN to exclude.") do |value|
|
827
|
+
@apply_default_exclude = value
|
828
|
+
end
|
829
|
+
|
786
830
|
opt.separator nil
|
787
831
|
|
788
832
|
opt.on("--no-skipping-tests", nil,
|
@@ -842,6 +886,14 @@ Usage: #{opt.program_name} [options] [names...]
|
|
842
886
|
|
843
887
|
opt.separator nil
|
844
888
|
|
889
|
+
opt.on("--[no-]embed-mixins",
|
890
|
+
"Embed mixin methods, attributes, and constants",
|
891
|
+
"into class documentation. (default false)") do |value|
|
892
|
+
@embed_mixins = value
|
893
|
+
end
|
894
|
+
|
895
|
+
opt.separator nil
|
896
|
+
|
845
897
|
markup_formats = RDoc::Text::MARKUP_FORMAT.keys.sort
|
846
898
|
|
847
899
|
opt.on("--markup=MARKUP", markup_formats,
|
@@ -946,6 +998,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
946
998
|
|
947
999
|
opt.separator nil
|
948
1000
|
|
1001
|
+
opt.on("--autolink-excluded-words=WORDS", Array,
|
1002
|
+
"Words to be ignored in autolink cross-references") do |value|
|
1003
|
+
@autolink_excluded_words.concat value
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
opt.separator nil
|
1007
|
+
|
949
1008
|
opt.on("--hyperlink-all", "-A",
|
950
1009
|
"Generate hyperlinks for all words that",
|
951
1010
|
"correspond to known methods, even if they",
|
@@ -1087,6 +1146,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
1087
1146
|
|
1088
1147
|
opt.separator nil
|
1089
1148
|
|
1149
|
+
opt.on("--warn-missing-rdoc-ref",
|
1150
|
+
"Warn if rdoc-ref links can't be resolved") do |value|
|
1151
|
+
@warn_missing_rdoc_ref = value
|
1152
|
+
end
|
1153
|
+
|
1154
|
+
opt.separator nil
|
1155
|
+
|
1090
1156
|
opt.on("--[no-]ignore-invalid",
|
1091
1157
|
"Ignore invalid options and continue",
|
1092
1158
|
"(default true).") do |value|
|
data/lib/rdoc/parser/c.rb
CHANGED
@@ -405,6 +405,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
405
405
|
\s*(.*?)\s*\)\s*;
|
406
406
|
%xm) do |type, var_name, const_name, definition|
|
407
407
|
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
408
|
+
type = "const" if type == "global_const"
|
408
409
|
handle_constants type, var_name, const_name, definition
|
409
410
|
end
|
410
411
|
|
@@ -440,7 +441,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
440
441
|
# Scans #content for rb_include_module
|
441
442
|
|
442
443
|
def do_includes
|
443
|
-
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c,m|
|
444
|
+
@content.scan(/rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/) do |c, m|
|
444
445
|
next unless cls = @classes[c]
|
445
446
|
m = @known_classes[m] || m
|
446
447
|
|
@@ -760,6 +761,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
760
761
|
rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
|
761
762
|
"(?<name>\w+)"\s*,
|
762
763
|
.*?\)\s*;
|
764
|
+
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
765
|
+
rb_define_global_(?<type>const)\(\s*
|
766
|
+
"(?<name>\w+)"\s*,
|
767
|
+
.*?\)\s*;
|
763
768
|
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
764
769
|
rb_file_(?<type>const)\(\s*
|
765
770
|
"(?<name>\w+)"\s*,
|
@@ -1097,15 +1102,34 @@ class RDoc::Parser::C < RDoc::Parser
|
|
1097
1102
|
# */
|
1098
1103
|
#
|
1099
1104
|
# This method modifies the +comment+
|
1105
|
+
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
|
1100
1106
|
|
1101
1107
|
def look_for_directives_in context, comment
|
1102
1108
|
@preprocess.handle comment, context do |directive, param|
|
1103
1109
|
case directive
|
1104
1110
|
when 'main' then
|
1105
1111
|
@options.main_page = param
|
1112
|
+
|
1113
|
+
warn <<~MSG
|
1114
|
+
The :main: directive is deprecated and will be removed in RDoc 7.
|
1115
|
+
|
1116
|
+
You can use these options to specify the initial page displayed instead:
|
1117
|
+
- `--main=#{param}` via the command line
|
1118
|
+
- `rdoc.main = "#{param}"` if you use `RDoc::Task`
|
1119
|
+
- `main_page: #{param}` in your `.rdoc_options` file
|
1120
|
+
MSG
|
1106
1121
|
''
|
1107
1122
|
when 'title' then
|
1108
1123
|
@options.default_title = param if @options.respond_to? :default_title=
|
1124
|
+
|
1125
|
+
warn <<~MSG
|
1126
|
+
The :title: directive is deprecated and will be removed in RDoc 7.
|
1127
|
+
|
1128
|
+
You can use these options to specify the title displayed instead:
|
1129
|
+
- `--title=#{param}` via the command line
|
1130
|
+
- `rdoc.title = "#{param}"` if you use `RDoc::Task`
|
1131
|
+
- `title: #{param}` in your `.rdoc_options` file
|
1132
|
+
MSG
|
1109
1133
|
''
|
1110
1134
|
end
|
1111
1135
|
end
|
@@ -193,7 +193,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
193
193
|
|
194
194
|
entries << [entry_name, entry_body] if entry_name
|
195
195
|
|
196
|
-
entries.reject! do |(entry,_)|
|
196
|
+
entries.reject! do |(entry, _)|
|
197
197
|
entry == nil
|
198
198
|
end
|
199
199
|
|
@@ -221,7 +221,7 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
221
221
|
|
222
222
|
module Git
|
223
223
|
##
|
224
|
-
# Parses auxiliary info.
|
224
|
+
# Parses auxiliary info. Currently `base-url` to expand
|
225
225
|
# references is effective.
|
226
226
|
|
227
227
|
def parse_info(info)
|