rdoc 6.17.0 → 7.2.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/CONTRIBUTING.md +196 -0
- data/LEGAL.rdoc +6 -0
- data/README.md +90 -7
- data/doc/markup_reference/markdown.md +558 -0
- data/doc/markup_reference/rdoc.rdoc +1169 -0
- data/lib/rdoc/code_object/any_method.rb +15 -7
- data/lib/rdoc/code_object/attr.rb +2 -1
- data/lib/rdoc/code_object/class_module.rb +62 -11
- data/lib/rdoc/code_object/constant.rb +9 -0
- data/lib/rdoc/code_object/context/section.rb +46 -9
- data/lib/rdoc/code_object/context.rb +15 -4
- data/lib/rdoc/code_object/method_attr.rb +13 -1
- data/lib/rdoc/code_object/mixin.rb +3 -0
- data/lib/rdoc/code_object/top_level.rb +15 -1
- data/lib/rdoc/comment.rb +1 -1
- data/lib/rdoc/cross_reference.rb +31 -24
- data/lib/rdoc/generator/aliki.rb +141 -0
- data/lib/rdoc/generator/darkfish.rb +3 -1
- data/lib/rdoc/generator/template/aliki/_footer.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_head.rhtml +9 -4
- data/lib/rdoc/generator/template/aliki/_header.rhtml +4 -4
- data/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +3 -3
- data/lib/rdoc/generator/template/aliki/class.rhtml +17 -17
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +278 -60
- data/lib/rdoc/generator/template/aliki/index.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/js/aliki.js +51 -23
- data/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
- data/lib/rdoc/generator/template/aliki/js/c_highlighter.js +1 -1
- data/lib/rdoc/generator/template/aliki/js/{search.js → search_controller.js} +16 -7
- data/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
- data/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
- data/lib/rdoc/generator/template/aliki/page.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +1 -1
- data/lib/rdoc/generator/template/aliki/servlet_root.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +11 -11
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +19 -0
- data/lib/rdoc/markdown.kpeg +22 -12
- data/lib/rdoc/markdown.rb +36 -26
- data/lib/rdoc/markup/blank_line.rb +25 -23
- data/lib/rdoc/markup/element.rb +21 -0
- data/lib/rdoc/markup/formatter.rb +129 -106
- data/lib/rdoc/markup/hard_break.rb +30 -27
- data/lib/rdoc/markup/heading.rb +166 -77
- data/lib/rdoc/markup/inline_parser.rb +312 -0
- data/lib/rdoc/markup/parser.rb +1 -1
- data/lib/rdoc/markup/raw.rb +52 -55
- data/lib/rdoc/markup/table.rb +48 -40
- data/lib/rdoc/markup/to_ansi.rb +51 -4
- data/lib/rdoc/markup/to_bs.rb +22 -42
- data/lib/rdoc/markup/to_html.rb +178 -183
- data/lib/rdoc/markup/to_html_crossref.rb +58 -79
- data/lib/rdoc/markup/to_html_snippet.rb +62 -62
- data/lib/rdoc/markup/to_label.rb +29 -20
- data/lib/rdoc/markup/to_markdown.rb +61 -37
- data/lib/rdoc/markup/to_rdoc.rb +86 -26
- data/lib/rdoc/markup/to_test.rb +9 -1
- data/lib/rdoc/markup/to_tt_only.rb +10 -16
- data/lib/rdoc/markup/verbatim.rb +1 -1
- data/lib/rdoc/markup.rb +11 -32
- data/lib/rdoc/options.rb +1 -1
- data/lib/rdoc/parser/changelog.rb +29 -0
- data/lib/rdoc/parser/prism_ruby.rb +44 -32
- data/lib/rdoc/parser/ruby.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +3 -3
- data/lib/rdoc/text.rb +44 -5
- data/lib/rdoc/token_stream.rb +4 -8
- data/lib/rdoc/version.rb +1 -1
- data/rdoc.gemspec +3 -3
- metadata +13 -15
- data/CONTRIBUTING.rdoc +0 -219
- data/ExampleMarkdown.md +0 -39
- data/ExampleRDoc.rdoc +0 -210
- data/lib/rdoc/markup/attr_changer.rb +0 -22
- data/lib/rdoc/markup/attr_span.rb +0 -35
- data/lib/rdoc/markup/attribute_manager.rb +0 -405
- data/lib/rdoc/markup/attributes.rb +0 -70
- data/lib/rdoc/markup/regexp_handling.rb +0 -40
data/lib/rdoc/options.rb
CHANGED
|
@@ -274,6 +274,27 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
274
274
|
def initialize(base, commit, author, email, date, contents)
|
|
275
275
|
case contents
|
|
276
276
|
when String
|
|
277
|
+
if base&.match(%r[\A([^:/]+:/+[^/]+/)[^/]+/[^/]+/])
|
|
278
|
+
repo, host = $&, $1
|
|
279
|
+
contents = contents.dup
|
|
280
|
+
# base: https://github.com/ruby/ruby/
|
|
281
|
+
# Fix #15791 -> Fix [#15791](https://github.com/ruby/ruby/pull/15791)
|
|
282
|
+
# GH-15791 -> [GH-15791](https://github.com/ruby/ruby/pull/15791)
|
|
283
|
+
# (#15791) -> ([#15791](https://github.com/ruby/ruby/pull/15791))
|
|
284
|
+
contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K\#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do
|
|
285
|
+
"[#{$&}](#{repo}pull/#{$1 || $2 || $3})"
|
|
286
|
+
end
|
|
287
|
+
# repo#PR, repo@HASH
|
|
288
|
+
# ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791)
|
|
289
|
+
# ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/ruby/commit/a8a989b6)
|
|
290
|
+
# ref in branckets is not extended
|
|
291
|
+
# [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791]
|
|
292
|
+
contents.gsub!(%r[(?<![-\w#/@]|\]\[)([-\w]+/[-\w]+)(?:@(\h{8,40})|\#(\d+))(?![-\w#/@]|\]\[)]) do
|
|
293
|
+
path = defined?($2) ? "commit/#{$2}" : "pull/#{$3}"
|
|
294
|
+
"[#{$&}](#{host}#{$1}/#{path})"
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
|
|
277
298
|
contents = RDoc::Markdown.parse(contents).parts.each do |body|
|
|
278
299
|
case body
|
|
279
300
|
when RDoc::Markup::Heading
|
|
@@ -293,6 +314,10 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
293
314
|
end
|
|
294
315
|
|
|
295
316
|
def aref
|
|
317
|
+
commit
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
def legacy_aref
|
|
296
321
|
"label-#{commit}"
|
|
297
322
|
end
|
|
298
323
|
|
|
@@ -300,6 +325,10 @@ class RDoc::Parser::ChangeLog < RDoc::Parser
|
|
|
300
325
|
aref
|
|
301
326
|
end
|
|
302
327
|
|
|
328
|
+
def legacy_label(context = nil)
|
|
329
|
+
legacy_aref
|
|
330
|
+
end
|
|
331
|
+
|
|
303
332
|
def text
|
|
304
333
|
case base
|
|
305
334
|
when nil
|
|
@@ -16,7 +16,7 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
16
16
|
parse_files_matching(/\.rbw?$/) if ENV['RDOC_USE_PRISM_PARSER']
|
|
17
17
|
|
|
18
18
|
attr_accessor :visibility
|
|
19
|
-
attr_reader :container, :singleton
|
|
19
|
+
attr_reader :container, :singleton, :in_proc_block
|
|
20
20
|
|
|
21
21
|
def initialize(top_level, content, options, stats)
|
|
22
22
|
super
|
|
@@ -43,9 +43,10 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
43
43
|
# example: `Module.new { include M }` `M.module_eval { include N }`
|
|
44
44
|
|
|
45
45
|
def with_in_proc_block
|
|
46
|
+
in_proc_block = @in_proc_block
|
|
46
47
|
@in_proc_block = true
|
|
47
48
|
yield
|
|
48
|
-
@in_proc_block =
|
|
49
|
+
@in_proc_block = in_proc_block
|
|
49
50
|
end
|
|
50
51
|
|
|
51
52
|
# Dive into another container
|
|
@@ -59,11 +60,6 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
59
60
|
@container = container
|
|
60
61
|
@singleton = singleton
|
|
61
62
|
@in_proc_block = false
|
|
62
|
-
unless singleton
|
|
63
|
-
# Need to update module parent chain to emulate Module.nesting.
|
|
64
|
-
# This mechanism is inaccurate and needs to be fixed.
|
|
65
|
-
container.parent = old_container
|
|
66
|
-
end
|
|
67
63
|
@module_nesting.push([container, singleton])
|
|
68
64
|
yield container
|
|
69
65
|
ensure
|
|
@@ -482,12 +478,14 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
482
478
|
end
|
|
483
479
|
end
|
|
484
480
|
|
|
481
|
+
# Adds includes/extends. Module name is resolved to full before adding.
|
|
482
|
+
|
|
485
483
|
def add_includes_extends(names, rdoc_class, line_no) # :nodoc:
|
|
486
|
-
return if @in_proc_block
|
|
487
484
|
comment, directives = consecutive_comment(line_no)
|
|
488
485
|
handle_code_object_directives(@container, directives) if directives
|
|
489
486
|
names.each do |name|
|
|
490
|
-
|
|
487
|
+
resolved_name = resolve_constant_path(name)
|
|
488
|
+
ie = @container.add(rdoc_class, resolved_name || name, '')
|
|
491
489
|
ie.store = @store
|
|
492
490
|
ie.line = line_no
|
|
493
491
|
ie.comment = comment
|
|
@@ -510,8 +508,6 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
510
508
|
# Adds a method defined by `def` syntax
|
|
511
509
|
|
|
512
510
|
def add_method(method_name, receiver_name:, receiver_fallback_type:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:, start_line:, args_end_line:, end_line:)
|
|
513
|
-
return if @in_proc_block
|
|
514
|
-
|
|
515
511
|
receiver = receiver_name ? find_or_create_module_path(receiver_name, receiver_fallback_type) : @container
|
|
516
512
|
comment, directives = consecutive_comment(start_line)
|
|
517
513
|
handle_code_object_directives(@container, directives) if directives
|
|
@@ -590,7 +586,7 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
590
586
|
else
|
|
591
587
|
@module_nesting.reverse_each do |nesting, singleton|
|
|
592
588
|
next if singleton
|
|
593
|
-
mod = nesting.
|
|
589
|
+
mod = nesting.get_module_named(root_name)
|
|
594
590
|
break if mod
|
|
595
591
|
# If a constant is found and it is not a module or class, RDoc can't document about it.
|
|
596
592
|
# Return an anonymous module to avoid wrong document creation.
|
|
@@ -601,9 +597,9 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
601
597
|
mod ||= add_module.call(last_nesting, root_name, :module)
|
|
602
598
|
end
|
|
603
599
|
path.each do |name|
|
|
604
|
-
mod = mod.
|
|
600
|
+
mod = mod.get_module_named(name) || add_module.call(mod, name, :module)
|
|
605
601
|
end
|
|
606
|
-
mod.
|
|
602
|
+
mod.get_module_named(name) || add_module.call(mod, name, create_mode)
|
|
607
603
|
end
|
|
608
604
|
|
|
609
605
|
# Resolves constant path to a full path by searching module nesting
|
|
@@ -614,10 +610,10 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
614
610
|
mod = nil
|
|
615
611
|
@module_nesting.reverse_each do |nesting, singleton|
|
|
616
612
|
next if singleton
|
|
617
|
-
mod = nesting.
|
|
613
|
+
mod = nesting.get_module_named(owner_name)
|
|
618
614
|
break if mod
|
|
619
615
|
end
|
|
620
|
-
mod ||= @top_level.
|
|
616
|
+
mod ||= @top_level.get_module_named(owner_name)
|
|
621
617
|
[mod.full_name, path].compact.join('::') if mod
|
|
622
618
|
end
|
|
623
619
|
|
|
@@ -657,7 +653,8 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
657
653
|
if rhs_name =~ /^::/
|
|
658
654
|
@store.find_class_or_module(rhs_name)
|
|
659
655
|
else
|
|
660
|
-
|
|
656
|
+
full_name = resolve_constant_path(rhs_name)
|
|
657
|
+
@store.find_class_or_module(full_name)
|
|
661
658
|
end
|
|
662
659
|
if mod && constant.document_self
|
|
663
660
|
a = @container.add_module_alias(mod, rhs_name, constant, @top_level)
|
|
@@ -746,11 +743,14 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
746
743
|
when :extend
|
|
747
744
|
_visit_call_extend(node)
|
|
748
745
|
when :public
|
|
749
|
-
|
|
746
|
+
super
|
|
747
|
+
_visit_call_public_private_protected(node, :public)
|
|
750
748
|
when :private
|
|
751
|
-
|
|
749
|
+
super
|
|
750
|
+
_visit_call_public_private_protected(node, :private)
|
|
752
751
|
when :protected
|
|
753
|
-
|
|
752
|
+
super
|
|
753
|
+
_visit_call_public_private_protected(node, :protected)
|
|
754
754
|
when :private_constant
|
|
755
755
|
_visit_call_private_constant(node)
|
|
756
756
|
when :public_constant
|
|
@@ -760,13 +760,15 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
760
760
|
when :alias_method
|
|
761
761
|
_visit_call_alias_method(node)
|
|
762
762
|
when :module_function
|
|
763
|
-
|
|
763
|
+
super
|
|
764
|
+
_visit_call_module_function(node)
|
|
764
765
|
when :public_class_method
|
|
765
|
-
|
|
766
|
+
super
|
|
767
|
+
_visit_call_public_private_class_method(node, :public)
|
|
766
768
|
when :private_class_method
|
|
767
|
-
|
|
769
|
+
super
|
|
770
|
+
_visit_call_public_private_class_method(node, :private)
|
|
768
771
|
else
|
|
769
|
-
node.arguments&.accept(self)
|
|
770
772
|
super
|
|
771
773
|
end
|
|
772
774
|
else
|
|
@@ -776,12 +778,14 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
776
778
|
|
|
777
779
|
def visit_block_node(node)
|
|
778
780
|
@scanner.with_in_proc_block do
|
|
779
|
-
# include, extend and method definition inside block are not documentable
|
|
781
|
+
# include, extend and method definition inside block are not documentable.
|
|
782
|
+
# visibility methods and attribute definition methods should be ignored inside block.
|
|
780
783
|
super
|
|
781
784
|
end
|
|
782
785
|
end
|
|
783
786
|
|
|
784
787
|
def visit_alias_method_node(node)
|
|
788
|
+
return if @scanner.in_proc_block
|
|
785
789
|
@scanner.process_comments_until(node.location.start_line - 1)
|
|
786
790
|
return unless node.old_name.is_a?(Prism::SymbolNode) && node.new_name.is_a?(Prism::SymbolNode)
|
|
787
791
|
@scanner.add_alias_method(node.old_name.value.to_s, node.new_name.value.to_s, node.location.start_line)
|
|
@@ -860,6 +864,8 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
860
864
|
end_line = node.location.end_line
|
|
861
865
|
@scanner.process_comments_until(start_line - 1)
|
|
862
866
|
|
|
867
|
+
return if @scanner.in_proc_block
|
|
868
|
+
|
|
863
869
|
case node.receiver
|
|
864
870
|
when Prism::NilNode, Prism::TrueNode, Prism::FalseNode
|
|
865
871
|
visibility = :public
|
|
@@ -997,37 +1003,39 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
997
1003
|
end
|
|
998
1004
|
|
|
999
1005
|
def _visit_call_module_function(call_node)
|
|
1000
|
-
|
|
1001
|
-
return if @scanner.singleton
|
|
1006
|
+
return if @scanner.in_proc_block || @scanner.singleton
|
|
1002
1007
|
names = visibility_method_arguments(call_node, singleton: false)&.map(&:to_s)
|
|
1003
1008
|
@scanner.change_method_to_module_function(names) if names
|
|
1004
1009
|
end
|
|
1005
1010
|
|
|
1006
1011
|
def _visit_call_public_private_class_method(call_node, visibility)
|
|
1007
|
-
|
|
1008
|
-
return if @scanner.singleton
|
|
1012
|
+
return if @scanner.in_proc_block || @scanner.singleton
|
|
1009
1013
|
names = visibility_method_arguments(call_node, singleton: true)
|
|
1010
1014
|
@scanner.change_method_visibility(names, visibility, singleton: true) if names
|
|
1011
1015
|
end
|
|
1012
1016
|
|
|
1013
1017
|
def _visit_call_public_private_protected(call_node, visibility)
|
|
1018
|
+
return if @scanner.in_proc_block
|
|
1014
1019
|
arguments_node = call_node.arguments
|
|
1015
1020
|
if arguments_node.nil? # `public` `private`
|
|
1016
1021
|
@scanner.visibility = visibility
|
|
1017
1022
|
else # `public :foo, :bar`, `private def foo; end`
|
|
1018
|
-
yield
|
|
1019
1023
|
names = visibility_method_arguments(call_node, singleton: false)
|
|
1020
1024
|
@scanner.change_method_visibility(names, visibility) if names
|
|
1021
1025
|
end
|
|
1022
1026
|
end
|
|
1023
1027
|
|
|
1024
1028
|
def _visit_call_alias_method(call_node)
|
|
1029
|
+
return if @scanner.in_proc_block
|
|
1030
|
+
|
|
1025
1031
|
new_name, old_name, *rest = symbol_arguments(call_node)
|
|
1026
1032
|
return unless old_name && new_name && rest.empty?
|
|
1027
1033
|
@scanner.add_alias_method(old_name.to_s, new_name.to_s, call_node.location.start_line)
|
|
1028
1034
|
end
|
|
1029
1035
|
|
|
1030
1036
|
def _visit_call_include(call_node)
|
|
1037
|
+
return if @scanner.in_proc_block
|
|
1038
|
+
|
|
1031
1039
|
names = constant_arguments_names(call_node)
|
|
1032
1040
|
line_no = call_node.location.start_line
|
|
1033
1041
|
return unless names
|
|
@@ -1040,26 +1048,30 @@ class RDoc::Parser::PrismRuby < RDoc::Parser
|
|
|
1040
1048
|
end
|
|
1041
1049
|
|
|
1042
1050
|
def _visit_call_extend(call_node)
|
|
1051
|
+
return if @scanner.in_proc_block
|
|
1052
|
+
|
|
1043
1053
|
names = constant_arguments_names(call_node)
|
|
1044
1054
|
@scanner.add_extends(names, call_node.location.start_line) if names && !@scanner.singleton
|
|
1045
1055
|
end
|
|
1046
1056
|
|
|
1047
1057
|
def _visit_call_public_constant(call_node)
|
|
1048
|
-
return if @scanner.singleton
|
|
1058
|
+
return if @scanner.in_proc_block || @scanner.singleton
|
|
1049
1059
|
names = symbol_arguments(call_node)
|
|
1050
1060
|
@scanner.container.set_constant_visibility_for(names.map(&:to_s), :public) if names
|
|
1051
1061
|
end
|
|
1052
1062
|
|
|
1053
1063
|
def _visit_call_private_constant(call_node)
|
|
1054
|
-
return if @scanner.singleton
|
|
1064
|
+
return if @scanner.in_proc_block || @scanner.singleton
|
|
1055
1065
|
names = symbol_arguments(call_node)
|
|
1056
1066
|
@scanner.container.set_constant_visibility_for(names.map(&:to_s), :private) if names
|
|
1057
1067
|
end
|
|
1058
1068
|
|
|
1059
1069
|
def _visit_call_attr_reader_writer_accessor(call_node, rw)
|
|
1070
|
+
return if @scanner.in_proc_block
|
|
1060
1071
|
names = symbol_arguments(call_node)
|
|
1061
1072
|
@scanner.add_attributes(names.map(&:to_s), rw, call_node.location.start_line) if names
|
|
1062
1073
|
end
|
|
1074
|
+
|
|
1063
1075
|
class MethodSignatureVisitor < Prism::Visitor # :nodoc:
|
|
1064
1076
|
class << self
|
|
1065
1077
|
def scan_signature(def_node)
|
data/lib/rdoc/parser/ruby.rb
CHANGED
|
@@ -101,7 +101,7 @@ require_relative 'ripper_state_lex'
|
|
|
101
101
|
#
|
|
102
102
|
# The parser looks at the token after the identifier to determine the name, in
|
|
103
103
|
# this example, :meta_method. If a name cannot be found, a warning is printed
|
|
104
|
-
# and 'unknown is used.
|
|
104
|
+
# and 'unknown' is used.
|
|
105
105
|
#
|
|
106
106
|
# You can force the name of a method using the :method: directive:
|
|
107
107
|
#
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
|
@@ -118,7 +118,7 @@ class RDoc::RubyGemsHook
|
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
##
|
|
121
|
-
# Generates documentation using the named +generator+ ("
|
|
121
|
+
# Generates documentation using the named +generator+ ("aliki" or "ri")
|
|
122
122
|
# and following the given +options+.
|
|
123
123
|
#
|
|
124
124
|
# Documentation will be generated into +destination+
|
|
@@ -190,7 +190,7 @@ class RDoc::RubyGemsHook
|
|
|
190
190
|
|
|
191
191
|
Dir.chdir @spec.full_gem_path do
|
|
192
192
|
# RDoc::Options#finish must be called before parse_files.
|
|
193
|
-
# RDoc::Options#finish is also called after ri/
|
|
193
|
+
# RDoc::Options#finish is also called after ri/aliki generator setup.
|
|
194
194
|
# We need to dup the options to avoid modifying it after finish is called.
|
|
195
195
|
parse_options = options.dup
|
|
196
196
|
parse_options.finish
|
|
@@ -202,7 +202,7 @@ class RDoc::RubyGemsHook
|
|
|
202
202
|
document 'ri', options, @ri_dir if
|
|
203
203
|
@generate_ri and (@force or not File.exist? @ri_dir)
|
|
204
204
|
|
|
205
|
-
document '
|
|
205
|
+
document 'aliki', options, @rdoc_dir if
|
|
206
206
|
@generate_rdoc and (@force or not File.exist? @rdoc_dir)
|
|
207
207
|
end
|
|
208
208
|
|
data/lib/rdoc/text.rb
CHANGED
|
@@ -193,11 +193,15 @@ module RDoc::Text
|
|
|
193
193
|
text.gsub(/^\s+$/, empty)
|
|
194
194
|
end
|
|
195
195
|
|
|
196
|
+
def to_html(text)
|
|
197
|
+
to_html_characters(text)
|
|
198
|
+
end
|
|
199
|
+
|
|
196
200
|
##
|
|
197
201
|
# Converts ampersand, dashes, ellipsis, quotes, copyright and registered
|
|
198
202
|
# trademark symbols in +text+ to properly encoded characters.
|
|
199
203
|
|
|
200
|
-
def
|
|
204
|
+
def to_html_characters(text)
|
|
201
205
|
html = (''.encode text.encoding).dup
|
|
202
206
|
|
|
203
207
|
encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding]
|
|
@@ -210,15 +214,12 @@ module RDoc::Text
|
|
|
210
214
|
until s.eos? do
|
|
211
215
|
case
|
|
212
216
|
when s.scan(/<(tt|code)>.*?<\/\1>/) then # skip contents of tt
|
|
213
|
-
html << s.matched
|
|
217
|
+
html << s.matched
|
|
214
218
|
when s.scan(/<(tt|code)>.*?/) then
|
|
215
219
|
warn "mismatched <#{s[1]}> tag" # TODO signal file/line
|
|
216
220
|
html << s.matched
|
|
217
221
|
when s.scan(/<[^>]+\/?s*>/) then # skip HTML tags
|
|
218
222
|
html << s.matched
|
|
219
|
-
when s.scan(/\\(\S)/) then # unhandled suppressed crossref
|
|
220
|
-
html << s[1]
|
|
221
|
-
after_word = nil
|
|
222
223
|
when s.scan(/\.\.\.(\.?)/) then
|
|
223
224
|
html << s[1] << encoded[:ellipsis]
|
|
224
225
|
after_word = nil
|
|
@@ -319,4 +320,42 @@ module RDoc::Text
|
|
|
319
320
|
|
|
320
321
|
SPACE_SEPARATED_LETTER_CLASS = /[\p{Nd}\p{Lc}\p{Pc}]|[!-~&&\W]/
|
|
321
322
|
|
|
323
|
+
##
|
|
324
|
+
# Converts +text+ to a GitHub-style anchor ID:
|
|
325
|
+
# - Lowercase
|
|
326
|
+
# - Remove characters that aren't alphanumeric, space, or hyphen
|
|
327
|
+
# - Replace spaces with hyphens
|
|
328
|
+
#
|
|
329
|
+
# Examples:
|
|
330
|
+
# "Hello World" -> "hello-world"
|
|
331
|
+
# "Foo::Bar" -> "foobar"
|
|
332
|
+
# "What's New?" -> "whats-new"
|
|
333
|
+
|
|
334
|
+
module_function def to_anchor(text)
|
|
335
|
+
text.downcase.gsub(/[^a-z0-9 \-]/, '').gsub(' ', '-')
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
##
|
|
339
|
+
# Decodes a label that may be in legacy RDoc format where CGI.escape was
|
|
340
|
+
# applied and then '%' was replaced with '-'. Converts '+' to space,
|
|
341
|
+
# then reverses -XX hex encoding for non-alphanumeric characters.
|
|
342
|
+
#
|
|
343
|
+
# Labels in new format pass through unchanged because -XX patterns that
|
|
344
|
+
# decode to alphanumeric characters are left as-is (CGI.escape never
|
|
345
|
+
# encodes alphanumerics).
|
|
346
|
+
#
|
|
347
|
+
# Examples:
|
|
348
|
+
# "What-27s+Here" -> "What's Here" (legacy: -27 is apostrophe)
|
|
349
|
+
# "Foo-3A-3ABar" -> "Foo::Bar" (legacy: -3A is colon)
|
|
350
|
+
# "Whats-Here" -> "Whats-Here" (new format, unchanged)
|
|
351
|
+
|
|
352
|
+
module_function def decode_legacy_label(label)
|
|
353
|
+
label = label.tr('+', ' ')
|
|
354
|
+
label.gsub!(/-([0-7][0-9A-F])/) do
|
|
355
|
+
char = [$1.hex].pack('C')
|
|
356
|
+
char.match?(/[a-zA-Z0-9]/) ? $& : char
|
|
357
|
+
end
|
|
358
|
+
label
|
|
359
|
+
end
|
|
360
|
+
|
|
322
361
|
end
|
data/lib/rdoc/token_stream.rb
CHANGED
|
@@ -45,13 +45,7 @@ module RDoc::TokenStream
|
|
|
45
45
|
then 'ruby-identifier'
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
if :on_comment == t[:kind] or :on_embdoc == t[:kind] or :on_heredoc_end == t[:kind]
|
|
50
|
-
comment_with_nl = true if "\n" == t[:text][-1]
|
|
51
|
-
text = t[:text].rstrip
|
|
52
|
-
else
|
|
53
|
-
text = t[:text]
|
|
54
|
-
end
|
|
48
|
+
text = t[:text]
|
|
55
49
|
|
|
56
50
|
if :on_ident == t[:kind] && starting_title
|
|
57
51
|
starting_title = false
|
|
@@ -65,7 +59,9 @@ module RDoc::TokenStream
|
|
|
65
59
|
text = CGI.escapeHTML text
|
|
66
60
|
|
|
67
61
|
if style then
|
|
68
|
-
|
|
62
|
+
end_with_newline = text.end_with?("\n")
|
|
63
|
+
text = text.chomp if end_with_newline
|
|
64
|
+
"<span class=\"#{style}\">#{text}</span>#{"\n" if end_with_newline}"
|
|
69
65
|
else
|
|
70
66
|
text
|
|
71
67
|
end
|
data/lib/rdoc/version.rb
CHANGED
data/rdoc.gemspec
CHANGED
|
@@ -38,10 +38,10 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
|
|
|
38
38
|
# for ruby core repository. It was generated by
|
|
39
39
|
# `git ls-files -z`.split("\x0").each {|f| puts " #{f.dump}," unless f.start_with?(*%W[test/ spec/ features/ .]) }
|
|
40
40
|
non_lib_files = [
|
|
41
|
-
"CONTRIBUTING.
|
|
41
|
+
"CONTRIBUTING.md",
|
|
42
42
|
"CVE-2013-0256.rdoc",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
43
|
+
"doc/markup_reference/markdown.md",
|
|
44
|
+
"doc/markup_reference/rdoc.rdoc",
|
|
45
45
|
"History.rdoc",
|
|
46
46
|
"LEGAL.rdoc",
|
|
47
47
|
"LICENSE.rdoc",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rdoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 7.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Hodel
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
- ITOYANAGI Sakura
|
|
14
14
|
bindir: exe
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date:
|
|
16
|
+
date: 2026-02-09 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: psych
|
|
@@ -73,10 +73,8 @@ executables:
|
|
|
73
73
|
- ri
|
|
74
74
|
extensions: []
|
|
75
75
|
extra_rdoc_files:
|
|
76
|
-
- CONTRIBUTING.
|
|
76
|
+
- CONTRIBUTING.md
|
|
77
77
|
- CVE-2013-0256.rdoc
|
|
78
|
-
- ExampleMarkdown.md
|
|
79
|
-
- ExampleRDoc.rdoc
|
|
80
78
|
- History.rdoc
|
|
81
79
|
- LEGAL.rdoc
|
|
82
80
|
- LICENSE.rdoc
|
|
@@ -84,16 +82,16 @@ extra_rdoc_files:
|
|
|
84
82
|
- RI.md
|
|
85
83
|
- TODO.rdoc
|
|
86
84
|
files:
|
|
87
|
-
- CONTRIBUTING.
|
|
85
|
+
- CONTRIBUTING.md
|
|
88
86
|
- CVE-2013-0256.rdoc
|
|
89
|
-
- ExampleMarkdown.md
|
|
90
|
-
- ExampleRDoc.rdoc
|
|
91
87
|
- History.rdoc
|
|
92
88
|
- LEGAL.rdoc
|
|
93
89
|
- LICENSE.rdoc
|
|
94
90
|
- README.md
|
|
95
91
|
- RI.md
|
|
96
92
|
- TODO.rdoc
|
|
93
|
+
- doc/markup_reference/markdown.md
|
|
94
|
+
- doc/markup_reference/rdoc.rdoc
|
|
97
95
|
- exe/rdoc
|
|
98
96
|
- exe/ri
|
|
99
97
|
- lib/rdoc.rb
|
|
@@ -152,8 +150,11 @@ files:
|
|
|
152
150
|
- lib/rdoc/generator/template/aliki/css/rdoc.css
|
|
153
151
|
- lib/rdoc/generator/template/aliki/index.rhtml
|
|
154
152
|
- lib/rdoc/generator/template/aliki/js/aliki.js
|
|
153
|
+
- lib/rdoc/generator/template/aliki/js/bash_highlighter.js
|
|
155
154
|
- lib/rdoc/generator/template/aliki/js/c_highlighter.js
|
|
156
|
-
- lib/rdoc/generator/template/aliki/js/
|
|
155
|
+
- lib/rdoc/generator/template/aliki/js/search_controller.js
|
|
156
|
+
- lib/rdoc/generator/template/aliki/js/search_navigation.js
|
|
157
|
+
- lib/rdoc/generator/template/aliki/js/search_ranker.js
|
|
157
158
|
- lib/rdoc/generator/template/aliki/js/theme-toggle.js
|
|
158
159
|
- lib/rdoc/generator/template/aliki/page.rhtml
|
|
159
160
|
- lib/rdoc/generator/template/aliki/servlet_not_found.rhtml
|
|
@@ -225,25 +226,22 @@ files:
|
|
|
225
226
|
- lib/rdoc/markdown/literals.kpeg
|
|
226
227
|
- lib/rdoc/markdown/literals.rb
|
|
227
228
|
- lib/rdoc/markup.rb
|
|
228
|
-
- lib/rdoc/markup/attr_changer.rb
|
|
229
|
-
- lib/rdoc/markup/attr_span.rb
|
|
230
|
-
- lib/rdoc/markup/attribute_manager.rb
|
|
231
|
-
- lib/rdoc/markup/attributes.rb
|
|
232
229
|
- lib/rdoc/markup/blank_line.rb
|
|
233
230
|
- lib/rdoc/markup/block_quote.rb
|
|
234
231
|
- lib/rdoc/markup/document.rb
|
|
232
|
+
- lib/rdoc/markup/element.rb
|
|
235
233
|
- lib/rdoc/markup/formatter.rb
|
|
236
234
|
- lib/rdoc/markup/hard_break.rb
|
|
237
235
|
- lib/rdoc/markup/heading.rb
|
|
238
236
|
- lib/rdoc/markup/include.rb
|
|
239
237
|
- lib/rdoc/markup/indented_paragraph.rb
|
|
238
|
+
- lib/rdoc/markup/inline_parser.rb
|
|
240
239
|
- lib/rdoc/markup/list.rb
|
|
241
240
|
- lib/rdoc/markup/list_item.rb
|
|
242
241
|
- lib/rdoc/markup/paragraph.rb
|
|
243
242
|
- lib/rdoc/markup/parser.rb
|
|
244
243
|
- lib/rdoc/markup/pre_process.rb
|
|
245
244
|
- lib/rdoc/markup/raw.rb
|
|
246
|
-
- lib/rdoc/markup/regexp_handling.rb
|
|
247
245
|
- lib/rdoc/markup/rule.rb
|
|
248
246
|
- lib/rdoc/markup/table.rb
|
|
249
247
|
- lib/rdoc/markup/to_ansi.rb
|
|
@@ -322,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
322
320
|
- !ruby/object:Gem::Version
|
|
323
321
|
version: '2.2'
|
|
324
322
|
requirements: []
|
|
325
|
-
rubygems_version:
|
|
323
|
+
rubygems_version: 4.0.3
|
|
326
324
|
specification_version: 4
|
|
327
325
|
summary: RDoc produces HTML and command-line documentation for Ruby projects
|
|
328
326
|
test_files: []
|