summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/code_objects.rb3
-rw-r--r--lib/rdoc/context.rb4
-rw-r--r--lib/rdoc/context/section.rb2
-rw-r--r--lib/rdoc/cross_reference.rb18
-rw-r--r--lib/rdoc/generator.rb10
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml30
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml22
-rw-r--r--lib/rdoc/generator/template/darkfish/css/rdoc.css25
-rw-r--r--lib/rdoc/i18n.rb2
-rw-r--r--lib/rdoc/markdown.rb85
-rw-r--r--lib/rdoc/markdown/literals.rb32
-rw-r--r--lib/rdoc/markup.rb77
-rw-r--r--lib/rdoc/markup/attribute_manager.rb33
-rw-r--r--lib/rdoc/markup/to_html.rb6
-rw-r--r--lib/rdoc/markup/to_label.rb2
-rw-r--r--lib/rdoc/method_attr.rb2
-rw-r--r--lib/rdoc/normal_class.rb2
-rw-r--r--lib/rdoc/normal_module.rb2
-rw-r--r--lib/rdoc/options.rb39
-rw-r--r--lib/rdoc/parser.rb4
-rw-r--r--lib/rdoc/parser/c.rb140
-rw-r--r--lib/rdoc/parser/ruby.rb25
-rw-r--r--lib/rdoc/rd.rb7
-rw-r--r--lib/rdoc/rd/block_parser.rb2
-rw-r--r--lib/rdoc/rd/inline_parser.rb2
-rw-r--r--lib/rdoc/rdoc.rb4
-rw-r--r--lib/rdoc/ri.rb9
-rw-r--r--lib/rdoc/ri/driver.rb8
-rw-r--r--lib/rdoc/rubygems_hook.rb2
-rw-r--r--lib/rdoc/servlet.rb2
-rw-r--r--lib/rdoc/single_class.rb5
-rw-r--r--lib/rdoc/stats.rb7
-rw-r--r--lib/rdoc/store.rb8
-rw-r--r--lib/rdoc/task.rb4
-rw-r--r--lib/rdoc/version.rb2
35 files changed, 357 insertions, 270 deletions
diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb
index 434a25ac7f..d5f2f920ad 100644
--- a/lib/rdoc/code_objects.rb
+++ b/lib/rdoc/code_objects.rb
@@ -2,5 +2,4 @@
# This file was used to load all the RDoc::CodeObject subclasses at once. Now
# autoload handles this.
-require 'rdoc'
-
+require_relative '../rdoc'
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index b3caa53aa1..c6edfb473c 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -1,6 +1,4 @@
# frozen_string_literal: true
-require 'cgi'
-
##
# A Context is something that can hold modules, classes, methods, attributes,
# aliases, requires, and includes. Classes, modules, and files are all
@@ -1261,6 +1259,6 @@ class RDoc::Context < RDoc::CodeObject
klass
end
- autoload :Section, 'rdoc/context/section'
+ autoload :Section, "#{__dir__}/context/section"
end
diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb
index 5fef4a9ffc..c316efe99f 100644
--- a/lib/rdoc/context/section.rb
+++ b/lib/rdoc/context/section.rb
@@ -1,4 +1,6 @@
# frozen_string_literal: true
+require 'cgi/util'
+
##
# A section of documentation like:
#
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index ef8e21bde8..319bbc02ac 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -1,4 +1,7 @@
# frozen_string_literal: true
+
+require_relative 'markup/attribute_manager' # for PROTECT_ATTR
+
##
# RDoc::CrossReference is a reusable way to create cross references for names.
@@ -15,11 +18,24 @@ class RDoc::CrossReference
CLASS_REGEXP_STR = '\\\\?((?:\:{2})?[A-Z]\w*(?:\:\:\w+)*)'
##
+ # Regular expression to match a single method argument.
+
+ METHOD_ARG_REGEXP_STR = '[\w.+*/=<>-]+'
+
+ ##
+ # Regular expression to match method arguments.
+
+ METHOD_ARGS_REGEXP_STR = /(?:\((?:#{METHOD_ARG_REGEXP_STR}(?:,\s*#{METHOD_ARG_REGEXP_STR})*)?\))?/.source
+
+ ##
# Regular expression to match method references.
#
# See CLASS_REGEXP_STR
- METHOD_REGEXP_STR = '([A-Za-z]\w*[!?=]?|%|===?|\[\]=?|<<|>>|\+@|-@|-|\+|\*)(?:\([\w.+*/=<>-]*\))?'
+ METHOD_REGEXP_STR = /(
+ (?!\d)[\w#{RDoc::Markup::AttributeManager::PROTECT_ATTR}]+[!?=]?|
+ %|=(?:==?|~)|![=~]|\[\]=?|<(?:<|=>?)?|>[>=]?|[-+!]@?|\*\*?|[\/%\`|&^~]
+ )#{METHOD_ARGS_REGEXP_STR}/.source.delete("\n ").freeze
##
# Regular expressions matching text that should potentially have
diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb
index 340dcbf7ae..a769cf8ac0 100644
--- a/lib/rdoc/generator.rb
+++ b/lib/rdoc/generator.rb
@@ -41,11 +41,11 @@
module RDoc::Generator
- autoload :Markup, 'rdoc/generator/markup'
+ autoload :Markup, "#{__dir__}/generator/markup"
- autoload :Darkfish, 'rdoc/generator/darkfish'
- autoload :JsonIndex, 'rdoc/generator/json_index'
- autoload :RI, 'rdoc/generator/ri'
- autoload :POT, 'rdoc/generator/pot'
+ autoload :Darkfish, "#{__dir__}/generator/darkfish"
+ autoload :JsonIndex, "#{__dir__}/generator/json_index"
+ autoload :RI, "#{__dir__}/generator/ri"
+ autoload :POT, "#{__dir__}/generator/pot"
end
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
index 530f25c762..d3d8da4017 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
@@ -1,9 +1,33 @@
<div id="classindex-section" class="nav-section">
<h3>Class and Module Index</h3>
+ <%-
+ all_classes = @classes.group_by do |klass|
+ klass.full_name[/\A[^:]++(?:::[^:]++(?=::))*+(?=::[^:]*+\z)/]
+ end.delete_if do |_, klasses|
+ !klasses.any?(&:display?)
+ end
+ link = proc do |index_klass, display = index_klass.display?|
+ if display
+ -%><code><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.name %></a></code><%-
+ else
+ -%><code><%= index_klass.name %></code><%-
+ end
+ end
+ if top = all_classes[nil]
+ solo = top.one? {|klass| klass.display?}
+ traverse = proc do |klasses| -%>
<ul class="link-list">
- <%- @modsort.each do |index_klass| -%>
- <li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a>
+ <%- klasses.each do |index_klass| -%>
+ <%- if children = all_classes[index_klass.full_name] -%>
+ <li><details<% if solo; solo = false %> open<% end %>><summary><% link.call(index_klass) %></summary>
+ <%- traverse.call(children) -%>
+ </ul></details>
+ <%- elsif index_klass.display? -%>
+ <li><% link.call(index_klass, true) %>
+ <%- end -%>
+ <%- end -%>
+ <%- end -%>
+ <%- traverse.call(top) -%>
<%- end -%>
- </ul>
</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
index 8ec83abda2..0ed683ca14 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
@@ -1,11 +1,31 @@
<%- simple_files = @files.select { |f| f.text? } %>
+<%- if defined?(current) -%>
+ <%- dir = current.full_name[%r{\A[^/]+(?=/)}] || current.page_name -%>
+<%- end -%>
<%- unless simple_files.empty? then -%>
<div id="fileindex-section" class="nav-section">
<h3>Pages</h3>
<ul class="link-list">
- <%- simple_files.each do |f| -%>
+ <%- simple_files.group_by do |f| -%>
+ <%- f.full_name[%r{\A[^/]+(?=/)}] || f.page_name -%>
+ <%- end.each do |n, files| -%>
+ <%- f = files.shift -%>
+ <%- if files.empty? -%>
<li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
+ <%- next -%>
+ <%- end -%>
+ <li><details<% if dir == n %> open<% end %>><summary><%
+ if n == f.page_name
+ %><a href="<%= rel_prefix %>/<%= f.path %>"><%= h n %></a><%
+ else
+ %><%= h n %><% files.unshift(f)
+ end %></summary>
+ <ul class="link-list">
+ <%- files.each do |f| -%>
+ <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
+ <%- end -%>
+ </ul></details>
<%- end -%>
</ul>
</div>
diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css
index ebe2e93af6..1be815f503 100644
--- a/lib/rdoc/generator/template/darkfish/css/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css
@@ -186,6 +186,10 @@ nav {
font-family: Helvetica, sans-serif;
font-size: 14px;
border-right: 1px solid #ccc;
+ position: sticky;
+ top: 0;
+ overflow: auto;
+ height: calc(100vh - 100px); /* reduce the footer height */
}
main {
@@ -305,6 +309,25 @@ dl.note-list dt {
background: url(../images/arrow_up.png) no-repeat right center;
}
+.nav-section details summary {
+ display: block;
+}
+
+.nav-section details summary::-webkit-details-marker {
+ display: none;
+}
+
+.nav-section details summary:before {
+ content: "";
+}
+
+.nav-section details summary:after {
+ content: " \25B6"; /* BLACK RIGHT-POINTING TRIANGLE */
+}
+.nav-section details[open] > summary:after {
+ content: " \25BD"; /* WHITE DOWN-POINTING TRIANGLE */
+}
+
/* @end */
/* @group Documentation Section */
@@ -482,7 +505,7 @@ main header h3 {
main .method-source-code {
max-height: 0;
- overflow: hidden;
+ overflow: auto;
transition-duration: 200ms;
transition-delay: 0ms;
transition-property: all;
diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb
index a32fd848a0..f209a9a6f6 100644
--- a/lib/rdoc/i18n.rb
+++ b/lib/rdoc/i18n.rb
@@ -4,7 +4,7 @@
module RDoc::I18n
- autoload :Locale, 'rdoc/i18n/locale'
+ autoload :Locale, "#{__dir__}/i18n/locale"
require_relative 'i18n/text'
end
diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb
index 3442f76b1b..25a7217d3c 100644
--- a/lib/rdoc/markdown.rb
+++ b/lib/rdoc/markdown.rb
@@ -199,6 +199,7 @@ class RDoc::Markdown
@result = nil
@failed_rule = nil
@failing_rule_offset = -1
+ @line_offsets = nil
setup_foreign_grammar
end
@@ -215,17 +216,32 @@ class RDoc::Markdown
target + 1
end
- def current_line(target=pos)
- cur_offset = 0
- cur_line = 0
+ if [].respond_to? :bsearch_index
+ def current_line(target=pos)
+ unless @line_offsets
+ @line_offsets = []
+ total = 0
+ string.each_line do |line|
+ total += line.size
+ @line_offsets << total
+ end
+ end
- string.each_line do |line|
- cur_line += 1
- cur_offset += line.size
- return cur_line if cur_offset >= target
+ @line_offsets.bsearch_index {|x| x >= target } + 1 || -1
end
+ else
+ def current_line(target=pos)
+ cur_offset = 0
+ cur_line = 0
+
+ string.each_line do |line|
+ cur_line += 1
+ cur_offset += line.size
+ return cur_line if cur_offset >= target
+ end
- -1
+ -1
+ end
end
def lines
@@ -533,11 +549,11 @@ class RDoc::Markdown
- require 'rdoc'
- require 'rdoc/markup/to_joined_paragraph'
- require 'rdoc/markdown/entities'
+ require_relative '../rdoc'
+ require_relative 'markup/to_joined_paragraph'
+ require_relative 'markdown/entities'
- require 'rdoc/markdown/literals'
+ require_relative 'markdown/literals'
##
# Supported extensions
@@ -14918,7 +14934,7 @@ class RDoc::Markdown
return _tmp
end
- # RawLine = (< (!"\r" !"\n" .)* @Newline > | < .+ > @Eof) { text }
+ # RawLine = (< /[^\r\n]*/ @Newline > | < .+ > @Eof) { text }
def _RawLine
_save = self.pos
@@ -14930,36 +14946,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- while true
-
- _save4 = self.pos
- while true # sequence
- _save5 = self.pos
- _tmp = match_string("\r")
- _tmp = _tmp ? nil : true
- self.pos = _save5
- unless _tmp
- self.pos = _save4
- break
- end
- _save6 = self.pos
- _tmp = match_string("\n")
- _tmp = _tmp ? nil : true
- self.pos = _save6
- unless _tmp
- self.pos = _save4
- break
- end
- _tmp = get_byte
- unless _tmp
- self.pos = _save4
- end
- break
- end # end sequence
-
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\G(?-mix:[^\r\n]*)/)
unless _tmp
self.pos = _save2
break
@@ -14977,10 +14964,10 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save7 = self.pos
+ _save3 = self.pos
while true # sequence
_text_start = self.pos
- _save8 = self.pos
+ _save4 = self.pos
_tmp = get_byte
if _tmp
while true
@@ -14989,18 +14976,18 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save8
+ self.pos = _save4
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save7
+ self.pos = _save3
break
end
_tmp = _Eof()
unless _tmp
- self.pos = _save7
+ self.pos = _save3
end
break
end # end sequence
@@ -16661,7 +16648,7 @@ class RDoc::Markdown
Rules[:_OptionallyIndentedLine] = rule_info("OptionallyIndentedLine", "Indent? Line")
Rules[:_StartList] = rule_info("StartList", "&. { [] }")
Rules[:_Line] = rule_info("Line", "@RawLine:a { a }")
- Rules[:_RawLine] = rule_info("RawLine", "(< (!\"\\r\" !\"\\n\" .)* @Newline > | < .+ > @Eof) { text }")
+ Rules[:_RawLine] = rule_info("RawLine", "(< /[^\\r\\n]*/ @Newline > | < .+ > @Eof) { text }")
Rules[:_SkipBlock] = rule_info("SkipBlock", "(HtmlBlock | (!\"\#\" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)")
Rules[:_ExtendedSpecialChar] = rule_info("ExtendedSpecialChar", "&{ notes? } \"^\"")
Rules[:_NoteReference] = rule_info("NoteReference", "&{ notes? } RawNoteReference:ref { note_for ref }")
diff --git a/lib/rdoc/markdown/literals.rb b/lib/rdoc/markdown/literals.rb
index 943c2d268a..4c36672de7 100644
--- a/lib/rdoc/markdown/literals.rb
+++ b/lib/rdoc/markdown/literals.rb
@@ -29,6 +29,7 @@ class RDoc::Markdown::Literals
@result = nil
@failed_rule = nil
@failing_rule_offset = -1
+ @line_offsets = nil
setup_foreign_grammar
end
@@ -45,17 +46,32 @@ class RDoc::Markdown::Literals
target + 1
end
- def current_line(target=pos)
- cur_offset = 0
- cur_line = 0
+ if [].respond_to? :bsearch_index
+ def current_line(target=pos)
+ unless @line_offsets
+ @line_offsets = []
+ total = 0
+ string.each_line do |line|
+ total += line.size
+ @line_offsets << total
+ end
+ end
- string.each_line do |line|
- cur_line += 1
- cur_offset += line.size
- return cur_line if cur_offset >= target
+ @line_offsets.bsearch_index {|x| x >= target } + 1 || -1
end
+ else
+ def current_line(target=pos)
+ cur_offset = 0
+ cur_line = 0
+
+ string.each_line do |line|
+ cur_line += 1
+ cur_offset += line.size
+ return cur_line if cur_offset >= target
+ end
- -1
+ -1
+ end
end
def lines
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index 92aed757cf..f7aa02fd9f 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -166,7 +166,7 @@
# <h1 id="method-i-do_fun_things-label-Example">Example</h1>
#
# The label can be linked-to using <tt>SomeClass@Headers</tt>. See
-# {Links}[RDoc::Markup@Links] for further details.
+# {Links}[rdoc-ref:RDoc::Markup@Links] for further details.
#
# === Rules
#
@@ -391,16 +391,16 @@
#
# * The \ must be doubled if not followed by white space: \\.
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
-# * This is a link to {ruby-lang}[www.ruby-lang.org].
-# * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org].
+# * This is a link to {ruby-lang}[https://www.ruby-lang.org].
+# * This is not a link, however: \{ruby-lang.org}[https://www.ruby-lang.org].
# * This will not be linked to \RDoc::RDoc#document
#
# generates:
#
# * The \ must be doubled if not followed by white space: \\.
# * But not in \<tt> tags: in a Regexp, <tt>\S</tt> matches non-space.
-# * This is a link to {ruby-lang}[www.ruby-lang.org]
-# * This is not a link, however: \{ruby-lang.org}[www.ruby-lang.org]
+# * This is a link to {ruby-lang}[https://www.ruby-lang.org]
+# * This is not a link, however: \{ruby-lang.org}[https://www.ruby-lang.org]
# * This will not be linked to \RDoc::RDoc#document
#
# Inside \<tt> tags, more precisely, leading backslashes are removed only if
@@ -822,46 +822,45 @@ https://github.com/ruby/rdoc/issues
document.accept formatter
end
- autoload :Parser, 'rdoc/markup/parser'
- autoload :PreProcess, 'rdoc/markup/pre_process'
+ autoload :Parser, "#{__dir__}/markup/parser"
+ autoload :PreProcess, "#{__dir__}/markup/pre_process"
# Inline markup classes
- autoload :AttrChanger, 'rdoc/markup/attr_changer'
- autoload :AttrSpan, 'rdoc/markup/attr_span'
- autoload :Attributes, 'rdoc/markup/attributes'
- autoload :AttributeManager, 'rdoc/markup/attribute_manager'
- autoload :RegexpHandling, 'rdoc/markup/regexp_handling'
+ autoload :AttrChanger, "#{__dir__}/markup/attr_changer"
+ autoload :AttrSpan, "#{__dir__}/markup/attr_span"
+ autoload :Attributes, "#{__dir__}/markup/attributes"
+ autoload :AttributeManager, "#{__dir__}/markup/attribute_manager"
+ autoload :RegexpHandling, "#{__dir__}/markup/regexp_handling"
# RDoc::Markup AST
- autoload :BlankLine, 'rdoc/markup/blank_line'
- autoload :BlockQuote, 'rdoc/markup/block_quote'
- autoload :Document, 'rdoc/markup/document'
- autoload :HardBreak, 'rdoc/markup/hard_break'
- autoload :Heading, 'rdoc/markup/heading'
- autoload :Include, 'rdoc/markup/include'
- autoload :IndentedParagraph, 'rdoc/markup/indented_paragraph'
- autoload :List, 'rdoc/markup/list'
- autoload :ListItem, 'rdoc/markup/list_item'
- autoload :Paragraph, 'rdoc/markup/paragraph'
- autoload :Table, 'rdoc/markup/table'
- autoload :Raw, 'rdoc/markup/raw'
- autoload :Rule, 'rdoc/markup/rule'
- autoload :Verbatim, 'rdoc/markup/verbatim'
+ autoload :BlankLine, "#{__dir__}/markup/blank_line"
+ autoload :BlockQuote, "#{__dir__}/markup/block_quote"
+ autoload :Document, "#{__dir__}/markup/document"
+ autoload :HardBreak, "#{__dir__}/markup/hard_break"
+ autoload :Heading, "#{__dir__}/markup/heading"
+ autoload :Include, "#{__dir__}/markup/include"
+ autoload :IndentedParagraph, "#{__dir__}/markup/indented_paragraph"
+ autoload :List, "#{__dir__}/markup/list"
+ autoload :ListItem, "#{__dir__}/markup/list_item"
+ autoload :Paragraph, "#{__dir__}/markup/paragraph"
+ autoload :Table, "#{__dir__}/markup/table"
+ autoload :Raw, "#{__dir__}/markup/raw"
+ autoload :Rule, "#{__dir__}/markup/rule"
+ autoload :Verbatim, "#{__dir__}/markup/verbatim"
# Formatters
- autoload :Formatter, 'rdoc/markup/formatter'
+ autoload :Formatter, "#{__dir__}/markup/formatter"
- autoload :ToAnsi, 'rdoc/markup/to_ansi'
- autoload :ToBs, 'rdoc/markup/to_bs'
- autoload :ToHtml, 'rdoc/markup/to_html'
- autoload :ToHtmlCrossref, 'rdoc/markup/to_html_crossref'
- autoload :ToHtmlSnippet, 'rdoc/markup/to_html_snippet'
- autoload :ToLabel, 'rdoc/markup/to_label'
- autoload :ToMarkdown, 'rdoc/markup/to_markdown'
- autoload :ToRdoc, 'rdoc/markup/to_rdoc'
- autoload :ToTableOfContents, 'rdoc/markup/to_table_of_contents'
- autoload :ToTest, 'rdoc/markup/to_test'
- autoload :ToTtOnly, 'rdoc/markup/to_tt_only'
+ autoload :ToAnsi, "#{__dir__}/markup/to_ansi"
+ autoload :ToBs, "#{__dir__}/markup/to_bs"
+ autoload :ToHtml, "#{__dir__}/markup/to_html"
+ autoload :ToHtmlCrossref, "#{__dir__}/markup/to_html_crossref"
+ autoload :ToHtmlSnippet, "#{__dir__}/markup/to_html_snippet"
+ autoload :ToLabel, "#{__dir__}/markup/to_label"
+ autoload :ToMarkdown, "#{__dir__}/markup/to_markdown"
+ autoload :ToRdoc, "#{__dir__}/markup/to_rdoc"
+ autoload :ToTableOfContents, "#{__dir__}/markup/to_table_of_contents"
+ autoload :ToTest, "#{__dir__}/markup/to_test"
+ autoload :ToTtOnly, "#{__dir__}/markup/to_tt_only"
end
-
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index 50764510f3..6ef5af8856 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -147,18 +147,13 @@ class RDoc::Markup::AttributeManager
def convert_attrs_matching_word_pairs(str, attrs, exclusive)
# first do matching ones
tags = @matching_word_pairs.select { |start, bitmap|
- if exclusive && exclusive?(bitmap)
- true
- elsif !exclusive && !exclusive?(bitmap)
- true
- else
- false
- end
+ exclusive == exclusive?(bitmap)
}.keys
return if tags.empty?
- all_tags = @matching_word_pairs.keys
+ tags = "[#{tags.join("")}](?!#{PROTECT_ATTR})"
+ all_tags = "[#{@matching_word_pairs.keys.join("")}](?!#{PROTECT_ATTR})"
- re = /(^|\W|[#{all_tags.join("")}])([#{tags.join("")}])(\2*[#\\]?[\w:.\/\[\]-]+?\S?)\2(?!\2)([#{all_tags.join("")}]|\W|$)/
+ re = /(^|\W|#{all_tags})(#{tags})(\2*[#\\]?[\w:#{PROTECT_ATTR}.\/\[\]-]+?\S?)\2(?!\2)(#{all_tags}|\W|$)/
1 while str.gsub!(re) { |orig|
attr = @matching_word_pairs[$2]
@@ -176,11 +171,7 @@ class RDoc::Markup::AttributeManager
# then non-matching
unless @word_pair_map.empty? then
@word_pair_map.each do |regexp, attr|
- if !exclusive
- next if exclusive?(attr)
- else
- next if !exclusive?(attr)
- end
+ next unless exclusive == exclusive?(attr)
1 while str.gsub!(regexp) { |orig|
updated = attrs.set_attrs($`.length + $1.length, $2.length, attr)
if updated
@@ -198,13 +189,7 @@ class RDoc::Markup::AttributeManager
def convert_html(str, attrs, exclusive = false)
tags = @html_tags.select { |start, bitmap|
- if exclusive && exclusive?(bitmap)
- true
- elsif !exclusive && !exclusive?(bitmap)
- true
- else
- false
- end
+ exclusive == exclusive?(bitmap)
}.keys.join '|'
1 while str.gsub!(/<(#{tags})>(.*?)<\/\1>/i) { |orig|
@@ -221,11 +206,7 @@ class RDoc::Markup::AttributeManager
def convert_regexp_handlings str, attrs, exclusive = false
@regexp_handlings.each do |regexp, attribute|
- if exclusive
- next if !exclusive?(attribute)
- else
- next if exclusive?(attribute)
- end
+ next unless exclusive == exclusive?(attribute)
str.scan(regexp) do
capture = $~.size == 1 ? 0 : 1
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index d3bb8af835..2bfabc8942 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'cgi'
+require 'cgi/util'
##
# Outputs RDoc markup as HTML.
@@ -61,12 +61,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
#
# These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling.
+ URL_CHARACTERS_REGEXP_STR = /[A-Za-z0-9\-._~:\/\?#\[\]@!$&'\(\)*+,;%=]/.source
+
##
# Adds regexp handlings.
def init_regexp_handlings
# external links
- @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/,
+ @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)#{URL_CHARACTERS_REGEXP_STR}+\w/,
:HYPERLINK)
init_link_notation_regexp_handlings
end
diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb
index 3d95ccc2e2..aa1dbcf2a1 100644
--- a/lib/rdoc/markup/to_label.rb
+++ b/lib/rdoc/markup/to_label.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'cgi'
+require 'cgi/util'
##
# Creates HTML-safe labels suitable for use in id attributes. Tidylinks are
diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb
index 3cef78c4a5..aae3c47e85 100644
--- a/lib/rdoc/method_attr.rb
+++ b/lib/rdoc/method_attr.rb
@@ -289,7 +289,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
# HTML id-friendly method/attribute name
def html_name
- require 'cgi'
+ require 'cgi/util'
CGI.escape(@name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
end
diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb
index 6729b18448..68dfa7d4a3 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -56,7 +56,7 @@ class RDoc::NormalClass < RDoc::ClassModule
def pretty_print q # :nodoc:
superclass = @superclass ? " < #{@superclass}" : nil
- q.group 2, "[class #{full_name}#{superclass} ", "]" do
+ q.group 2, "[class #{full_name}#{superclass}", "]" do
q.breakable
q.text "includes:"
q.breakable
diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb
index 8f364be41c..edf29f8f1c 100644
--- a/lib/rdoc/normal_module.rb
+++ b/lib/rdoc/normal_module.rb
@@ -30,7 +30,7 @@ class RDoc::NormalModule < RDoc::ClassModule
end
def pretty_print q # :nodoc:
- q.group 2, "[module #{full_name}: ", "]" do
+ q.group 2, "[module #{full_name}:", "]" do
q.breakable
q.text "includes:"
q.breakable
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 792b473b79..55994c9dcc 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -106,6 +106,7 @@ class RDoc::Options
generator_options
generators
op_dir
+ page_dir
option_parser
pipe
rdoc_include
@@ -434,6 +435,7 @@ class RDoc::Options
@main_page = map['main_page'] if map.has_key?('main_page')
@markup = map['markup'] if map.has_key?('markup')
@op_dir = map['op_dir'] if map.has_key?('op_dir')
+ @page_dir = map['page_dir'] if map.has_key?('page_dir')
@show_hash = map['show_hash'] if map.has_key?('show_hash')
@tab_width = map['tab_width'] if map.has_key?('tab_width')
@template_dir = map['template_dir'] if map.has_key?('template_dir')
@@ -513,19 +515,22 @@ class RDoc::Options
##
# For dumping YAML
- def encode_with coder # :nodoc:
+ def to_yaml(*options) # :nodoc:
encoding = @encoding ? @encoding.name : nil
- coder.add 'encoding', encoding
- coder.add 'static_path', sanitize_path(@static_path)
- coder.add 'rdoc_include', sanitize_path(@rdoc_include)
+ yaml = {}
+ yaml['encoding'] = encoding
+ yaml['static_path'] = sanitize_path(@static_path)
+ yaml['rdoc_include'] = sanitize_path(@rdoc_include)
+ yaml['page_dir'] = (sanitize_path([@page_dir]).first if @page_dir)
ivars = instance_variables.map { |ivar| ivar.to_s[1..-1] }
ivars -= SPECIAL
ivars.sort.each do |ivar|
- coder.add ivar, instance_variable_get("@#{ivar}")
+ yaml[ivar] = instance_variable_get("@#{ivar}")
end
+ yaml.to_yaml
end
##
@@ -548,6 +553,11 @@ class RDoc::Options
# #template.
def finish
+ if @write_options then
+ write_options
+ exit
+ end
+
@op_dir ||= 'doc'
@rdoc_include << "." if @rdoc_include.empty?
@@ -585,14 +595,14 @@ class RDoc::Options
def finish_page_dir
return unless @page_dir
- @files << @page_dir.to_s
+ @files << @page_dir
- page_dir = nil
+ page_dir = Pathname(@page_dir)
begin
- page_dir = @page_dir.expand_path.relative_path_from @root
+ page_dir = page_dir.expand_path.relative_path_from @root
rescue ArgumentError
# On Windows, sometimes crosses different drive letters.
- page_dir = @page_dir.expand_path
+ page_dir = page_dir.expand_path
end
@page_dir = page_dir
@@ -847,7 +857,7 @@ Usage: #{opt.program_name} [options] [names...]
"such files at your project root.",
"NOTE: Do not use the same file name in",
"the page dir and the root of your project") do |page_dir|
- @page_dir = Pathname(page_dir)
+ @page_dir = page_dir
end
opt.separator nil
@@ -1159,13 +1169,6 @@ Usage: #{opt.program_name} [options] [names...]
@files = argv.dup
- finish
-
- if @write_options then
- write_options
- exit
- end
-
self
end
@@ -1278,7 +1281,7 @@ Usage: #{opt.program_name} [options] [names...]
File.open '.rdoc_options', 'w' do |io|
io.set_encoding Encoding::UTF_8
- YAML.dump self, io
+ io.print to_yaml
end
end
diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb
index 425bc48632..7006265b63 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -263,8 +263,8 @@ class RDoc::Parser
@preprocess.options = @options
end
- autoload :RubyTools, 'rdoc/parser/ruby_tools'
- autoload :Text, 'rdoc/parser/text'
+ autoload :RubyTools, "#{__dir__}/parser/ruby_tools"
+ autoload :Text, "#{__dir__}/parser/text"
end
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index b89aaa6dcc..b1bbf22f16 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -295,93 +295,83 @@ class RDoc::Parser::C < RDoc::Parser
@content.scan(
%r(
+ (?<open>\s*\(\s*) {0}
+ (?<close>\s*\)\s*) {0}
+ (?<name>\s*"(?<class_name>\w+)") {0}
+ (?<parent>\s*(?:
+ (?<parent_name>[\w\*\s\(\)\.\->]+) |
+ rb_path2class\s*\(\s*"(?<path>[\w:]+)"\s*\)
+ )) {0}
+ (?<under>\w+) {0}
+
(?<var_name>[\w\.]+)\s* =
\s*rb_(?:
define_(?:
- class(?: # rb_define_class(class_name_1, parent_name_1)
- \s*\(
- \s*"(?<class_name_1>\w+)",
- \s*(?<parent_name_1>\w+)\s*
- \)
- |
- _under\s*\( # rb_define_class_under(class_under, class_name2, parent_name2...)
- \s* (?<class_under>\w+),
- \s* "(?<class_name_2>\w+)",
- \s*
- (?:
- (?<parent_name_2>[\w\*\s\(\)\.\->]+) |
- rb_path2class\("(?<path>[\w:]+)"\)
- )
+ class(?: # rb_define_class(name, parent_name)
+ \(\s*
+ \g<name>,
+ \g<parent>
\s*\)
+ |
+ _under\g<open> # rb_define_class_under(under, name, parent_name...)
+ \g<under>,
+ \g<name>,
+ \g<parent>
+ \g<close>
)
|
- module(?: # rb_define_module(module_name_1)
- \s*\(
- \s*"(?<module_name_1>\w+)"\s*
- \)
+ (?<module>)
+ module(?: # rb_define_module(name)
+ \g<open>
+ \g<name>
+ \g<close>
|
- _under\s*\( # rb_define_module_under(module_under, module_name_2)
- \s*(?<module_under>\w+),
- \s*"(?<module_name_2>\w+)"
- \s*\)
+ _under\g<open> # rb_define_module_under(under, name)
+ \g<under>,
+ \g<name>
+ \g<close>
)
)
|
- struct_define_without_accessor\s*\( # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
- \s*"(?<class_name_3>\w+)",
- \s*(?<parent_name_3>\w+),
- \s*\w+, # Allocation function
- (?:\s*"\w+",)* # Attributes
- \s*NULL
- \)
+ (?<attributes>(?:\s*"\w+",)*\s*NULL\s*) {0}
+ struct_define(?:
+ \g<open> # rb_struct_define(name, ...)
+ \g<name>,
+ |
+ _under\g<open> # rb_struct_define_under(under, name, ...)
+ \g<under>,
+ \g<name>,
+ |
+ _without_accessor(?:
+ \g<open> # rb_struct_define_without_accessor(name, parent_name, ...)
+ |
+ _under\g<open> # rb_struct_define_without_accessor_under(under, name, parent_name, ...)
+ \g<under>,
+ )
+ \g<name>,
+ \g<parent>,
+ \s*\w+, # Allocation function
+ )
+ \g<attributes>
+ \g<close>
|
- singleton_class\s*\( # rb_singleton_class(target_class_name)
- \s*(?<target_class_name>\w+)
- \)
+ singleton_class\g<open> # rb_singleton_class(target_class_name)
+ (?<target_class_name>\w+)
+ \g<close>
)
)mx
) do
- class_name = $~[:class_name_1]
- type = :class
- if class_name
- # rb_define_class(class_name_1, parent_name_1)
- parent_name = $~[:parent_name_1]
- #under = nil
- else
- class_name = $~[:class_name_2]
- if class_name
- # rb_define_class_under(class_under, class_name2, parent_name2...)
- parent_name = $~[:parent_name_2] || $~[:path]
- under = $~[:class_under]
- else
- class_name = $~[:class_name_3]
- if class_name
- # rb_struct_define_without_accessor(class_name_3, parent_name_3, ...)
- parent_name = $~[:parent_name_3]
- #under = nil
- else
- type = :module
- class_name = $~[:module_name_1]
- #parent_name = nil
- if class_name
- # rb_define_module(module_name_1)
- #under = nil
- else
- class_name = $~[:module_name_2]
- if class_name
- # rb_define_module_under(module_under, module_name_1)
- under = $~[:module_under]
- else
- # rb_singleton_class(target_class_name)
- target_class_name = $~[:target_class_name]
- handle_singleton $~[:var_name], target_class_name
- next
- end
- end
- end
- end
+ if target_class_name = $~[:target_class_name]
+ # rb_singleton_class(target_class_name)
+ handle_singleton $~[:var_name], target_class_name
+ next
end
+ type = $~[:module] ? :module : :class
+ class_name = $~[:class_name]
+ parent_name = $~[:parent_name] || $~[:path]
+ under = $~[:under]
+
handle_class_module($~[:var_name], type, class_name, parent_name, under)
end
end
@@ -677,13 +667,14 @@ class RDoc::Parser::C < RDoc::Parser
##
# Finds a RDoc::NormalClass or RDoc::NormalModule for +raw_name+
- def find_class(raw_name, name)
+ def find_class(raw_name, name, base_name = nil)
unless @classes[raw_name]
if raw_name =~ /^rb_m/
container = @top_level.add_module RDoc::NormalModule, name
else
container = @top_level.add_class RDoc::NormalClass, name
end
+ container.name = base_name if base_name
container.record_location @top_level
@classes[raw_name] = container
@@ -921,7 +912,7 @@ class RDoc::Parser::C < RDoc::Parser
return unless class_name
- class_obj = find_class var_name, class_name
+ class_obj = find_class var_name, class_name, class_name[/::\K[^:]+\z/]
unless class_obj then
@options.warn 'Enclosing class or module %p is not known' % [const_name]
@@ -1025,7 +1016,8 @@ class RDoc::Parser::C < RDoc::Parser
elsif p_count == -1 then # argc, argv
rb_scan_args body
else
- "(#{(1..p_count).map { |i| "p#{i}" }.join ', '})"
+ args = (1..p_count).map { |i| "p#{i}" }
+ "(#{args.join ', '})"
end
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index e546fe2141..3c5f79632c 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -400,6 +400,29 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Skip opening parentheses and yield the block.
+ # Skip closing parentheses too when exists.
+
+ def skip_parentheses(&block)
+ left_tk = peek_tk
+
+ if :on_lparen == left_tk[:kind]
+ get_tk
+
+ ret = skip_parentheses(&block)
+
+ right_tk = peek_tk
+ if :on_rparen == right_tk[:kind]
+ get_tk
+ end
+
+ ret
+ else
+ yield
+ end
+ end
+
+ ##
# Return a superclass, which can be either a constant of an expression
def get_class_specification
@@ -833,7 +856,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
cls = parse_class_regular container, declaration_context, single,
name_t, given_name, comment
elsif name_t[:kind] == :on_op && name_t[:text] == '<<'
- case name = get_class_specification
+ case name = skip_parentheses { get_class_specification }
when 'self', container.name
read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
parse_statements container, SINGLE
diff --git a/lib/rdoc/rd.rb b/lib/rdoc/rd.rb
index 0d3d3cea85..8c2366a3ca 100644
--- a/lib/rdoc/rd.rb
+++ b/lib/rdoc/rd.rb
@@ -92,9 +92,8 @@ class RDoc::RD
document
end
- autoload :BlockParser, 'rdoc/rd/block_parser'
- autoload :InlineParser, 'rdoc/rd/inline_parser'
- autoload :Inline, 'rdoc/rd/inline'
+ autoload :BlockParser, "#{__dir__}/rd/block_parser"
+ autoload :InlineParser, "#{__dir__}/rd/inline_parser"
+ autoload :Inline, "#{__dir__}/rd/inline"
end
-
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
index 462ba869a2..eb7d46925b 100644
--- a/lib/rdoc/rd/block_parser.rb
+++ b/lib/rdoc/rd/block_parser.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.5.2
+# This file is automatically generated by Racc 1.6.0
# from Racc grammar file "".
#
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
index 8f4c2c31ef..c1da35a109 100644
--- a/lib/rdoc/rd/inline_parser.rb
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.5.2
+# This file is automatically generated by Racc 1.6.0
# from Racc grammar file "".
#
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 5255e043fd..400f9b5bc3 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rdoc'
+require_relative '../rdoc'
require 'find'
require 'fileutils'
@@ -440,11 +440,11 @@ The internal error was:
if RDoc::Options === options then
@options = options
- @options.finish
else
@options = RDoc::Options.load_options
@options.parse options
end
+ @options.finish
if @options.pipe then
handle_pipe
diff --git a/lib/rdoc/ri.rb b/lib/rdoc/ri.rb
index c798c1fc49..0af05f729f 100644
--- a/lib/rdoc/ri.rb
+++ b/lib/rdoc/ri.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rdoc'
+require_relative '../rdoc'
##
# Namespace for the ri command line tool's implementation.
@@ -13,9 +13,8 @@ module RDoc::RI
class Error < RDoc::Error; end
- autoload :Driver, 'rdoc/ri/driver'
- autoload :Paths, 'rdoc/ri/paths'
- autoload :Store, 'rdoc/ri/store'
+ autoload :Driver, "#{__dir__}/ri/driver"
+ autoload :Paths, "#{__dir__}/ri/paths"
+ autoload :Store, "#{__dir__}/ri/store"
end
-
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 7549a39203..edd2a703e7 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -12,12 +12,10 @@ begin
rescue LoadError
end
-require 'rdoc'
+require_relative '../../rdoc'
-##
-# For RubyGems backwards compatibility
-
-require_relative 'formatter'
+require_relative 'formatter' # For RubyGems backwards compatibility
+# TODO: Fix weird documentation with `require_relative`
##
# The RI driver implements the command-line ri tool.
diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb
index 3781ff9858..3160072e53 100644
--- a/lib/rdoc/rubygems_hook.rb
+++ b/lib/rdoc/rubygems_hook.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
require 'rubygems/user_interaction'
require 'fileutils'
-require 'rdoc'
+require_relative '../rdoc'
##
# Gem::RDoc provides methods to generate RDoc and ri data for installed gems
diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index 0ab1eaf19d..d05368766a 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rdoc'
+require_relative '../rdoc'
require 'erb'
require 'time'
require 'json'
diff --git a/lib/rdoc/single_class.rb b/lib/rdoc/single_class.rb
index 6a7b67deb3..860f06a6e5 100644
--- a/lib/rdoc/single_class.rb
+++ b/lib/rdoc/single_class.rb
@@ -22,5 +22,10 @@ class RDoc::SingleClass < RDoc::ClassModule
"class << #{full_name}"
end
+ def pretty_print q # :nodoc:
+ q.group 2, "[class << #{full_name}", "]" do
+ next
+ end
+ end
end
diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb
index bd6c0ef23a..4817c9c729 100644
--- a/lib/rdoc/stats.rb
+++ b/lib/rdoc/stats.rb
@@ -454,9 +454,8 @@ class RDoc::Stats
[params.length, undoc]
end
- autoload :Quiet, 'rdoc/stats/quiet'
- autoload :Normal, 'rdoc/stats/normal'
- autoload :Verbose, 'rdoc/stats/verbose'
+ autoload :Quiet, "#{__dir__}/stats/quiet"
+ autoload :Normal, "#{__dir__}/stats/normal"
+ autoload :Verbose, "#{__dir__}/stats/verbose"
end
-
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index 5ba671ca1b..9fc540d317 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -557,7 +557,7 @@ class RDoc::Store
#orig_enc = @encoding
File.open cache_path, 'rb' do |io|
- @cache = Marshal.load io.read
+ @cache = Marshal.load io
end
load_enc = @cache[:encoding]
@@ -616,7 +616,7 @@ class RDoc::Store
file = class_file klass_name
File.open file, 'rb' do |io|
- Marshal.load io.read
+ Marshal.load io
end
rescue Errno::ENOENT => e
error = MissingFileError.new(self, file, klass_name)
@@ -631,7 +631,7 @@ class RDoc::Store
file = method_file klass_name, method_name
File.open file, 'rb' do |io|
- obj = Marshal.load io.read
+ obj = Marshal.load io
obj.store = self
obj.parent =
find_class_or_module(klass_name) || load_class(klass_name) unless
@@ -651,7 +651,7 @@ class RDoc::Store
file = page_file page_name
File.open file, 'rb' do |io|
- obj = Marshal.load io.read
+ obj = Marshal.load io
obj.store = self
obj
end
diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb
index fa13a4f0bd..8ea2d0588c 100644
--- a/lib/rdoc/task.rb
+++ b/lib/rdoc/task.rb
@@ -32,7 +32,7 @@ begin
rescue Gem::LoadError
end unless defined?(Rake)
-require 'rdoc'
+require_relative '../rdoc'
require 'rake'
require 'rake/tasklib'
@@ -323,7 +323,7 @@ module Rake
##
# For backwards compatibility
- RDocTask = RDoc::Task
+ RDocTask = RDoc::Task # :nodoc:
end
# :startdoc:
diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb
index 86c5b360fd..2c52a6b87b 100644
--- a/lib/rdoc/version.rb
+++ b/lib/rdoc/version.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module RDoc
##