rdoc 5.1.0 → 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 +5 -5
- data/CONTRIBUTING.rdoc +5 -6
- data/ExampleMarkdown.md +2 -0
- data/ExampleRDoc.rdoc +2 -0
- data/History.rdoc +68 -66
- data/LEGAL.rdoc +1 -1
- data/LICENSE.rdoc +2 -0
- data/README.rdoc +18 -6
- data/RI.md +842 -0
- data/TODO.rdoc +8 -7
- data/exe/rdoc +0 -1
- data/lib/rdoc/{alias.rb → code_object/alias.rb} +4 -12
- data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +1 -2
- data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +83 -26
- data/lib/rdoc/{attr.rb → code_object/attr.rb} +5 -9
- data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +112 -24
- data/lib/rdoc/{constant.rb → code_object/constant.rb} +4 -5
- data/lib/rdoc/{context → code_object/context}/section.rb +13 -83
- data/lib/rdoc/{context.rb → code_object/context.rb} +69 -70
- data/lib/rdoc/{extend.rb → code_object/extend.rb} +1 -2
- data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +1 -2
- data/lib/rdoc/{include.rb → code_object/include.rb} +1 -2
- data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +1 -2
- data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +22 -31
- data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +1 -2
- data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +4 -5
- data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +2 -3
- data/lib/rdoc/{require.rb → code_object/require.rb} +2 -3
- data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +6 -2
- data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +22 -32
- data/lib/rdoc/code_object.rb +8 -41
- data/lib/rdoc/code_objects.rb +2 -3
- data/lib/rdoc/comment.rb +48 -41
- data/lib/rdoc/cross_reference.rb +77 -33
- data/lib/rdoc/encoding.rb +50 -38
- data/lib/rdoc/erb_partial.rb +2 -3
- data/lib/rdoc/erbio.rb +4 -5
- data/lib/rdoc/generator/darkfish.rb +178 -125
- data/lib/rdoc/generator/json_index.rb +9 -22
- data/lib/rdoc/generator/markup.rb +6 -17
- data/lib/rdoc/generator/pot/message_extractor.rb +4 -4
- data/lib/rdoc/generator/pot/po.rb +3 -3
- data/lib/rdoc/generator/pot/po_entry.rb +12 -12
- data/lib/rdoc/generator/pot.rb +4 -8
- data/lib/rdoc/generator/ri.rb +1 -2
- data/lib/rdoc/generator/template/darkfish/_footer.rhtml +2 -2
- data/lib/rdoc/generator/template/darkfish/_head.rhtml +35 -12
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +7 -7
- data/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +6 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +19 -10
- data/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +26 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +4 -9
- data/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +4 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +27 -6
- data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
- data/lib/rdoc/generator/template/darkfish/class.rhtml +125 -78
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +430 -339
- 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 +13 -13
- data/lib/rdoc/generator/template/darkfish/js/darkfish.js +51 -92
- data/lib/rdoc/generator/template/darkfish/js/search.js +35 -34
- data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
- data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
- data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +20 -18
- data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +32 -20
- data/lib/rdoc/generator/template/json_index/js/navigation.js +12 -49
- data/lib/rdoc/generator/template/json_index/js/searcher.js +6 -6
- data/lib/rdoc/generator.rb +6 -6
- data/lib/rdoc/i18n/locale.rb +1 -1
- data/lib/rdoc/i18n/text.rb +5 -5
- data/lib/rdoc/i18n.rb +4 -4
- data/lib/rdoc/known_classes.rb +6 -5
- data/lib/rdoc/markdown/entities.rb +1 -2
- data/lib/rdoc/markdown/literals.kpeg +1 -2
- data/lib/rdoc/markdown/literals.rb +99 -50
- data/lib/rdoc/markdown.kpeg +115 -58
- data/lib/rdoc/markdown.rb +1584 -902
- data/lib/rdoc/markup/attr_changer.rb +1 -2
- data/lib/rdoc/markup/attr_span.rb +9 -4
- data/lib/rdoc/markup/attribute_manager.rb +118 -57
- data/lib/rdoc/markup/attributes.rb +7 -8
- data/lib/rdoc/markup/blank_line.rb +1 -2
- data/lib/rdoc/markup/block_quote.rb +1 -2
- data/lib/rdoc/markup/document.rb +1 -2
- data/lib/rdoc/markup/formatter.rb +44 -37
- data/lib/rdoc/markup/hard_break.rb +1 -2
- data/lib/rdoc/markup/heading.rb +11 -6
- data/lib/rdoc/markup/include.rb +1 -2
- data/lib/rdoc/markup/indented_paragraph.rb +1 -2
- data/lib/rdoc/markup/list.rb +1 -2
- data/lib/rdoc/markup/list_item.rb +1 -2
- data/lib/rdoc/markup/paragraph.rb +1 -2
- data/lib/rdoc/markup/parser.rb +90 -48
- data/lib/rdoc/markup/pre_process.rb +38 -11
- data/lib/rdoc/markup/raw.rb +1 -2
- data/lib/rdoc/markup/regexp_handling.rb +40 -0
- data/lib/rdoc/markup/rule.rb +1 -2
- data/lib/rdoc/markup/table.rb +56 -0
- data/lib/rdoc/markup/to_ansi.rb +1 -2
- data/lib/rdoc/markup/to_bs.rb +30 -5
- data/lib/rdoc/markup/to_html.rb +95 -40
- data/lib/rdoc/markup/to_html_crossref.rb +108 -43
- data/lib/rdoc/markup/to_html_snippet.rb +13 -11
- data/lib/rdoc/markup/to_joined_paragraph.rb +6 -32
- data/lib/rdoc/markup/to_label.rb +11 -12
- data/lib/rdoc/markup/to_markdown.rb +13 -14
- data/lib/rdoc/markup/to_rdoc.rb +49 -31
- data/lib/rdoc/markup/to_table_of_contents.rb +2 -2
- data/lib/rdoc/markup/to_test.rb +1 -2
- data/lib/rdoc/markup/to_tt_only.rb +3 -4
- data/lib/rdoc/markup/verbatim.rb +1 -2
- data/lib/rdoc/markup.rb +64 -694
- data/lib/rdoc/options.rb +226 -44
- data/lib/rdoc/parser/c.rb +231 -246
- data/lib/rdoc/parser/changelog.rb +169 -23
- data/lib/rdoc/parser/markdown.rb +1 -3
- data/lib/rdoc/parser/prism_ruby.rb +1092 -0
- data/lib/rdoc/parser/rd.rb +1 -2
- data/lib/rdoc/parser/ripper_state_lex.rb +302 -0
- data/lib/rdoc/parser/ruby.rb +695 -478
- data/lib/rdoc/parser/ruby_tools.rb +33 -36
- data/lib/rdoc/parser/simple.rb +4 -4
- data/lib/rdoc/parser/text.rb +1 -2
- data/lib/rdoc/parser.rb +37 -42
- data/lib/rdoc/rd/block_parser.rb +708 -57
- data/lib/rdoc/rd/block_parser.ry +15 -11
- data/lib/rdoc/rd/inline.rb +5 -6
- data/lib/rdoc/rd/inline_parser.rb +787 -140
- data/lib/rdoc/rd/inline_parser.ry +1 -1
- data/lib/rdoc/rd.rb +4 -5
- data/lib/rdoc/rdoc.rb +72 -87
- data/lib/rdoc/ri/driver.rb +236 -152
- data/lib/rdoc/ri/formatter.rb +1 -1
- data/lib/rdoc/ri/paths.rb +4 -18
- data/lib/rdoc/ri/store.rb +1 -2
- data/lib/rdoc/ri/task.rb +2 -2
- data/lib/rdoc/ri.rb +5 -6
- data/lib/rdoc/rubygems_hook.rb +98 -20
- data/lib/rdoc/servlet.rb +30 -20
- data/lib/rdoc/stats/normal.rb +24 -18
- data/lib/rdoc/stats/quiet.rb +1 -2
- data/lib/rdoc/stats/verbose.rb +1 -3
- data/lib/rdoc/stats.rb +6 -7
- data/lib/rdoc/store.rb +84 -55
- data/lib/rdoc/task.rb +35 -10
- data/lib/rdoc/text.rb +40 -27
- data/lib/rdoc/token_stream.rb +56 -34
- data/lib/rdoc/tom_doc.rb +18 -19
- data/lib/rdoc/version.rb +10 -0
- data/lib/rdoc.rb +80 -56
- data/lib/rubygems_plugin.rb +23 -0
- data/man/ri.1 +247 -0
- metadata +45 -99
- data/.document +0 -5
- data/.gitignore +0 -13
- data/.travis.yml +0 -24
- data/Gemfile +0 -3
- data/RI.rdoc +0 -57
- data/Rakefile +0 -133
- data/bin/console +0 -7
- data/bin/setup +0 -6
- data/lib/gauntlet_rdoc.rb +0 -82
- 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/darkfish/js/jquery.js +0 -4
- data/lib/rdoc/generator/template/json_index/.document +0 -1
- data/lib/rdoc/markup/formatter_test_case.rb +0 -764
- data/lib/rdoc/markup/inline.rb +0 -2
- data/lib/rdoc/markup/special.rb +0 -41
- data/lib/rdoc/markup/text_formatter_test_case.rb +0 -115
- data/lib/rdoc/ruby_lex.rb +0 -1367
- data/lib/rdoc/ruby_token.rb +0 -461
- data/lib/rdoc/test_case.rb +0 -204
- data/rdoc.gemspec +0 -57
data/lib/rdoc/ri/formatter.rb
CHANGED
data/lib/rdoc/ri/paths.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative '../rdoc'
|
3
3
|
|
4
4
|
##
|
5
5
|
# The directories where ri data lives. Paths can be enumerated via ::each, or
|
@@ -12,23 +12,9 @@ module RDoc::RI::Paths
|
|
12
12
|
|
13
13
|
version = RbConfig::CONFIG['ruby_version']
|
14
14
|
|
15
|
-
BASE =
|
16
|
-
File.join RbConfig::CONFIG['ridir'], version
|
17
|
-
else
|
18
|
-
File.join RbConfig::CONFIG['datadir'], 'ri', version
|
19
|
-
end
|
15
|
+
BASE = File.join RbConfig::CONFIG['ridir'], version
|
20
16
|
|
21
|
-
|
22
|
-
File.expand_path('~')
|
23
|
-
rescue ArgumentError
|
24
|
-
end
|
25
|
-
|
26
|
-
homedir ||= ENV['HOME'] ||
|
27
|
-
ENV['USERPROFILE'] || ENV['HOMEPATH'] # for 1.8 compatibility
|
28
|
-
|
29
|
-
HOMEDIR = if homedir then
|
30
|
-
File.join homedir, ".rdoc"
|
31
|
-
end
|
17
|
+
HOMEDIR = RDoc.home
|
32
18
|
#:startdoc:
|
33
19
|
|
34
20
|
##
|
data/lib/rdoc/ri/store.rb
CHANGED
data/lib/rdoc/ri/task.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
begin
|
3
3
|
gem 'rdoc'
|
4
4
|
rescue Gem::LoadError
|
5
5
|
end unless defined?(RDoc)
|
6
6
|
|
7
|
-
|
7
|
+
require_relative '../task'
|
8
8
|
|
9
9
|
##
|
10
10
|
# RDoc::RI::Task creates ri data in <code>./.rdoc</code> for your project.
|
data/lib/rdoc/ri.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
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,15 +1,21 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
require 'rubygems/user_interaction'
|
3
3
|
require 'fileutils'
|
4
|
-
|
4
|
+
require_relative '../rdoc'
|
5
5
|
|
6
|
-
|
7
|
-
# Gem::RDoc provides methods to generate RDoc and ri data for installed gems
|
8
|
-
# upon gem installation.
|
6
|
+
# We define the following two similar name classes in this file:
|
9
7
|
#
|
10
|
-
#
|
8
|
+
# - RDoc::RubyGemsHook
|
9
|
+
# - RDoc::RubygemsHook
|
10
|
+
#
|
11
|
+
# RDoc::RubyGemsHook is the main class that has real logic.
|
12
|
+
#
|
13
|
+
# RDoc::RubygemsHook is a class that is only for
|
14
|
+
# compatibility. RDoc::RubygemsHook is used by RubyGems directly. We
|
15
|
+
# can remove this when all maintained RubyGems remove
|
16
|
+
# `rubygems/rdoc.rb`.
|
11
17
|
|
12
|
-
class RDoc::
|
18
|
+
class RDoc::RubyGemsHook
|
13
19
|
|
14
20
|
include Gem::UserInteraction
|
15
21
|
extend Gem::UserInteraction
|
@@ -45,7 +51,7 @@ class RDoc::RubygemsHook
|
|
45
51
|
# Post installs hook that generates documentation for each specification in
|
46
52
|
# +specs+
|
47
53
|
|
48
|
-
def self.
|
54
|
+
def self.generate installer, specs
|
49
55
|
start = Time.now
|
50
56
|
types = installer.document
|
51
57
|
|
@@ -64,13 +70,17 @@ class RDoc::RubygemsHook
|
|
64
70
|
say "Done installing documentation for #{names} after #{duration} seconds"
|
65
71
|
end
|
66
72
|
|
73
|
+
def self.remove uninstaller
|
74
|
+
new(uninstaller.spec).remove
|
75
|
+
end
|
76
|
+
|
67
77
|
##
|
68
78
|
# Loads the RDoc generator
|
69
79
|
|
70
80
|
def self.load_rdoc
|
71
81
|
return if @rdoc_version
|
72
82
|
|
73
|
-
|
83
|
+
require_relative 'rdoc'
|
74
84
|
|
75
85
|
@rdoc_version = Gem::Version.new ::RDoc::VERSION
|
76
86
|
end
|
@@ -120,7 +130,9 @@ class RDoc::RubygemsHook
|
|
120
130
|
options.exclude ||= [] # TODO maybe move to RDoc::Options#finish
|
121
131
|
options.setup_generator generator
|
122
132
|
options.op_dir = destination
|
123
|
-
|
133
|
+
Dir.chdir @spec.full_gem_path do
|
134
|
+
options.finish
|
135
|
+
end
|
124
136
|
|
125
137
|
generator = options.generator.new @rdoc.store, options
|
126
138
|
|
@@ -158,7 +170,7 @@ class RDoc::RubygemsHook
|
|
158
170
|
|
159
171
|
case config_args = Gem.configuration[:rdoc]
|
160
172
|
when String then
|
161
|
-
args = args.concat config_args.split
|
173
|
+
args = args.concat config_args.split(' ')
|
162
174
|
when Array then
|
163
175
|
args = args.concat config_args
|
164
176
|
end
|
@@ -169,20 +181,14 @@ class RDoc::RubygemsHook
|
|
169
181
|
options = ::RDoc::Options.new
|
170
182
|
options.default_title = "#{@spec.full_name} Documentation"
|
171
183
|
options.parse args
|
184
|
+
options.quiet = !Gem.configuration.really_verbose
|
185
|
+
options.finish
|
172
186
|
end
|
173
187
|
|
174
|
-
options.quiet = !Gem.configuration.really_verbose
|
175
|
-
|
176
188
|
@rdoc = new_rdoc
|
177
189
|
@rdoc.options = options
|
178
190
|
|
179
|
-
store = RDoc::Store.new
|
180
|
-
store.encoding = options.encoding
|
181
|
-
store.dry_run = options.dry_run
|
182
|
-
store.main = options.main_page
|
183
|
-
store.title = options.title
|
184
|
-
|
185
|
-
@rdoc.store = store
|
191
|
+
@rdoc.store = RDoc::Store.new(options)
|
186
192
|
|
187
193
|
say "Parsing documentation for #{@spec.full_name}"
|
188
194
|
|
@@ -244,3 +250,75 @@ class RDoc::RubygemsHook
|
|
244
250
|
end
|
245
251
|
|
246
252
|
end
|
253
|
+
|
254
|
+
# This class is referenced by RubyGems to create documents.
|
255
|
+
# All implementations are moved to the above RubyGemsHook.
|
256
|
+
#
|
257
|
+
# This class does nothing when this RDoc is installed as a normal gem
|
258
|
+
# or a bundled gem.
|
259
|
+
#
|
260
|
+
# This class does generate/remove documents for compatibility when
|
261
|
+
# this RDoc is installed as a default gem.
|
262
|
+
#
|
263
|
+
# We can remove this when all maintained RubyGems remove
|
264
|
+
# `rubygems/rdoc.rb`.
|
265
|
+
module RDoc
|
266
|
+
class RubygemsHook
|
267
|
+
|
268
|
+
attr_accessor :generate_rdoc, :generate_ri, :force
|
269
|
+
|
270
|
+
def self.default_gem?
|
271
|
+
!File.exist?(File.join(__dir__, "..", "rubygems_plugin.rb"))
|
272
|
+
end
|
273
|
+
|
274
|
+
def initialize(spec, generate_rdoc = false, generate_ri = true)
|
275
|
+
@spec = spec
|
276
|
+
@generate_rdoc = generate_rdoc
|
277
|
+
@generate_ri = generate_ri
|
278
|
+
@force = false
|
279
|
+
end
|
280
|
+
|
281
|
+
def generate
|
282
|
+
# Do nothing if this is NOT a default gem.
|
283
|
+
return unless self.class.default_gem?
|
284
|
+
|
285
|
+
# Generate document for compatibility if this is a default gem.
|
286
|
+
hook = RubyGemsHook.new(@spec, @generate_rdoc, @generate_ri)
|
287
|
+
hook.force = @force
|
288
|
+
hook.generate
|
289
|
+
end
|
290
|
+
|
291
|
+
def remove
|
292
|
+
# Do nothing if this is NOT a default gem.
|
293
|
+
return unless self.class.default_gem?
|
294
|
+
|
295
|
+
# Remove generated document for compatibility if this is a
|
296
|
+
# default gem.
|
297
|
+
RubyGemsHook.new(@spec).remove
|
298
|
+
end
|
299
|
+
|
300
|
+
def self.generation_hook installer, specs
|
301
|
+
# Do nothing if this is NOT a default gem.
|
302
|
+
return unless default_gem?
|
303
|
+
|
304
|
+
# Generate document for compatibility if this is a default gem.
|
305
|
+
RubyGemsHook.generate(installer, specs)
|
306
|
+
end
|
307
|
+
|
308
|
+
def self.load_rdoc
|
309
|
+
RubyGemsHook.load_rdoc
|
310
|
+
end
|
311
|
+
|
312
|
+
def self.rdoc_version
|
313
|
+
RubyGemsHook.rdoc_version
|
314
|
+
end
|
315
|
+
|
316
|
+
def rdoc_installed?
|
317
|
+
RubyGemsHook.new(@spec).rdoc_installed?
|
318
|
+
end
|
319
|
+
|
320
|
+
def ri_installed?
|
321
|
+
RubyGemsHook.new(@spec).ri_installed?
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
data/lib/rdoc/servlet.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative '../rdoc'
|
3
|
+
require 'erb'
|
3
4
|
require 'time'
|
4
5
|
require 'json'
|
5
|
-
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'webrick'
|
9
|
+
rescue LoadError
|
10
|
+
abort "webrick is not found. You may need to `gem install webrick` to install webrick."
|
11
|
+
end
|
6
12
|
|
7
13
|
##
|
8
14
|
# This is a WEBrick servlet that allows you to browse ri documentation.
|
@@ -101,9 +107,9 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
101
107
|
res.body = File.read asset_path
|
102
108
|
|
103
109
|
res.content_type = case req.path
|
104
|
-
when /
|
105
|
-
when /
|
106
|
-
else
|
110
|
+
when /\.css\z/ then 'text/css'
|
111
|
+
when /\.js\z/ then 'application/javascript'
|
112
|
+
else 'application/octet-stream'
|
107
113
|
end
|
108
114
|
end
|
109
115
|
|
@@ -111,7 +117,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
111
117
|
# GET request entry point. Fills in +res+ for the path, etc. in +req+.
|
112
118
|
|
113
119
|
def do_GET req, res
|
114
|
-
req.path.sub!(
|
120
|
+
req.path.sub!(/\A#{Regexp.escape @mount_path}/, '') if @mount_path
|
115
121
|
|
116
122
|
case req.path
|
117
123
|
when '/' then
|
@@ -127,7 +133,7 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
127
133
|
show_documentation req, res
|
128
134
|
end
|
129
135
|
rescue WEBrick::HTTPStatus::NotFound => e
|
130
|
-
generator = generator_for RDoc::Store.new
|
136
|
+
generator = generator_for RDoc::Store.new(@options)
|
131
137
|
|
132
138
|
not_found generator, req, res, e.message
|
133
139
|
rescue WEBrick::HTTPStatus::Status
|
@@ -144,11 +150,14 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
|
|
144
150
|
# +generator+ is used to create the page.
|
145
151
|
|
146
152
|
def documentation_page store, generator, path, req, res
|
147
|
-
|
153
|
+
text_name = path.chomp '.html'
|
154
|
+
name = text_name.gsub '/', '::'
|
148
155
|
|
149
156
|
if klass = store.find_class_or_module(name) then
|
150
157
|
res.body = generator.generate_class klass
|
151
|
-
elsif page = store.find_text_page(name.sub(/_([^_]*)
|
158
|
+
elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then
|
159
|
+
res.body = generator.generate_page page
|
160
|
+
elsif page = store.find_text_page(text_name.sub(/_([^_]*)\z/, '.\1')) then
|
152
161
|
res.body = generator.generate_page page
|
153
162
|
else
|
154
163
|
not_found generator, req, res
|
@@ -217,7 +226,7 @@ exception:
|
|
217
226
|
<pre>#{ERB::Util.html_escape exception.message}</pre>
|
218
227
|
|
219
228
|
<p>Please report this to the
|
220
|
-
<a href="https://github.com/
|
229
|
+
<a href="https://github.com/ruby/rdoc/issues">RDoc issues tracker</a>. Please
|
221
230
|
include the RDoc version, the URI above and exception class, message and
|
222
231
|
backtrace. If you're viewing a gem's documentation, include the gem name and
|
223
232
|
version. If you're viewing Ruby's documentation, include the version of ruby.
|
@@ -238,6 +247,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
238
247
|
generator = RDoc::Generator::Darkfish.new store, @options
|
239
248
|
generator.file_output = false
|
240
249
|
generator.asset_rel_path = '..'
|
250
|
+
generator.setup
|
241
251
|
|
242
252
|
rdoc = RDoc::RDoc.new
|
243
253
|
rdoc.store = store
|
@@ -281,7 +291,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
281
291
|
def installed_docs
|
282
292
|
extra_counter = 0
|
283
293
|
ri_paths.map do |path, type|
|
284
|
-
store = RDoc::Store.new path, type
|
294
|
+
store = RDoc::Store.new(@options, path: path, type: type)
|
285
295
|
exists = File.exist? store.cache_path
|
286
296
|
|
287
297
|
case type
|
@@ -410,15 +420,15 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
410
420
|
def store_for source_name
|
411
421
|
case source_name
|
412
422
|
when 'home' then
|
413
|
-
RDoc::Store.new RDoc::RI::Paths.home_dir, :home
|
423
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.home_dir, type: :home)
|
414
424
|
when 'ruby' then
|
415
|
-
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
|
425
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.system_dir, type: :system)
|
416
426
|
when 'site' then
|
417
|
-
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
|
418
|
-
when
|
427
|
+
RDoc::Store.new(@options, path: RDoc::RI::Paths.site_dir, type: :site)
|
428
|
+
when /\Aextra-(\d+)\z/ then
|
419
429
|
index = $1.to_i - 1
|
420
430
|
ri_dir = installed_docs[index][4]
|
421
|
-
RDoc::Store.new ri_dir, :extra
|
431
|
+
RDoc::Store.new(@options, path: ri_dir, type: :extra)
|
422
432
|
else
|
423
433
|
ri_dir, type = ri_paths.find do |dir, dir_type|
|
424
434
|
next unless dir_type == :gem
|
@@ -427,14 +437,14 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
|
|
427
437
|
end
|
428
438
|
|
429
439
|
raise WEBrick::HTTPStatus::NotFound,
|
430
|
-
"Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
|
440
|
+
"Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir
|
431
441
|
|
432
|
-
store = RDoc::Store.new ri_dir, type
|
442
|
+
store = RDoc::Store.new(@options, path: ri_dir, type: type)
|
433
443
|
|
434
444
|
return store if File.exist? store.cache_path
|
435
445
|
|
436
446
|
raise WEBrick::HTTPStatus::NotFound,
|
437
|
-
"Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
|
447
|
+
"Could not find documentation for \"#{ERB::Util.html_escape(source_name)}\". Please run `gem rdoc --ri gem_name`"
|
438
448
|
|
439
449
|
end
|
440
450
|
end
|
data/lib/rdoc/stats/normal.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
# frozen_string_literal:
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
begin
|
3
|
+
require 'io/console/size'
|
4
|
+
rescue LoadError
|
5
|
+
# for JRuby
|
6
|
+
require 'io/console'
|
7
|
+
end
|
3
8
|
|
4
9
|
##
|
5
10
|
# Stats printer that prints just the files being documented with a progress
|
@@ -21,27 +26,28 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
|
|
21
26
|
files_so_far,
|
22
27
|
@num_files)
|
23
28
|
|
24
|
-
# Print a progress bar, but make sure it fits on a single line. Filename
|
25
|
-
# will be truncated if necessary.
|
26
|
-
terminal_width = IO.console_size[1].to_i.nonzero? || 80
|
27
|
-
max_filename_size = terminal_width - progress_bar.size
|
28
|
-
|
29
|
-
if filename.size > max_filename_size then
|
30
|
-
# Turn "some_long_filename.rb" to "...ong_filename.rb"
|
31
|
-
filename = filename[(filename.size - max_filename_size) .. -1]
|
32
|
-
filename[0..2] = "..."
|
33
|
-
end
|
34
|
-
|
35
|
-
line = "#{progress_bar}#{filename}"
|
36
29
|
if $stdout.tty?
|
30
|
+
# Print a progress bar, but make sure it fits on a single line. Filename
|
31
|
+
# will be truncated if necessary.
|
32
|
+
size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize
|
33
|
+
terminal_width = size[1].to_i.nonzero? || 80
|
34
|
+
max_filename_size = (terminal_width - progress_bar.size) - 1
|
35
|
+
|
36
|
+
if filename.size > max_filename_size then
|
37
|
+
# Turn "some_long_filename.rb" to "...ong_filename.rb"
|
38
|
+
filename = filename[(filename.size - max_filename_size) .. -1]
|
39
|
+
filename[0..2] = "..."
|
40
|
+
end
|
41
|
+
|
37
42
|
# Clean the line with whitespaces so that leftover output from the
|
38
43
|
# previous line doesn't show up.
|
39
|
-
$stdout.print("\r
|
40
|
-
@last_width =
|
41
|
-
|
44
|
+
$stdout.print("\r\e[K") if @last_width && @last_width > 0
|
45
|
+
@last_width = progress_bar.size + filename.size
|
46
|
+
term = "\r"
|
42
47
|
else
|
43
|
-
|
48
|
+
term = "\n"
|
44
49
|
end
|
50
|
+
$stdout.print(progress_bar, filename, term)
|
45
51
|
$stdout.flush
|
46
52
|
end
|
47
53
|
|
data/lib/rdoc/stats/quiet.rb
CHANGED
data/lib/rdoc/stats/verbose.rb
CHANGED
data/lib/rdoc/stats.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
##
|
3
3
|
# RDoc statistics collector which prints a summary and report of a project's
|
4
4
|
# documentation totals.
|
@@ -261,7 +261,7 @@ class RDoc::Stats
|
|
261
261
|
|
262
262
|
report = []
|
263
263
|
|
264
|
-
cm.
|
264
|
+
cm.attributes.each do |attr|
|
265
265
|
next if attr.documented?
|
266
266
|
line = attr.line ? ":#{attr.line}" : nil
|
267
267
|
report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
|
@@ -331,7 +331,7 @@ class RDoc::Stats
|
|
331
331
|
|
332
332
|
report = []
|
333
333
|
|
334
|
-
cm.
|
334
|
+
cm.constants.each do |constant|
|
335
335
|
# TODO constant aliases are listed in the summary but not reported
|
336
336
|
# figure out what to do here
|
337
337
|
next if constant.documented? || constant.is_alias_for
|
@@ -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
|
-
|