rdoc 6.3.3 → 6.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTING.rdoc +1 -2
- data/LEGAL.rdoc +1 -1
- data/exe/rdoc +0 -1
- data/lib/rdoc/any_method.rb +6 -3
- data/lib/rdoc/code_objects.rb +1 -2
- data/lib/rdoc/context/section.rb +2 -0
- data/lib/rdoc/context.rb +1 -3
- data/lib/rdoc/cross_reference.rb +44 -20
- data/lib/rdoc/generator/darkfish.rb +2 -2
- data/lib/rdoc/generator/markup.rb +1 -1
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +11 -13
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +27 -3
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +22 -2
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +25 -4
- data/lib/rdoc/generator/template/darkfish/class.rhtml +22 -20
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +24 -1
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +1 -1
- data/lib/rdoc/generator/template/darkfish/js/search.js +1 -1
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +2 -2
- data/lib/rdoc/generator.rb +5 -5
- data/lib/rdoc/i18n.rb +1 -1
- data/lib/rdoc/known_classes.rb +5 -4
- data/lib/rdoc/markdown/literals.rb +24 -8
- data/lib/rdoc/markdown.kpeg +25 -18
- data/lib/rdoc/markdown.rb +323 -226
- data/lib/rdoc/markup/attribute_manager.rb +29 -35
- data/lib/rdoc/markup/parser.rb +12 -6
- data/lib/rdoc/markup/pre_process.rb +2 -0
- data/lib/rdoc/markup/to_html.rb +20 -16
- data/lib/rdoc/markup/to_label.rb +1 -1
- data/lib/rdoc/markup/to_rdoc.rb +3 -20
- data/lib/rdoc/markup.rb +35 -667
- data/lib/rdoc/method_attr.rb +1 -1
- data/lib/rdoc/normal_class.rb +1 -1
- data/lib/rdoc/normal_module.rb +1 -1
- data/lib/rdoc/options.rb +63 -19
- data/lib/rdoc/parser/c.rb +110 -110
- data/lib/rdoc/parser/ruby.rb +43 -10
- data/lib/rdoc/parser.rb +19 -2
- data/lib/rdoc/rd/block_parser.rb +13 -9
- data/lib/rdoc/rd/block_parser.ry +12 -8
- data/lib/rdoc/rd/inline_parser.rb +1 -1
- data/lib/rdoc/rd.rb +3 -4
- data/lib/rdoc/rdoc.rb +19 -33
- data/lib/rdoc/ri/driver.rb +22 -82
- data/lib/rdoc/ri.rb +4 -5
- data/lib/rdoc/rubygems_hook.rb +4 -2
- data/lib/rdoc/servlet.rb +1 -1
- data/lib/rdoc/single_class.rb +5 -0
- data/lib/rdoc/stats.rb +3 -4
- data/lib/rdoc/store.rb +4 -4
- data/lib/rdoc/task.rb +3 -3
- data/lib/rdoc/text.rb +12 -4
- data/lib/rdoc/version.rb +3 -1
- data/lib/rdoc.rb +46 -46
- metadata +9 -14
- data/Gemfile +0 -12
- data/Rakefile +0 -101
- data/bin/console +0 -7
- data/bin/setup +0 -6
- data/rdoc.gemspec +0 -249
data/lib/rdoc/parser.rb
CHANGED
@@ -263,9 +263,26 @@ class RDoc::Parser
|
|
263
263
|
@preprocess.options = @options
|
264
264
|
end
|
265
265
|
|
266
|
-
autoload :RubyTools,
|
267
|
-
autoload :Text,
|
266
|
+
autoload :RubyTools, "#{__dir__}/parser/ruby_tools"
|
267
|
+
autoload :Text, "#{__dir__}/parser/text"
|
268
268
|
|
269
|
+
##
|
270
|
+
# Normalizes tabs in +body+
|
271
|
+
|
272
|
+
def handle_tab_width(body)
|
273
|
+
if /\t/ =~ body
|
274
|
+
tab_width = @options.tab_width
|
275
|
+
body.split(/\n/).map do |line|
|
276
|
+
1 while line.gsub!(/\t+/) do
|
277
|
+
b, e = $~.offset(0)
|
278
|
+
' ' * (tab_width * (e-b) - b % tab_width)
|
279
|
+
end
|
280
|
+
line
|
281
|
+
end.join "\n"
|
282
|
+
else
|
283
|
+
body
|
284
|
+
end
|
285
|
+
end
|
269
286
|
end
|
270
287
|
|
271
288
|
# simple must come first in order to show up last in the parsers list
|
data/lib/rdoc/rd/block_parser.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# DO NOT MODIFY!!!!
|
4
|
-
# This file is automatically generated by Racc 1.
|
4
|
+
# This file is automatically generated by Racc 1.6.0
|
5
5
|
# from Racc grammar file "".
|
6
6
|
#
|
7
7
|
|
@@ -18,8 +18,6 @@ class BlockParser < Racc::Parser
|
|
18
18
|
|
19
19
|
# :stopdoc:
|
20
20
|
|
21
|
-
TMPFILE = ["rdtmp", $$, 0]
|
22
|
-
|
23
21
|
MARK_TO_LEVEL = {
|
24
22
|
'=' => 1,
|
25
23
|
'==' => 2,
|
@@ -129,15 +127,19 @@ def next_token # :nodoc:
|
|
129
127
|
# non-RD part begin
|
130
128
|
when /^=begin\s+(\w+)/
|
131
129
|
part = $1
|
130
|
+
=begin # not imported to RDoc
|
132
131
|
if @in_part # if in non-RD part
|
133
132
|
@part_content.push(line)
|
134
133
|
else
|
135
134
|
@in_part = part if @tree.filter[part] # if filter exists
|
136
135
|
# p "BEGIN_PART: #{@in_part}" # DEBUG
|
137
136
|
end
|
137
|
+
=end
|
138
|
+
@in_part = part
|
138
139
|
# non-RD part end
|
139
|
-
when /^=end/
|
140
|
+
when /^=end(?:$|[\s\0\C-d\C-z])/
|
140
141
|
if @in_part # if in non-RD part
|
142
|
+
=begin # not imported to RDoc
|
141
143
|
# p "END_PART: #{@in_part}" # DEBUG
|
142
144
|
# make Part-in object
|
143
145
|
part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r")
|
@@ -148,20 +150,22 @@ def next_token # :nodoc:
|
|
148
150
|
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
|
149
151
|
subtree = parse_subtree(part_out.to_a)
|
150
152
|
else # if output is target formatted
|
151
|
-
basename =
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
tmpfile.close
|
153
|
+
basename = Tempfile.create(["rdtmp", ".#{@in_part}"], @tree.tmp_dir) do |tmpfile|
|
154
|
+
tmpfile.print(part_out)
|
155
|
+
File.basename(tmpfile.path)
|
156
|
+
end
|
156
157
|
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
157
158
|
end
|
158
159
|
@in_part = nil
|
159
160
|
return [:SUBTREE, subtree]
|
161
|
+
=end
|
160
162
|
end
|
161
163
|
else
|
164
|
+
=begin # not imported to RDoc
|
162
165
|
if @in_part # if in non-RD part
|
163
166
|
@part_content.push(line)
|
164
167
|
end
|
168
|
+
=end
|
165
169
|
end
|
166
170
|
end
|
167
171
|
|
data/lib/rdoc/rd/block_parser.ry
CHANGED
@@ -230,8 +230,6 @@ end
|
|
230
230
|
|
231
231
|
# :stopdoc:
|
232
232
|
|
233
|
-
TMPFILE = ["rdtmp", $$, 0]
|
234
|
-
|
235
233
|
MARK_TO_LEVEL = {
|
236
234
|
'=' => 1,
|
237
235
|
'==' => 2,
|
@@ -341,15 +339,19 @@ def next_token # :nodoc:
|
|
341
339
|
# non-RD part begin
|
342
340
|
when /^=begin\s+(\w+)/
|
343
341
|
part = $1
|
342
|
+
=begin # not imported to RDoc
|
344
343
|
if @in_part # if in non-RD part
|
345
344
|
@part_content.push(line)
|
346
345
|
else
|
347
346
|
@in_part = part if @tree.filter[part] # if filter exists
|
348
347
|
# p "BEGIN_PART: #{@in_part}" # DEBUG
|
349
348
|
end
|
349
|
+
=end
|
350
|
+
@in_part = part
|
350
351
|
# non-RD part end
|
351
|
-
when /^=end/
|
352
|
+
when /^=end(?:$|[\s\0\C-d\C-z])/
|
352
353
|
if @in_part # if in non-RD part
|
354
|
+
=begin # not imported to RDoc
|
353
355
|
# p "END_PART: #{@in_part}" # DEBUG
|
354
356
|
# make Part-in object
|
355
357
|
part = RDoc::RD::Part.new(@part_content.join(""), @tree, "r")
|
@@ -360,20 +362,22 @@ def next_token # :nodoc:
|
|
360
362
|
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
|
361
363
|
subtree = parse_subtree(part_out.to_a)
|
362
364
|
else # if output is target formatted
|
363
|
-
basename =
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
tmpfile.close
|
365
|
+
basename = Tempfile.create(["rdtmp", ".#{@in_part}"], @tree.tmp_dir) do |tmpfile|
|
366
|
+
tmpfile.print(part_out)
|
367
|
+
File.basename(tmpfile.path)
|
368
|
+
end
|
368
369
|
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
|
369
370
|
end
|
370
371
|
@in_part = nil
|
371
372
|
return [:SUBTREE, subtree]
|
373
|
+
=end
|
372
374
|
end
|
373
375
|
else
|
376
|
+
=begin # not imported to RDoc
|
374
377
|
if @in_part # if in non-RD part
|
375
378
|
@part_content.push(line)
|
376
379
|
end
|
380
|
+
=end
|
377
381
|
end
|
378
382
|
end
|
379
383
|
|
data/lib/rdoc/rd.rb
CHANGED
@@ -92,9 +92,8 @@ class RDoc::RD
|
|
92
92
|
document
|
93
93
|
end
|
94
94
|
|
95
|
-
autoload :BlockParser,
|
96
|
-
autoload :InlineParser,
|
97
|
-
autoload :Inline,
|
95
|
+
autoload :BlockParser, "#{__dir__}/rd/block_parser"
|
96
|
+
autoload :InlineParser, "#{__dir__}/rd/inline_parser"
|
97
|
+
autoload :Inline, "#{__dir__}/rd/inline"
|
98
98
|
|
99
99
|
end
|
100
|
-
|
data/lib/rdoc/rdoc.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative '../rdoc'
|
3
3
|
|
4
4
|
require 'find'
|
5
5
|
require 'fileutils'
|
@@ -14,7 +14,7 @@ require 'time'
|
|
14
14
|
# is:
|
15
15
|
#
|
16
16
|
# rdoc = RDoc::RDoc.new
|
17
|
-
# options =
|
17
|
+
# options = RDoc::Options.load_options # returns an RDoc::Options instance
|
18
18
|
# # set extra options
|
19
19
|
# rdoc.document options
|
20
20
|
#
|
@@ -35,6 +35,17 @@ class RDoc::RDoc
|
|
35
35
|
|
36
36
|
GENERATORS = {}
|
37
37
|
|
38
|
+
##
|
39
|
+
# List of directory names always skipped
|
40
|
+
|
41
|
+
UNCONDITIONALLY_SKIPPED_DIRECTORIES = %w[CVS .svn .git].freeze
|
42
|
+
|
43
|
+
##
|
44
|
+
# List of directory names skipped if test suites should be skipped
|
45
|
+
|
46
|
+
TEST_SUITE_DIRECTORY_NAMES = %w[spec test].freeze
|
47
|
+
|
48
|
+
|
38
49
|
##
|
39
50
|
# Generator instance used for creating output
|
40
51
|
|
@@ -151,34 +162,6 @@ class RDoc::RDoc
|
|
151
162
|
end
|
152
163
|
end
|
153
164
|
|
154
|
-
##
|
155
|
-
# Loads options from .rdoc_options if the file exists, otherwise creates a
|
156
|
-
# new RDoc::Options instance.
|
157
|
-
|
158
|
-
def load_options
|
159
|
-
options_file = File.expand_path '.rdoc_options'
|
160
|
-
return RDoc::Options.new unless File.exist? options_file
|
161
|
-
|
162
|
-
RDoc.load_yaml
|
163
|
-
|
164
|
-
begin
|
165
|
-
options = YAML.load_file '.rdoc_options'
|
166
|
-
rescue Psych::SyntaxError
|
167
|
-
end
|
168
|
-
|
169
|
-
return RDoc::Options.new if options == false # Allow empty file.
|
170
|
-
|
171
|
-
raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
|
172
|
-
RDoc::Options === options or Hash === options
|
173
|
-
|
174
|
-
if Hash === options
|
175
|
-
# Override the default values with the contents of YAML file.
|
176
|
-
options = RDoc::Options.new options
|
177
|
-
end
|
178
|
-
|
179
|
-
options
|
180
|
-
end
|
181
|
-
|
182
165
|
##
|
183
166
|
# Create an output dir if it doesn't exist. If it does exist, but doesn't
|
184
167
|
# contain the flag file <tt>created.rid</tt> then we refuse to use it, as
|
@@ -308,7 +291,10 @@ option)
|
|
308
291
|
file_list[rel_file_name] = mtime
|
309
292
|
end
|
310
293
|
when "directory" then
|
311
|
-
next if rel_file_name
|
294
|
+
next if UNCONDITIONALLY_SKIPPED_DIRECTORIES.include?(rel_file_name)
|
295
|
+
|
296
|
+
basename = File.basename(rel_file_name)
|
297
|
+
next if options.skip_tests && TEST_SUITE_DIRECTORY_NAMES.include?(basename)
|
312
298
|
|
313
299
|
created_rid = File.join rel_file_name, "created.rid"
|
314
300
|
next if File.file? created_rid
|
@@ -468,11 +454,11 @@ The internal error was:
|
|
468
454
|
|
469
455
|
if RDoc::Options === options then
|
470
456
|
@options = options
|
471
|
-
@options.finish
|
472
457
|
else
|
473
|
-
@options = load_options
|
458
|
+
@options = RDoc::Options.load_options
|
474
459
|
@options.parse options
|
475
460
|
end
|
461
|
+
@options.finish
|
476
462
|
|
477
463
|
if @options.pipe then
|
478
464
|
handle_pipe
|
data/lib/rdoc/ri/driver.rb
CHANGED
@@ -1,23 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require 'abbrev'
|
3
2
|
require 'optparse'
|
4
3
|
|
5
|
-
|
6
|
-
require 'readline'
|
7
|
-
rescue LoadError
|
8
|
-
end
|
9
|
-
|
10
|
-
begin
|
11
|
-
require 'win32console'
|
12
|
-
rescue LoadError
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'rdoc'
|
16
|
-
|
17
|
-
##
|
18
|
-
# For RubyGems backwards compatibility
|
4
|
+
require_relative '../../rdoc'
|
19
5
|
|
20
|
-
require_relative 'formatter'
|
6
|
+
require_relative 'formatter' # For RubyGems backwards compatibility
|
7
|
+
# TODO: Fix weird documentation with `require_relative`
|
21
8
|
|
22
9
|
##
|
23
10
|
# The RI driver implements the command-line ri tool.
|
@@ -142,6 +129,8 @@ Where name can be:
|
|
142
129
|
|
143
130
|
gem_name: | gem_name:README | gem_name:History
|
144
131
|
|
132
|
+
ruby: | ruby:NEWS | ruby:globals
|
133
|
+
|
145
134
|
All class names may be abbreviated to their minimum unambiguous form.
|
146
135
|
If a name is ambiguous, all valid options will be listed.
|
147
136
|
|
@@ -153,6 +142,10 @@ they're contained in. If the gem name is followed by a ':' all files in the
|
|
153
142
|
gem will be shown. The file name extension may be omitted where it is
|
154
143
|
unambiguous.
|
155
144
|
|
145
|
+
'ruby' can be used as a pseudo gem name to display files from the Ruby
|
146
|
+
core documentation. Use 'ruby:' by itself to get a list of all available
|
147
|
+
core documentation files.
|
148
|
+
|
156
149
|
For example:
|
157
150
|
|
158
151
|
#{opt.program_name} Fil
|
@@ -160,6 +153,7 @@ For example:
|
|
160
153
|
#{opt.program_name} File.new
|
161
154
|
#{opt.program_name} zip
|
162
155
|
#{opt.program_name} rdoc:README
|
156
|
+
#{opt.program_name} ruby:comments
|
163
157
|
|
164
158
|
Note that shell quoting or escaping may be required for method names
|
165
159
|
containing punctuation:
|
@@ -426,9 +420,6 @@ or the PAGER environment variable.
|
|
426
420
|
@use_stdout = options[:use_stdout]
|
427
421
|
@show_all = options[:show_all]
|
428
422
|
@width = options[:width]
|
429
|
-
|
430
|
-
# pager process for jruby
|
431
|
-
@jruby_pager_process = nil
|
432
423
|
end
|
433
424
|
|
434
425
|
##
|
@@ -609,11 +600,11 @@ or the PAGER environment variable.
|
|
609
600
|
|
610
601
|
stores = classes[current]
|
611
602
|
|
612
|
-
|
603
|
+
next unless stores and not stores.empty?
|
613
604
|
|
614
|
-
klasses = stores.
|
615
|
-
store.ancestors[current]
|
616
|
-
end.
|
605
|
+
klasses = stores.flat_map do |store|
|
606
|
+
store.ancestors[current] || []
|
607
|
+
end.uniq
|
617
608
|
|
618
609
|
klasses = klasses - seen
|
619
610
|
|
@@ -1044,36 +1035,6 @@ or the PAGER environment variable.
|
|
1044
1035
|
self
|
1045
1036
|
end
|
1046
1037
|
|
1047
|
-
##
|
1048
|
-
# Finds the given +pager+ for jruby. Returns an IO if +pager+ was found.
|
1049
|
-
#
|
1050
|
-
# Returns false if +pager+ does not exist.
|
1051
|
-
#
|
1052
|
-
# Returns nil if the jruby JVM doesn't support ProcessBuilder redirection
|
1053
|
-
# (1.6 and older).
|
1054
|
-
|
1055
|
-
def find_pager_jruby pager
|
1056
|
-
require 'java'
|
1057
|
-
require 'shellwords'
|
1058
|
-
|
1059
|
-
return nil unless java.lang.ProcessBuilder.constants.include? :Redirect
|
1060
|
-
|
1061
|
-
pager = Shellwords.split pager
|
1062
|
-
|
1063
|
-
pb = java.lang.ProcessBuilder.new(*pager)
|
1064
|
-
pb = pb.redirect_output java.lang.ProcessBuilder::Redirect::INHERIT
|
1065
|
-
|
1066
|
-
@jruby_pager_process = pb.start
|
1067
|
-
|
1068
|
-
input = @jruby_pager_process.output_stream
|
1069
|
-
|
1070
|
-
io = input.to_io
|
1071
|
-
io.sync = true
|
1072
|
-
io
|
1073
|
-
rescue java.io.IOException
|
1074
|
-
false
|
1075
|
-
end
|
1076
|
-
|
1077
1038
|
##
|
1078
1039
|
# Finds a store that matches +name+ which can be the name of a gem, "ruby",
|
1079
1040
|
# "home" or "site".
|
@@ -1113,6 +1074,10 @@ or the PAGER environment variable.
|
|
1113
1074
|
def interactive
|
1114
1075
|
puts "\nEnter the method name you want to look up."
|
1115
1076
|
|
1077
|
+
begin
|
1078
|
+
require 'readline'
|
1079
|
+
rescue LoadError
|
1080
|
+
end
|
1116
1081
|
if defined? Readline then
|
1117
1082
|
Readline.completion_proc = method :complete
|
1118
1083
|
puts "You can use tab to autocomplete."
|
@@ -1141,17 +1106,6 @@ or the PAGER environment variable.
|
|
1141
1106
|
exit
|
1142
1107
|
end
|
1143
1108
|
|
1144
|
-
##
|
1145
|
-
# Is +file+ in ENV['PATH']?
|
1146
|
-
|
1147
|
-
def in_path? file
|
1148
|
-
return true if file =~ %r%\A/% and File.exist? file
|
1149
|
-
|
1150
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|
|
1151
|
-
File.exist? File.join(path, file)
|
1152
|
-
end
|
1153
|
-
end
|
1154
|
-
|
1155
1109
|
##
|
1156
1110
|
# Lists classes known to ri starting with +names+. If +names+ is empty all
|
1157
1111
|
# known classes are shown.
|
@@ -1346,7 +1300,6 @@ or the PAGER environment variable.
|
|
1346
1300
|
yield pager
|
1347
1301
|
ensure
|
1348
1302
|
pager.close
|
1349
|
-
@jruby_pager_process.wait_for if @jruby_pager_process
|
1350
1303
|
end
|
1351
1304
|
else
|
1352
1305
|
yield $stdout
|
@@ -1514,27 +1467,14 @@ or the PAGER environment variable.
|
|
1514
1467
|
def setup_pager
|
1515
1468
|
return if @use_stdout
|
1516
1469
|
|
1517
|
-
jruby = RUBY_ENGINE == 'jruby'
|
1518
|
-
|
1519
1470
|
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
|
1520
1471
|
|
1472
|
+
require 'shellwords'
|
1521
1473
|
pagers.compact.uniq.each do |pager|
|
1522
|
-
|
1523
|
-
|
1524
|
-
pager_cmd = pager.split(' ').first
|
1525
|
-
|
1526
|
-
next unless in_path? pager_cmd
|
1527
|
-
|
1528
|
-
if jruby then
|
1529
|
-
case io = find_pager_jruby(pager)
|
1530
|
-
when nil then break
|
1531
|
-
when false then next
|
1532
|
-
else io
|
1533
|
-
end
|
1534
|
-
else
|
1535
|
-
io = IO.popen(pager, 'w') rescue next
|
1536
|
-
end
|
1474
|
+
pager = Shellwords.split(pager)
|
1475
|
+
next if pager.empty?
|
1537
1476
|
|
1477
|
+
io = IO.popen(pager, 'w') rescue next
|
1538
1478
|
next if $? and $?.pid == io.pid and $?.exited? # pager didn't work
|
1539
1479
|
|
1540
1480
|
@paging = true
|
data/lib/rdoc/ri.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative '../rdoc'
|
3
3
|
|
4
4
|
##
|
5
5
|
# Namespace for the ri command line tool's implementation.
|
@@ -13,9 +13,8 @@ module RDoc::RI
|
|
13
13
|
|
14
14
|
class Error < RDoc::Error; end
|
15
15
|
|
16
|
-
autoload :Driver,
|
17
|
-
autoload :Paths,
|
18
|
-
autoload :Store,
|
16
|
+
autoload :Driver, "#{__dir__}/ri/driver"
|
17
|
+
autoload :Paths, "#{__dir__}/ri/paths"
|
18
|
+
autoload :Store, "#{__dir__}/ri/store"
|
19
19
|
|
20
20
|
end
|
21
|
-
|
data/lib/rdoc/rubygems_hook.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require 'rubygems/user_interaction'
|
3
3
|
require 'fileutils'
|
4
|
-
|
4
|
+
require_relative '../rdoc'
|
5
5
|
|
6
6
|
##
|
7
7
|
# Gem::RDoc provides methods to generate RDoc and ri data for installed gems
|
@@ -120,7 +120,9 @@ class RDoc::RubygemsHook
|
|
120
120
|
options.exclude ||= [] # TODO maybe move to RDoc::Options#finish
|
121
121
|
options.setup_generator generator
|
122
122
|
options.op_dir = destination
|
123
|
-
|
123
|
+
Dir.chdir @spec.full_gem_path do
|
124
|
+
options.finish
|
125
|
+
end
|
124
126
|
|
125
127
|
generator = options.generator.new @rdoc.store, options
|
126
128
|
|
data/lib/rdoc/servlet.rb
CHANGED
data/lib/rdoc/single_class.rb
CHANGED
data/lib/rdoc/stats.rb
CHANGED
@@ -454,9 +454,8 @@ class RDoc::Stats
|
|
454
454
|
[params.length, undoc]
|
455
455
|
end
|
456
456
|
|
457
|
-
autoload :Quiet,
|
458
|
-
autoload :Normal,
|
459
|
-
autoload :Verbose,
|
457
|
+
autoload :Quiet, "#{__dir__}/stats/quiet"
|
458
|
+
autoload :Normal, "#{__dir__}/stats/normal"
|
459
|
+
autoload :Verbose, "#{__dir__}/stats/verbose"
|
460
460
|
|
461
461
|
end
|
462
|
-
|
data/lib/rdoc/store.rb
CHANGED
@@ -557,7 +557,7 @@ class RDoc::Store
|
|
557
557
|
#orig_enc = @encoding
|
558
558
|
|
559
559
|
File.open cache_path, 'rb' do |io|
|
560
|
-
@cache = Marshal.load io
|
560
|
+
@cache = Marshal.load io
|
561
561
|
end
|
562
562
|
|
563
563
|
load_enc = @cache[:encoding]
|
@@ -616,7 +616,7 @@ class RDoc::Store
|
|
616
616
|
file = class_file klass_name
|
617
617
|
|
618
618
|
File.open file, 'rb' do |io|
|
619
|
-
Marshal.load io
|
619
|
+
Marshal.load io
|
620
620
|
end
|
621
621
|
rescue Errno::ENOENT => e
|
622
622
|
error = MissingFileError.new(self, file, klass_name)
|
@@ -631,7 +631,7 @@ class RDoc::Store
|
|
631
631
|
file = method_file klass_name, method_name
|
632
632
|
|
633
633
|
File.open file, 'rb' do |io|
|
634
|
-
obj = Marshal.load io
|
634
|
+
obj = Marshal.load io
|
635
635
|
obj.store = self
|
636
636
|
obj.parent =
|
637
637
|
find_class_or_module(klass_name) || load_class(klass_name) unless
|
@@ -651,7 +651,7 @@ class RDoc::Store
|
|
651
651
|
file = page_file page_name
|
652
652
|
|
653
653
|
File.open file, 'rb' do |io|
|
654
|
-
obj = Marshal.load io
|
654
|
+
obj = Marshal.load io
|
655
655
|
obj.store = self
|
656
656
|
obj
|
657
657
|
end
|
data/lib/rdoc/task.rb
CHANGED
@@ -32,7 +32,7 @@ begin
|
|
32
32
|
rescue Gem::LoadError
|
33
33
|
end unless defined?(Rake)
|
34
34
|
|
35
|
-
|
35
|
+
require_relative '../rdoc'
|
36
36
|
require 'rake'
|
37
37
|
require 'rake/tasklib'
|
38
38
|
|
@@ -71,7 +71,7 @@ require 'rake/tasklib'
|
|
71
71
|
# require 'rdoc/task'
|
72
72
|
#
|
73
73
|
# RDoc::Task.new :rdoc_dev do |rdoc|
|
74
|
-
# rdoc.main = "README.
|
74
|
+
# rdoc.main = "README.rdoc"
|
75
75
|
# rdoc.rdoc_files.include("README.rdoc", "lib/**/*.rb")
|
76
76
|
# rdoc.options << "--all"
|
77
77
|
# end
|
@@ -323,7 +323,7 @@ module Rake
|
|
323
323
|
##
|
324
324
|
# For backwards compatibility
|
325
325
|
|
326
|
-
RDocTask = RDoc::Task
|
326
|
+
RDocTask = RDoc::Task # :nodoc:
|
327
327
|
|
328
328
|
end
|
329
329
|
# :startdoc:
|
data/lib/rdoc/text.rb
CHANGED
@@ -218,10 +218,10 @@ module RDoc::Text
|
|
218
218
|
when s.scan(/\.\.\.(\.?)/) then
|
219
219
|
html << s[1] << encoded[:ellipsis]
|
220
220
|
after_word = nil
|
221
|
-
when s.scan(/\(c\)/) then
|
221
|
+
when s.scan(/\(c\)/i) then
|
222
222
|
html << encoded[:copyright]
|
223
223
|
after_word = nil
|
224
|
-
when s.scan(/\(r\)/) then
|
224
|
+
when s.scan(/\(r\)/i) then
|
225
225
|
html << encoded[:trademark]
|
226
226
|
after_word = nil
|
227
227
|
when s.scan(/---/) then
|
@@ -237,10 +237,18 @@ module RDoc::Text
|
|
237
237
|
when s.scan(/``/) then # backtick double quote
|
238
238
|
html << encoded[:open_dquote]
|
239
239
|
after_word = nil
|
240
|
-
when s.scan(/'
|
240
|
+
when s.scan(/(?:'|'){2}/) then # tick double quote
|
241
241
|
html << encoded[:close_dquote]
|
242
242
|
after_word = nil
|
243
|
-
when s.scan(
|
243
|
+
when s.scan(/`/) then # backtick
|
244
|
+
if insquotes or after_word
|
245
|
+
html << '`'
|
246
|
+
after_word = false
|
247
|
+
else
|
248
|
+
html << encoded[:open_squote]
|
249
|
+
insquotes = true
|
250
|
+
end
|
251
|
+
when s.scan(/'|'/) then # single quote
|
244
252
|
if insquotes
|
245
253
|
html << encoded[:close_squote]
|
246
254
|
insquotes = false
|