rdoc 7.0.3 → 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/README.md +70 -4
- data/doc/markup_reference/markdown.md +558 -0
- data/doc/markup_reference/rdoc.rdoc +1169 -0
- data/lib/rdoc/code_object/attr.rb +2 -1
- data/lib/rdoc/code_object/class_module.rb +24 -3
- data/lib/rdoc/code_object/context/section.rb +46 -9
- data/lib/rdoc/code_object/context.rb +15 -4
- data/lib/rdoc/code_object/mixin.rb +3 -0
- data/lib/rdoc/code_object/top_level.rb +2 -0
- data/lib/rdoc/comment.rb +1 -1
- data/lib/rdoc/cross_reference.rb +31 -24
- data/lib/rdoc/generator/template/aliki/_head.rhtml +5 -0
- data/lib/rdoc/generator/template/aliki/class.rhtml +8 -6
- data/lib/rdoc/generator/template/aliki/css/rdoc.css +48 -36
- data/lib/rdoc/generator/template/aliki/js/aliki.js +8 -2
- 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_controller.js +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +2 -0
- 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/formatter.rb +129 -106
- data/lib/rdoc/markup/heading.rb +101 -29
- data/lib/rdoc/markup/inline_parser.rb +312 -0
- data/lib/rdoc/markup/parser.rb +1 -1
- 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 +10 -32
- 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/text.rb +44 -5
- data/lib/rdoc/token_stream.rb +4 -8
- data/lib/rdoc/version.rb +1 -1
- data/rdoc.gemspec +2 -2
- metadata +7 -12
- 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
|
@@ -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/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
|
@@ -40,8 +40,8 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat
|
|
|
40
40
|
non_lib_files = [
|
|
41
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: 7.0
|
|
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
|
|
@@ -75,8 +75,6 @@ extensions: []
|
|
|
75
75
|
extra_rdoc_files:
|
|
76
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
|
|
@@ -86,14 +84,14 @@ extra_rdoc_files:
|
|
|
86
84
|
files:
|
|
87
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,6 +150,7 @@ 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
155
|
- lib/rdoc/generator/template/aliki/js/search_controller.js
|
|
157
156
|
- lib/rdoc/generator/template/aliki/js/search_navigation.js
|
|
@@ -227,10 +226,6 @@ files:
|
|
|
227
226
|
- lib/rdoc/markdown/literals.kpeg
|
|
228
227
|
- lib/rdoc/markdown/literals.rb
|
|
229
228
|
- lib/rdoc/markup.rb
|
|
230
|
-
- lib/rdoc/markup/attr_changer.rb
|
|
231
|
-
- lib/rdoc/markup/attr_span.rb
|
|
232
|
-
- lib/rdoc/markup/attribute_manager.rb
|
|
233
|
-
- lib/rdoc/markup/attributes.rb
|
|
234
229
|
- lib/rdoc/markup/blank_line.rb
|
|
235
230
|
- lib/rdoc/markup/block_quote.rb
|
|
236
231
|
- lib/rdoc/markup/document.rb
|
|
@@ -240,13 +235,13 @@ files:
|
|
|
240
235
|
- lib/rdoc/markup/heading.rb
|
|
241
236
|
- lib/rdoc/markup/include.rb
|
|
242
237
|
- lib/rdoc/markup/indented_paragraph.rb
|
|
238
|
+
- lib/rdoc/markup/inline_parser.rb
|
|
243
239
|
- lib/rdoc/markup/list.rb
|
|
244
240
|
- lib/rdoc/markup/list_item.rb
|
|
245
241
|
- lib/rdoc/markup/paragraph.rb
|
|
246
242
|
- lib/rdoc/markup/parser.rb
|
|
247
243
|
- lib/rdoc/markup/pre_process.rb
|
|
248
244
|
- lib/rdoc/markup/raw.rb
|
|
249
|
-
- lib/rdoc/markup/regexp_handling.rb
|
|
250
245
|
- lib/rdoc/markup/rule.rb
|
|
251
246
|
- lib/rdoc/markup/table.rb
|
|
252
247
|
- lib/rdoc/markup/to_ansi.rb
|
|
@@ -325,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
325
320
|
- !ruby/object:Gem::Version
|
|
326
321
|
version: '2.2'
|
|
327
322
|
requirements: []
|
|
328
|
-
rubygems_version:
|
|
323
|
+
rubygems_version: 4.0.3
|
|
329
324
|
specification_version: 4
|
|
330
325
|
summary: RDoc produces HTML and command-line documentation for Ruby projects
|
|
331
326
|
test_files: []
|
data/ExampleMarkdown.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Example Markdown
|
|
2
|
-
|
|
3
|
-
This document contains example output to show RDoc styling. This file was
|
|
4
|
-
created from a Markdown file.
|
|
5
|
-
|
|
6
|
-
For the following styles, see ExampleRDoc.rdoc for style examples:
|
|
7
|
-
|
|
8
|
-
* Headings
|
|
9
|
-
* Paragraphs
|
|
10
|
-
* Code blocks (verbatim sections)
|
|
11
|
-
* Definition lists
|
|
12
|
-
* Ordered lists
|
|
13
|
-
* Unordered lists
|
|
14
|
-
|
|
15
|
-
These items all use the same styles as RDoc format files.
|
|
16
|
-
|
|
17
|
-
## Footnotes
|
|
18
|
-
|
|
19
|
-
Footnotes are rendered at the bottom of the documentation section[^1]. For
|
|
20
|
-
pages this will be at the bottom of the page. For method documentation this
|
|
21
|
-
will be at the end of the current method.
|
|
22
|
-
|
|
23
|
-
[^1]: Here is the footnote content. As you can see it is at the bottom of the
|
|
24
|
-
page.
|
|
25
|
-
|
|
26
|
-
## Blockquotes
|
|
27
|
-
|
|
28
|
-
Here is how a blockquote looks.
|
|
29
|
-
|
|
30
|
-
> We finished our first sensor sweep of the neutral zone. Now, how the hell do
|
|
31
|
-
> we defeat an enemy that knows us better than we know ourselves? and attack
|
|
32
|
-
> the Romulans.
|
|
33
|
-
>
|
|
34
|
-
> > Sorry, Data. I guess it's better to be lucky than good. The unexpected is
|
|
35
|
-
> > our normal routine. Could someone survive inside a transporter buffer for
|
|
36
|
-
> > 75 years?
|
|
37
|
-
|
|
38
|
-
This text is from [Riker Ipsum](http://rikeripsum.com)
|
|
39
|
-
|