rdoc 6.8.1 → 6.13.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/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +7 -12
- data/lib/rdoc/code_object/attr.rb +4 -7
- data/lib/rdoc/code_object/class_module.rb +53 -20
- data/lib/rdoc/code_object/constant.rb +1 -1
- data/lib/rdoc/code_object/context/section.rb +10 -68
- data/lib/rdoc/code_object/context.rb +4 -46
- data/lib/rdoc/code_object/method_attr.rb +16 -24
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +6 -24
- data/lib/rdoc/code_object.rb +3 -35
- data/lib/rdoc/comment.rb +12 -5
- data/lib/rdoc/generator/darkfish.rb +92 -108
- data/lib/rdoc/generator/json_index.rb +1 -17
- data/lib/rdoc/generator/markup.rb +2 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
- data/lib/rdoc/generator/pot.rb +0 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -29
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +40 -21
- data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +7 -1
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/formatter.rb +19 -12
- data/lib/rdoc/markup/heading.rb +7 -1
- data/lib/rdoc/markup/pre_process.rb +17 -0
- data/lib/rdoc/markup/to_html.rb +7 -2
- data/lib/rdoc/markup/to_html_crossref.rb +63 -12
- data/lib/rdoc/markup/to_rdoc.rb +1 -1
- data/lib/rdoc/options.rb +68 -7
- data/lib/rdoc/parser/c.rb +29 -8
- data/lib/rdoc/parser/changelog.rb +3 -2
- data/lib/rdoc/parser/prism_ruby.rb +1092 -0
- data/lib/rdoc/parser/ruby.rb +8 -11
- data/lib/rdoc/parser/simple.rb +1 -1
- data/lib/rdoc/parser.rb +3 -3
- data/lib/rdoc/rd/block_parser.rb +3 -3
- data/lib/rdoc/rd/inline_parser.rb +3 -3
- data/lib/rdoc/rdoc.rb +6 -19
- data/lib/rdoc/ri/driver.rb +75 -26
- data/lib/rdoc/rubygems_hook.rb +91 -15
- data/lib/rdoc/servlet.rb +8 -7
- data/lib/rdoc/stats.rb +2 -2
- data/lib/rdoc/store.rb +21 -13
- data/lib/rdoc/text.rb +2 -2
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +0 -2
- data/lib/rubygems_plugin.rb +23 -0
- metadata +5 -10
- data/lib/rdoc/generator/template/darkfish/.document +0 -0
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
- data/lib/rdoc/generator/template/json_index/.document +0 -1
data/lib/rdoc/options.rb
CHANGED
|
@@ -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
|
|
|
@@ -349,18 +355,39 @@ class RDoc::Options
|
|
|
349
355
|
# +--[no-]embed-mixins+ (Default is +false+.)
|
|
350
356
|
attr_accessor :embed_mixins
|
|
351
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
|
+
|
|
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
|
+
|
|
352
376
|
def initialize loaded_options = nil # :nodoc:
|
|
353
377
|
init_ivars
|
|
354
378
|
override loaded_options if loaded_options
|
|
355
379
|
end
|
|
356
380
|
|
|
381
|
+
DEFAULT_EXCLUDE = %w[
|
|
382
|
+
~\z \.orig\z \.rej\z \.bak\z
|
|
383
|
+
\.gemspec\z
|
|
384
|
+
]
|
|
385
|
+
|
|
357
386
|
def init_ivars # :nodoc:
|
|
387
|
+
@autolink_excluded_words = []
|
|
358
388
|
@dry_run = false
|
|
359
389
|
@embed_mixins = false
|
|
360
|
-
@exclude =
|
|
361
|
-
~\z \.orig\z \.rej\z \.bak\z
|
|
362
|
-
\.gemspec\z
|
|
363
|
-
]
|
|
390
|
+
@exclude = []
|
|
364
391
|
@files = nil
|
|
365
392
|
@force_output = false
|
|
366
393
|
@force_update = true
|
|
@@ -393,11 +420,15 @@ class RDoc::Options
|
|
|
393
420
|
@update_output_dir = true
|
|
394
421
|
@verbosity = 1
|
|
395
422
|
@visibility = :protected
|
|
423
|
+
@warn_missing_rdoc_ref = true
|
|
396
424
|
@webcvs = nil
|
|
397
425
|
@write_options = false
|
|
398
426
|
@encoding = Encoding::UTF_8
|
|
399
427
|
@charset = @encoding.name
|
|
400
428
|
@skip_tests = true
|
|
429
|
+
@apply_default_exclude = true
|
|
430
|
+
@class_module_path_prefix = nil
|
|
431
|
+
@file_path_prefix = nil
|
|
401
432
|
end
|
|
402
433
|
|
|
403
434
|
def init_with map # :nodoc:
|
|
@@ -424,6 +455,9 @@ class RDoc::Options
|
|
|
424
455
|
@visibility = map['visibility']
|
|
425
456
|
@webcvs = map['webcvs']
|
|
426
457
|
|
|
458
|
+
@apply_default_exclude = map['apply_default_exclude']
|
|
459
|
+
@autolink_excluded_words = map['autolink_excluded_words']
|
|
460
|
+
|
|
427
461
|
@rdoc_include = sanitize_path map['rdoc_include']
|
|
428
462
|
@static_path = sanitize_path map['static_path']
|
|
429
463
|
end
|
|
@@ -456,6 +490,10 @@ class RDoc::Options
|
|
|
456
490
|
@title = map['title'] if map.has_key?('title')
|
|
457
491
|
@visibility = map['visibility'] if map.has_key?('visibility')
|
|
458
492
|
@webcvs = map['webcvs'] if map.has_key?('webcvs')
|
|
493
|
+
@autolink_excluded_words = map['autolink_excluded_words'] if map.has_key?('autolink_excluded_words')
|
|
494
|
+
@apply_default_exclude = map['apply_default_exclude'] if map.has_key?('apply_default_exclude')
|
|
495
|
+
|
|
496
|
+
@warn_missing_rdoc_ref = map['warn_missing_rdoc_ref'] if map.has_key?('warn_missing_rdoc_ref')
|
|
459
497
|
|
|
460
498
|
if map.has_key?('rdoc_include')
|
|
461
499
|
@rdoc_include = sanitize_path map['rdoc_include']
|
|
@@ -484,7 +522,9 @@ class RDoc::Options
|
|
|
484
522
|
@template == other.template and
|
|
485
523
|
@title == other.title and
|
|
486
524
|
@visibility == other.visibility and
|
|
487
|
-
@webcvs == other.webcvs
|
|
525
|
+
@webcvs == other.webcvs and
|
|
526
|
+
@apply_default_exclude == other.apply_default_exclude and
|
|
527
|
+
@autolink_excluded_words == other.autolink_excluded_words
|
|
488
528
|
end
|
|
489
529
|
|
|
490
530
|
##
|
|
@@ -555,10 +595,12 @@ class RDoc::Options
|
|
|
555
595
|
if @exclude.nil? or Regexp === @exclude then
|
|
556
596
|
# done, #finish is being re-run
|
|
557
597
|
@exclude
|
|
558
|
-
elsif @exclude.empty? then
|
|
598
|
+
elsif !@apply_default_exclude and @exclude.empty? then
|
|
559
599
|
nil
|
|
560
600
|
else
|
|
561
|
-
|
|
601
|
+
exclude = @exclude
|
|
602
|
+
exclude |= DEFAULT_EXCLUDE if @apply_default_exclude
|
|
603
|
+
Regexp.new(exclude.join("|"))
|
|
562
604
|
end
|
|
563
605
|
end
|
|
564
606
|
|
|
@@ -792,6 +834,11 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
792
834
|
@exclude << value
|
|
793
835
|
end
|
|
794
836
|
|
|
837
|
+
opt.on("--[no-]apply-default-exclude",
|
|
838
|
+
"Use default PATTERN to exclude.") do |value|
|
|
839
|
+
@apply_default_exclude = value
|
|
840
|
+
end
|
|
841
|
+
|
|
795
842
|
opt.separator nil
|
|
796
843
|
|
|
797
844
|
opt.on("--no-skipping-tests", nil,
|
|
@@ -963,6 +1010,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
963
1010
|
|
|
964
1011
|
opt.separator nil
|
|
965
1012
|
|
|
1013
|
+
opt.on("--autolink-excluded-words=WORDS", Array,
|
|
1014
|
+
"Words to be ignored in autolink cross-references") do |value|
|
|
1015
|
+
@autolink_excluded_words.concat value
|
|
1016
|
+
end
|
|
1017
|
+
|
|
1018
|
+
opt.separator nil
|
|
1019
|
+
|
|
966
1020
|
opt.on("--hyperlink-all", "-A",
|
|
967
1021
|
"Generate hyperlinks for all words that",
|
|
968
1022
|
"correspond to known methods, even if they",
|
|
@@ -1104,6 +1158,13 @@ Usage: #{opt.program_name} [options] [names...]
|
|
|
1104
1158
|
|
|
1105
1159
|
opt.separator nil
|
|
1106
1160
|
|
|
1161
|
+
opt.on("--warn-missing-rdoc-ref",
|
|
1162
|
+
"Warn if rdoc-ref links can't be resolved") do |value|
|
|
1163
|
+
@warn_missing_rdoc_ref = value
|
|
1164
|
+
end
|
|
1165
|
+
|
|
1166
|
+
opt.separator nil
|
|
1167
|
+
|
|
1107
1168
|
opt.on("--[no-]ignore-invalid",
|
|
1108
1169
|
"Ignore invalid options and continue",
|
|
1109
1170
|
"(default true).") do |value|
|
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 top_level,
|
|
171
|
+
def initialize top_level, content, options, stats
|
|
172
172
|
super
|
|
173
173
|
|
|
174
174
|
@known_classes = RDoc::KNOWN_CLASSES.dup
|
|
@@ -248,9 +248,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
248
248
|
# method that reference the same function.
|
|
249
249
|
|
|
250
250
|
def add_alias(var_name, class_obj, old_name, new_name, comment)
|
|
251
|
-
al = RDoc::Alias.new '', old_name, new_name,
|
|
252
|
-
al.singleton = @singleton_classes.key? var_name
|
|
253
|
-
al.comment = comment
|
|
251
|
+
al = RDoc::Alias.new '', old_name, new_name, comment, singleton: @singleton_classes.key?(var_name)
|
|
254
252
|
al.record_location @top_level
|
|
255
253
|
class_obj.add_alias al
|
|
256
254
|
@stats.add_alias al
|
|
@@ -405,6 +403,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
405
403
|
\s*(.*?)\s*\)\s*;
|
|
406
404
|
%xm) do |type, var_name, const_name, definition|
|
|
407
405
|
var_name = "rb_cObject" if !var_name or var_name == "rb_mKernel"
|
|
406
|
+
type = "const" if type == "global_const"
|
|
408
407
|
handle_constants type, var_name, const_name, definition
|
|
409
408
|
end
|
|
410
409
|
|
|
@@ -760,6 +759,10 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
760
759
|
rb_define_(?<type>\w+)\(\s*(?:\w+),\s*
|
|
761
760
|
"(?<name>\w+)"\s*,
|
|
762
761
|
.*?\)\s*;
|
|
762
|
+
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
|
763
|
+
rb_define_global_(?<type>const)\(\s*
|
|
764
|
+
"(?<name>\w+)"\s*,
|
|
765
|
+
.*?\)\s*;
|
|
763
766
|
| (?<doc>(?>^\s*/\*.*?\*/\s+))
|
|
764
767
|
rb_file_(?<type>const)\(\s*
|
|
765
768
|
"(?<name>\w+)"\s*,
|
|
@@ -805,7 +808,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
805
808
|
|
|
806
809
|
def find_modifiers comment, meth_obj
|
|
807
810
|
comment.normalize
|
|
808
|
-
comment.extract_call_seq
|
|
811
|
+
meth_obj.call_seq = comment.extract_call_seq
|
|
809
812
|
|
|
810
813
|
look_for_directives_in meth_obj, comment
|
|
811
814
|
end
|
|
@@ -1010,10 +1013,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1010
1013
|
type = 'method' # force public
|
|
1011
1014
|
end
|
|
1012
1015
|
|
|
1013
|
-
|
|
1016
|
+
singleton = singleton || %w[singleton_method module_function].include?(type)
|
|
1017
|
+
meth_obj = RDoc::AnyMethod.new '', meth_name, singleton: singleton
|
|
1014
1018
|
meth_obj.c_function = function
|
|
1015
|
-
meth_obj.singleton =
|
|
1016
|
-
singleton || %w[singleton_method module_function].include?(type)
|
|
1017
1019
|
|
|
1018
1020
|
p_count = Integer(param_count) rescue -1
|
|
1019
1021
|
|
|
@@ -1097,15 +1099,34 @@ class RDoc::Parser::C < RDoc::Parser
|
|
|
1097
1099
|
# */
|
|
1098
1100
|
#
|
|
1099
1101
|
# This method modifies the +comment+
|
|
1102
|
+
# Both :main: and :title: directives are deprecated and will be removed in RDoc 7.
|
|
1100
1103
|
|
|
1101
1104
|
def look_for_directives_in context, comment
|
|
1102
1105
|
@preprocess.handle comment, context do |directive, param|
|
|
1103
1106
|
case directive
|
|
1104
1107
|
when 'main' then
|
|
1105
1108
|
@options.main_page = param
|
|
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
|
|
1106
1118
|
''
|
|
1107
1119
|
when 'title' then
|
|
1108
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
|
|
1109
1130
|
''
|
|
1110
1131
|
end
|
|
1111
1132
|
end
|
|
@@ -210,8 +210,9 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
210
210
|
grouped_entries = group_entries entries
|
|
211
211
|
|
|
212
212
|
doc = create_document grouped_entries
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
comment = RDoc::Comment.new(@content)
|
|
214
|
+
comment.document = doc
|
|
215
|
+
@top_level.comment = comment
|
|
215
216
|
|
|
216
217
|
@top_level
|
|
217
218
|
end
|