rdoc 6.5.0 → 6.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.rdoc +1 -1
- data/README.rdoc +2 -2
- data/TODO.rdoc +1 -1
- data/lib/rdoc/alias.rb +0 -1
- data/lib/rdoc/anon_class.rb +0 -1
- data/lib/rdoc/any_method.rb +15 -0
- data/lib/rdoc/attr.rb +0 -1
- data/lib/rdoc/class_module.rb +0 -1
- data/lib/rdoc/comment.rb +20 -41
- data/lib/rdoc/constant.rb +0 -1
- data/lib/rdoc/context/section.rb +0 -1
- data/lib/rdoc/context.rb +1 -1
- data/lib/rdoc/cross_reference.rb +3 -1
- data/lib/rdoc/encoding.rb +1 -17
- data/lib/rdoc/erb_partial.rb +0 -1
- data/lib/rdoc/erbio.rb +2 -7
- data/lib/rdoc/extend.rb +0 -1
- data/lib/rdoc/generator/darkfish.rb +2 -6
- data/lib/rdoc/generator/json_index.rb +2 -2
- data/lib/rdoc/generator/markup.rb +0 -1
- data/lib/rdoc/generator/pot.rb +1 -0
- data/lib/rdoc/generator/ri.rb +0 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +6 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +38 -13
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +13 -0
- data/lib/rdoc/generator/template/darkfish/js/search.js +3 -3
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +5 -4
- data/lib/rdoc/generator/template/json_index/js/navigation.js +8 -8
- data/lib/rdoc/ghost_method.rb +0 -1
- data/lib/rdoc/include.rb +0 -1
- data/lib/rdoc/markdown/entities.rb +0 -1
- data/lib/rdoc/markdown/literals.kpeg +0 -2
- data/lib/rdoc/markdown/literals.rb +66 -44
- data/lib/rdoc/markdown.kpeg +3 -3
- data/lib/rdoc/markdown.rb +7 -5
- data/lib/rdoc/markup/attr_changer.rb +0 -1
- data/lib/rdoc/markup/attr_span.rb +0 -1
- data/lib/rdoc/markup/attribute_manager.rb +14 -12
- data/lib/rdoc/markup/attributes.rb +0 -1
- data/lib/rdoc/markup/blank_line.rb +0 -1
- data/lib/rdoc/markup/block_quote.rb +0 -1
- data/lib/rdoc/markup/document.rb +0 -1
- data/lib/rdoc/markup/formatter.rb +1 -2
- data/lib/rdoc/markup/hard_break.rb +0 -1
- data/lib/rdoc/markup/heading.rb +0 -1
- data/lib/rdoc/markup/include.rb +0 -1
- data/lib/rdoc/markup/indented_paragraph.rb +0 -1
- data/lib/rdoc/markup/list.rb +0 -1
- data/lib/rdoc/markup/list_item.rb +0 -1
- data/lib/rdoc/markup/paragraph.rb +0 -1
- data/lib/rdoc/markup/parser.rb +5 -1
- data/lib/rdoc/markup/raw.rb +0 -1
- data/lib/rdoc/markup/regexp_handling.rb +0 -1
- data/lib/rdoc/markup/rule.rb +0 -1
- data/lib/rdoc/markup/table.rb +11 -2
- data/lib/rdoc/markup/to_ansi.rb +0 -1
- data/lib/rdoc/markup/to_bs.rb +25 -0
- data/lib/rdoc/markup/to_html.rb +7 -3
- data/lib/rdoc/markup/to_html_crossref.rb +13 -14
- data/lib/rdoc/markup/to_html_snippet.rb +3 -1
- data/lib/rdoc/markup/to_joined_paragraph.rb +2 -3
- data/lib/rdoc/markup/to_label.rb +0 -1
- data/lib/rdoc/markup/to_markdown.rb +4 -5
- data/lib/rdoc/markup/to_rdoc.rb +11 -4
- data/lib/rdoc/markup/to_table_of_contents.rb +0 -1
- data/lib/rdoc/markup/to_test.rb +0 -1
- data/lib/rdoc/markup/to_tt_only.rb +0 -1
- data/lib/rdoc/markup/verbatim.rb +0 -1
- data/lib/rdoc/meta_method.rb +0 -1
- data/lib/rdoc/method_attr.rb +0 -1
- data/lib/rdoc/mixin.rb +0 -1
- data/lib/rdoc/normal_class.rb +0 -1
- data/lib/rdoc/normal_module.rb +0 -1
- data/lib/rdoc/options.rb +4 -2
- data/lib/rdoc/parser/c.rb +33 -22
- data/lib/rdoc/parser/changelog.rb +15 -1
- data/lib/rdoc/parser/markdown.rb +0 -2
- data/lib/rdoc/parser/rd.rb +0 -1
- data/lib/rdoc/parser/ripper_state_lex.rb +11 -1
- data/lib/rdoc/parser/ruby.rb +18 -6
- data/lib/rdoc/parser/ruby_tools.rb +0 -2
- data/lib/rdoc/parser/text.rb +0 -1
- data/lib/rdoc/parser.rb +4 -2
- data/lib/rdoc/rd/block_parser.rb +650 -4
- data/lib/rdoc/rd/block_parser.ry +1 -1
- data/lib/rdoc/rd/inline.rb +0 -1
- data/lib/rdoc/rd/inline_parser.rb +649 -3
- data/lib/rdoc/rdoc.rb +2 -4
- data/lib/rdoc/require.rb +0 -1
- data/lib/rdoc/ri/driver.rb +10 -9
- data/lib/rdoc/ri/store.rb +0 -1
- data/lib/rdoc/single_class.rb +0 -1
- data/lib/rdoc/stats/quiet.rb +0 -1
- data/lib/rdoc/stats/verbose.rb +0 -2
- data/lib/rdoc/store.rb +29 -19
- data/lib/rdoc/task.rb +28 -2
- data/lib/rdoc/text.rb +10 -0
- data/lib/rdoc/token_stream.rb +1 -2
- data/lib/rdoc/top_level.rb +3 -1
- data/lib/rdoc/version.rb +1 -1
- data/lib/rdoc.rb +12 -0
- metadata +8 -8
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -34,9 +34,9 @@ class RDoc::RI::Driver
|
|
34
34
|
|
35
35
|
class NotFoundError < Error
|
36
36
|
|
37
|
-
def initialize(klass,
|
37
|
+
def initialize(klass, suggestion_proc = nil) # :nodoc:
|
38
38
|
@klass = klass
|
39
|
-
@
|
39
|
+
@suggestion_proc = suggestion_proc
|
40
40
|
end
|
41
41
|
|
42
42
|
##
|
@@ -48,8 +48,9 @@ class RDoc::RI::Driver
|
|
48
48
|
|
49
49
|
def message # :nodoc:
|
50
50
|
str = "Nothing known about #{@klass}"
|
51
|
-
|
52
|
-
|
51
|
+
suggestions = @suggestion_proc&.call
|
52
|
+
if suggestions and !suggestions.empty?
|
53
|
+
str += "\nDid you mean? #{suggestions.join("\n ")}"
|
53
54
|
end
|
54
55
|
str
|
55
56
|
end
|
@@ -948,8 +949,8 @@ or the PAGER environment variable.
|
|
948
949
|
ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z"))
|
949
950
|
if ary.length != 1 && ary.first != klass
|
950
951
|
if check_did_you_mean
|
951
|
-
|
952
|
-
raise NotFoundError.new(klass,
|
952
|
+
suggestion_proc = -> { DidYouMean::SpellChecker.new(dictionary: class_names).correct(klass) }
|
953
|
+
raise NotFoundError.new(klass, suggestion_proc)
|
953
954
|
else
|
954
955
|
raise NotFoundError, klass
|
955
956
|
end
|
@@ -1087,7 +1088,7 @@ or the PAGER environment variable.
|
|
1087
1088
|
|
1088
1089
|
loop do
|
1089
1090
|
name = if defined? Readline then
|
1090
|
-
Readline.readline ">> "
|
1091
|
+
Readline.readline ">> ", true
|
1091
1092
|
else
|
1092
1093
|
print ">> "
|
1093
1094
|
$stdin.gets
|
@@ -1237,8 +1238,8 @@ or the PAGER environment variable.
|
|
1237
1238
|
methods.push(*store.instance_methods[klass]) if [:instance, :both].include? types
|
1238
1239
|
end
|
1239
1240
|
methods = methods.uniq
|
1240
|
-
|
1241
|
-
raise NotFoundError.new(name,
|
1241
|
+
suggestion_proc = -> { DidYouMean::SpellChecker.new(dictionary: methods).correct(method_name) }
|
1242
|
+
raise NotFoundError.new(name, suggestion_proc)
|
1242
1243
|
else
|
1243
1244
|
raise NotFoundError, name
|
1244
1245
|
end
|
data/lib/rdoc/ri/store.rb
CHANGED
data/lib/rdoc/single_class.rb
CHANGED
data/lib/rdoc/stats/quiet.rb
CHANGED
data/lib/rdoc/stats/verbose.rb
CHANGED
data/lib/rdoc/store.rb
CHANGED
@@ -197,6 +197,9 @@ class RDoc::Store
|
|
197
197
|
top_level
|
198
198
|
end
|
199
199
|
|
200
|
+
##
|
201
|
+
# Sets the parser of +absolute_name+, unless it from a source code file.
|
202
|
+
|
200
203
|
def update_parser_of_file(absolute_name, parser)
|
201
204
|
if top_level = @files_hash[absolute_name] then
|
202
205
|
@text_files_hash[absolute_name] = top_level if top_level.text?
|
@@ -556,9 +559,7 @@ class RDoc::Store
|
|
556
559
|
def load_cache
|
557
560
|
#orig_enc = @encoding
|
558
561
|
|
559
|
-
|
560
|
-
@cache = Marshal.load io
|
561
|
-
end
|
562
|
+
@cache = marshal_load(cache_path)
|
562
563
|
|
563
564
|
load_enc = @cache[:encoding]
|
564
565
|
|
@@ -615,9 +616,7 @@ class RDoc::Store
|
|
615
616
|
def load_class_data klass_name
|
616
617
|
file = class_file klass_name
|
617
618
|
|
618
|
-
|
619
|
-
Marshal.load io
|
620
|
-
end
|
619
|
+
marshal_load(file)
|
621
620
|
rescue Errno::ENOENT => e
|
622
621
|
error = MissingFileError.new(self, file, klass_name)
|
623
622
|
error.set_backtrace e.backtrace
|
@@ -630,14 +629,10 @@ class RDoc::Store
|
|
630
629
|
def load_method klass_name, method_name
|
631
630
|
file = method_file klass_name, method_name
|
632
631
|
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
find_class_or_module(klass_name) || load_class(klass_name) unless
|
638
|
-
obj.parent
|
639
|
-
obj
|
640
|
-
end
|
632
|
+
obj = marshal_load(file)
|
633
|
+
obj.store = self
|
634
|
+
obj.parent ||= find_class_or_module(klass_name) || load_class(klass_name)
|
635
|
+
obj
|
641
636
|
rescue Errno::ENOENT => e
|
642
637
|
error = MissingFileError.new(self, file, klass_name + method_name)
|
643
638
|
error.set_backtrace e.backtrace
|
@@ -650,11 +645,9 @@ class RDoc::Store
|
|
650
645
|
def load_page page_name
|
651
646
|
file = page_file page_name
|
652
647
|
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
obj
|
657
|
-
end
|
648
|
+
obj = marshal_load(file)
|
649
|
+
obj.store = self
|
650
|
+
obj
|
658
651
|
rescue Errno::ENOENT => e
|
659
652
|
error = MissingFileError.new(self, file, page_name)
|
660
653
|
error.set_backtrace e.backtrace
|
@@ -976,4 +969,21 @@ class RDoc::Store
|
|
976
969
|
@unique_modules
|
977
970
|
end
|
978
971
|
|
972
|
+
private
|
973
|
+
def marshal_load(file)
|
974
|
+
File.open(file, 'rb') {|io| Marshal.load(io, MarshalFilter)}
|
975
|
+
end
|
976
|
+
|
977
|
+
MarshalFilter = proc do |obj|
|
978
|
+
case obj
|
979
|
+
when true, false, nil, Array, Class, Encoding, Hash, Integer, String, Symbol, RDoc::Text
|
980
|
+
else
|
981
|
+
unless obj.class.name.start_with?("RDoc::")
|
982
|
+
raise TypeError, "not permitted class: #{obj.class.name}"
|
983
|
+
end
|
984
|
+
end
|
985
|
+
obj
|
986
|
+
end
|
987
|
+
private_constant :MarshalFilter
|
988
|
+
|
979
989
|
end
|
data/lib/rdoc/task.rb
CHANGED
@@ -50,6 +50,9 @@ require 'rake/tasklib'
|
|
50
50
|
# [rerdoc]
|
51
51
|
# Rebuild the rdoc files from scratch, even if they are not out of date.
|
52
52
|
#
|
53
|
+
# [rdoc:coverage]
|
54
|
+
# Print RDoc coverage report for all rdoc files.
|
55
|
+
#
|
53
56
|
# Simple Example:
|
54
57
|
#
|
55
58
|
# require 'rdoc/task'
|
@@ -90,8 +93,8 @@ require 'rake/tasklib'
|
|
90
93
|
# RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean",
|
91
94
|
# :rerdoc => "rdoc:force")
|
92
95
|
#
|
93
|
-
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt
|
94
|
-
# <tt>:rdoc:force</tt>.
|
96
|
+
# This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc:clean</tt>,
|
97
|
+
# <tt>:rdoc:force</tt>, and <tt>:rdoc:coverage</tt>.
|
95
98
|
|
96
99
|
class RDoc::Task < Rake::TaskLib
|
97
100
|
|
@@ -248,6 +251,18 @@ class RDoc::Task < Rake::TaskLib
|
|
248
251
|
RDoc::RDoc.new.document args
|
249
252
|
end
|
250
253
|
|
254
|
+
namespace rdoc_task_name do
|
255
|
+
desc coverage_task_description
|
256
|
+
task coverage_task_name do
|
257
|
+
@before_running_rdoc.call if @before_running_rdoc
|
258
|
+
opts = option_list << "-C"
|
259
|
+
args = opts + @rdoc_files
|
260
|
+
|
261
|
+
$stderr.puts "rdoc #{args.join ' '}" if Rake.application.options.trace
|
262
|
+
RDoc::RDoc.new.document args
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
251
266
|
self
|
252
267
|
end
|
253
268
|
|
@@ -288,6 +303,13 @@ class RDoc::Task < Rake::TaskLib
|
|
288
303
|
"Rebuild RDoc HTML files"
|
289
304
|
end
|
290
305
|
|
306
|
+
##
|
307
|
+
# Task description for the coverage task or its renamed description
|
308
|
+
|
309
|
+
def coverage_task_description
|
310
|
+
"Print RDoc coverage report"
|
311
|
+
end
|
312
|
+
|
291
313
|
private
|
292
314
|
|
293
315
|
def rdoc_target
|
@@ -315,6 +337,10 @@ class RDoc::Task < Rake::TaskLib
|
|
315
337
|
end
|
316
338
|
end
|
317
339
|
|
340
|
+
def coverage_task_name
|
341
|
+
"coverage"
|
342
|
+
end
|
343
|
+
|
318
344
|
end
|
319
345
|
|
320
346
|
# :stopdoc:
|
data/lib/rdoc/text.rb
CHANGED
@@ -10,6 +10,10 @@ require 'strscan'
|
|
10
10
|
|
11
11
|
module RDoc::Text
|
12
12
|
|
13
|
+
##
|
14
|
+
# The language for this text. This affects stripping comments
|
15
|
+
# markers.
|
16
|
+
|
13
17
|
attr_accessor :language
|
14
18
|
|
15
19
|
##
|
@@ -309,4 +313,10 @@ module RDoc::Text
|
|
309
313
|
res.join.strip
|
310
314
|
end
|
311
315
|
|
316
|
+
##
|
317
|
+
# Character class to be separated by a space when concatenating
|
318
|
+
# lines.
|
319
|
+
|
320
|
+
SPACE_SEPARATED_LETTER_CLASS = /[\p{Nd}\p{Lc}\p{Pc}]|[!-~&&\W]/
|
321
|
+
|
312
322
|
end
|
data/lib/rdoc/token_stream.rb
CHANGED
@@ -112,8 +112,7 @@ module RDoc::TokenStream
|
|
112
112
|
# Returns a string representation of the token stream
|
113
113
|
|
114
114
|
def tokens_to_s
|
115
|
-
token_stream.compact.map { |token| token[:text] }.join ''
|
115
|
+
(token_stream or return '').compact.map { |token| token[:text] }.join ''
|
116
116
|
end
|
117
117
|
|
118
118
|
end
|
119
|
-
|
data/lib/rdoc/top_level.rb
CHANGED
@@ -52,6 +52,9 @@ class RDoc::TopLevel < RDoc::Context
|
|
52
52
|
@classes_or_modules = []
|
53
53
|
end
|
54
54
|
|
55
|
+
##
|
56
|
+
# Sets the parser for this toplevel context, also the store.
|
57
|
+
|
55
58
|
def parser=(val)
|
56
59
|
@parser = val
|
57
60
|
@store.update_parser_of_file(absolute_name, val) if @store
|
@@ -286,4 +289,3 @@ class RDoc::TopLevel < RDoc::Context
|
|
286
289
|
end
|
287
290
|
|
288
291
|
end
|
289
|
-
|
data/lib/rdoc/version.rb
CHANGED
data/lib/rdoc.rb
CHANGED
@@ -120,6 +120,17 @@ module RDoc
|
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
|
+
##
|
124
|
+
# Searches and returns the directory for settings.
|
125
|
+
#
|
126
|
+
# 1. <tt>$HOME/.rdoc</tt> directory, if it exists.
|
127
|
+
# 2. The +rdoc+ directory under the path specified by the
|
128
|
+
# +XDG_DATA_HOME+ environment variable, if it is set.
|
129
|
+
# 3. <tt>$HOME/.local/share/rdoc</tt> directory.
|
130
|
+
#
|
131
|
+
# Other than the home directory, the containing directory will be
|
132
|
+
# created automatically.
|
133
|
+
|
123
134
|
def self.home
|
124
135
|
rdoc_dir = begin
|
125
136
|
File.expand_path('~/.rdoc')
|
@@ -129,6 +140,7 @@ module RDoc
|
|
129
140
|
if File.directory?(rdoc_dir)
|
130
141
|
rdoc_dir
|
131
142
|
else
|
143
|
+
require 'fileutils'
|
132
144
|
begin
|
133
145
|
# XDG
|
134
146
|
xdg_data_home = ENV["XDG_DATA_HOME"] || File.join(File.expand_path("~"), '.local', 'share')
|
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: 6.
|
4
|
+
version: 6.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Hodel
|
@@ -11,10 +11,9 @@ authors:
|
|
11
11
|
- Zachary Scott
|
12
12
|
- Hiroshi SHIBATA
|
13
13
|
- ITOYANAGI Sakura
|
14
|
-
autorequire:
|
15
14
|
bindir: exe
|
16
15
|
cert_chain: []
|
17
|
-
date:
|
16
|
+
date: 2024-05-23 00:00:00.000000000 Z
|
18
17
|
dependencies:
|
19
18
|
- !ruby/object:Gem::Dependency
|
20
19
|
name: psych
|
@@ -249,8 +248,10 @@ files:
|
|
249
248
|
homepage: https://ruby.github.io/rdoc
|
250
249
|
licenses:
|
251
250
|
- Ruby
|
252
|
-
metadata:
|
253
|
-
|
251
|
+
metadata:
|
252
|
+
homepage_uri: https://ruby.github.io/rdoc
|
253
|
+
source_code_uri: https://github.com/ruby/rdoc
|
254
|
+
changelog_uri: https://github.com/ruby/rdoc/releases
|
254
255
|
rdoc_options:
|
255
256
|
- "--main"
|
256
257
|
- README.rdoc
|
@@ -260,15 +261,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
260
261
|
requirements:
|
261
262
|
- - ">="
|
262
263
|
- !ruby/object:Gem::Version
|
263
|
-
version: 2.
|
264
|
+
version: 2.6.0
|
264
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
265
266
|
requirements:
|
266
267
|
- - ">="
|
267
268
|
- !ruby/object:Gem::Version
|
268
269
|
version: '2.2'
|
269
270
|
requirements: []
|
270
|
-
rubygems_version: 3.
|
271
|
-
signing_key:
|
271
|
+
rubygems_version: 3.6.0.dev
|
272
272
|
specification_version: 4
|
273
273
|
summary: RDoc produces HTML and command-line documentation for Ruby projects
|
274
274
|
test_files: []
|