From 46e5c5622f4d4b6ef4570031eaf08c49a5712389 Mon Sep 17 00:00:00 2001 From: hsbt Date: Wed, 7 Sep 2016 02:51:12 +0000 Subject: * lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0.beta1 This version is mostly same as r56072. It contains to remove code for Ruby 1.8 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/markdown.rb | 6 +- lib/rdoc/markdown/literals.rb | 417 ++++++++++++++++++++++++++++++++ lib/rdoc/markdown/literals_1_9.rb | 421 --------------------------------- lib/rdoc/markup/formatter_test_case.rb | 4 - lib/rdoc/rdoc.gemspec | 59 ++++- lib/rdoc/ruby_lex.rb | 5 +- lib/rdoc/store.rb | 11 +- lib/rdoc/test_case.rb | 10 - 8 files changed, 477 insertions(+), 456 deletions(-) create mode 100644 lib/rdoc/markdown/literals.rb delete mode 100644 lib/rdoc/markdown/literals_1_9.rb (limited to 'lib/rdoc') diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb index 596856dac1..06fe8cf4d4 100644 --- a/lib/rdoc/markdown.rb +++ b/lib/rdoc/markdown.rb @@ -526,11 +526,7 @@ class RDoc::Markdown require 'rdoc/markup/to_joined_paragraph' require 'rdoc/markdown/entities' - if RUBY_VERSION > '1.9' then - require 'rdoc/markdown/literals_1_9' - else - require 'rdoc/markdown/literals_1_8' - end + require 'rdoc/markdown/literals' ## # Supported extensions diff --git a/lib/rdoc/markdown/literals.rb b/lib/rdoc/markdown/literals.rb new file mode 100644 index 0000000000..cde761a2f7 --- /dev/null +++ b/lib/rdoc/markdown/literals.rb @@ -0,0 +1,417 @@ +# coding: UTF-8 +# frozen_string_literal: false +# :markup: markdown + +## +#-- +# This set of literals is for Ruby 1.9 regular expressions and gives full +# unicode support. +# +# Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric +# characters, newlines and spaces. +class RDoc::Markdown::Literals + # :stopdoc: + + # This is distinct from setup_parser so that a standalone parser + # can redefine #initialize and still have access to the proper + # parser setup code. + def initialize(str, debug=false) + setup_parser(str, debug) + end + + + + # Prepares for parsing +str+. If you define a custom initialize you must + # call this method before #parse + def setup_parser(str, debug=false) + set_string str, 0 + @memoizations = Hash.new { |h,k| h[k] = {} } + @result = nil + @failed_rule = nil + @failing_rule_offset = -1 + + setup_foreign_grammar + end + + attr_reader :string + attr_reader :failing_rule_offset + attr_accessor :result, :pos + + def current_column(target=pos) + if c = string.rindex("\n", target-1) + return target - c - 1 + end + + target + 1 + end + + 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 + end + + def lines + lines = [] + string.each_line { |l| lines << l } + lines + end + + + + def get_text(start) + @string[start..@pos-1] + end + + # Sets the string and current parsing position for the parser. + def set_string string, pos + @string = string + @string_size = string ? string.size : 0 + @pos = pos + end + + def show_pos + width = 10 + if @pos < width + "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")" + else + "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")" + end + end + + def failure_info + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'" + else + "line #{l}, column #{c}: failed rule '#{@failed_rule}'" + end + end + + def failure_caret + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + line = lines[l-1] + "#{line}\n#{' ' * (c - 1)}^" + end + + def failure_character + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + lines[l-1][c-1, 1] + end + + def failure_oneline + l = current_line @failing_rule_offset + c = current_column @failing_rule_offset + + char = lines[l-1][c-1, 1] + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'" + else + "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'" + end + end + + class ParseError < RuntimeError + end + + def raise_error + raise ParseError, failure_oneline + end + + def show_error(io=STDOUT) + error_pos = @failing_rule_offset + line_no = current_line(error_pos) + col_no = current_column(error_pos) + + io.puts "On line #{line_no}, column #{col_no}:" + + if @failed_rule.kind_of? Symbol + info = self.class::Rules[@failed_rule] + io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')" + else + io.puts "Failed to match rule '#{@failed_rule}'" + end + + io.puts "Got: #{string[error_pos,1].inspect}" + line = lines[line_no-1] + io.puts "=> #{line}" + io.print(" " * (col_no + 3)) + io.puts "^" + end + + def set_failed_rule(name) + if @pos > @failing_rule_offset + @failed_rule = name + @failing_rule_offset = @pos + end + end + + attr_reader :failed_rule + + def match_string(str) + len = str.size + if @string[pos,len] == str + @pos += len + return str + end + + return nil + end + + def scan(reg) + if m = reg.match(@string[@pos..-1]) + width = m.end(0) + @pos += width + return true + end + + return nil + end + + if "".respond_to? :ord + def get_byte + if @pos >= @string_size + return nil + end + + s = @string[@pos].ord + @pos += 1 + s + end + else + def get_byte + if @pos >= @string_size + return nil + end + + s = @string[@pos] + @pos += 1 + s + end + end + + def parse(rule=nil) + # We invoke the rules indirectly via apply + # instead of by just calling them as methods because + # if the rules use left recursion, apply needs to + # manage that. + + if !rule + apply(:_root) + else + method = rule.gsub("-","_hyphen_") + apply :"_#{method}" + end + end + + class MemoEntry + def initialize(ans, pos) + @ans = ans + @pos = pos + @result = nil + @set = false + @left_rec = false + end + + attr_reader :ans, :pos, :result, :set + attr_accessor :left_rec + + def move!(ans, pos, result) + @ans = ans + @pos = pos + @result = result + @set = true + @left_rec = false + end + end + + def external_invoke(other, rule, *args) + old_pos = @pos + old_string = @string + + set_string other.string, other.pos + + begin + if val = __send__(rule, *args) + other.pos = @pos + other.result = @result + else + other.set_failed_rule "#{self.class}##{rule}" + end + val + ensure + set_string old_string, old_pos + end + end + + def apply_with_args(rule, *args) + memo_key = [rule, args] + if m = @memoizations[memo_key][@pos] + @pos = m.pos + if !m.set + m.left_rec = true + return nil + end + + @result = m.result + + return m.ans + else + m = MemoEntry.new(nil, @pos) + @memoizations[memo_key][@pos] = m + start_pos = @pos + + ans = __send__ rule, *args + + lr = m.left_rec + + m.move! ans, @pos, @result + + # Don't bother trying to grow the left recursion + # if it's failing straight away (thus there is no seed) + if ans and lr + return grow_lr(rule, args, start_pos, m) + else + return ans + end + end + end + + def apply(rule) + if m = @memoizations[rule][@pos] + @pos = m.pos + if !m.set + m.left_rec = true + return nil + end + + @result = m.result + + return m.ans + else + m = MemoEntry.new(nil, @pos) + @memoizations[rule][@pos] = m + start_pos = @pos + + ans = __send__ rule + + lr = m.left_rec + + m.move! ans, @pos, @result + + # Don't bother trying to grow the left recursion + # if it's failing straight away (thus there is no seed) + if ans and lr + return grow_lr(rule, nil, start_pos, m) + else + return ans + end + end + end + + def grow_lr(rule, args, start_pos, m) + while true + @pos = start_pos + @result = m.result + + if args + ans = __send__ rule, *args + else + ans = __send__ rule + end + return nil unless ans + + break if @pos <= m.pos + + m.move! ans, @pos, @result + end + + @result = m.result + @pos = m.pos + return m.ans + end + + class RuleInfo + def initialize(name, rendered) + @name = name + @rendered = rendered + end + + attr_reader :name, :rendered + end + + def self.rule_info(name, rendered) + RuleInfo.new(name, rendered) + end + + + # :startdoc: + # :stopdoc: + def setup_foreign_grammar; end + + # Alphanumeric = /\p{Word}/ + def _Alphanumeric + _tmp = scan(/\A(?-mix:\p{Word})/) + set_failed_rule :_Alphanumeric unless _tmp + return _tmp + end + + # AlphanumericAscii = /[A-Za-z0-9]/ + def _AlphanumericAscii + _tmp = scan(/\A(?-mix:[A-Za-z0-9])/) + set_failed_rule :_AlphanumericAscii unless _tmp + return _tmp + end + + # BOM = "uFEFF" + def _BOM + _tmp = match_string("uFEFF") + set_failed_rule :_BOM unless _tmp + return _tmp + end + + # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/ + def _Newline + _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/) + set_failed_rule :_Newline unless _tmp + return _tmp + end + + # NonAlphanumeric = /\p{^Word}/ + def _NonAlphanumeric + _tmp = scan(/\A(?-mix:\p{^Word})/) + set_failed_rule :_NonAlphanumeric unless _tmp + return _tmp + end + + # Spacechar = /\t|\p{Zs}/ + def _Spacechar + _tmp = scan(/\A(?-mix:\t|\p{Zs})/) + set_failed_rule :_Spacechar unless _tmp + return _tmp + end + + Rules = {} + Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/") + Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/") + Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"") + Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/") + Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/\\p{^Word}/") + Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/") + # :startdoc: +end diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb deleted file mode 100644 index d7a27f12b1..0000000000 --- a/lib/rdoc/markdown/literals_1_9.rb +++ /dev/null @@ -1,421 +0,0 @@ -# coding: UTF-8 -# frozen_string_literal: false -# :markup: markdown - -## -#-- -# This set of literals is for Ruby 1.9 regular expressions and gives full -# unicode support. -# -# Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric -# characters, newlines and spaces. -class RDoc::Markdown::Literals - # :stopdoc: - - # This is distinct from setup_parser so that a standalone parser - # can redefine #initialize and still have access to the proper - # parser setup code. - def initialize(str, debug=false) - setup_parser(str, debug) - end - - - - # Prepares for parsing +str+. If you define a custom initialize you must - # call this method before #parse - def setup_parser(str, debug=false) - set_string str, 0 - @memoizations = Hash.new { |h,k| h[k] = {} } - @result = nil - @failed_rule = nil - @failing_rule_offset = -1 - - setup_foreign_grammar - end - - attr_reader :string - attr_reader :failing_rule_offset - attr_accessor :result, :pos - - def current_column(target=pos) - if c = string.rindex("\n", target-1) - return target - c - 1 - end - - target + 1 - end - - 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 - end - - def lines - lines = [] - string.each_line { |l| lines << l } - lines - end - - - - def get_text(start) - @string[start..@pos-1] - end - - # Sets the string and current parsing position for the parser. - def set_string string, pos - @string = string - @string_size = string ? string.size : 0 - @pos = pos - end - - def show_pos - width = 10 - if @pos < width - "#{@pos} (\"#{@string[0,@pos]}\" @ \"#{@string[@pos,width]}\")" - else - "#{@pos} (\"... #{@string[@pos - width, width]}\" @ \"#{@string[@pos,width]}\")" - end - end - - def failure_info - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - "line #{l}, column #{c}: failed rule '#{info.name}' = '#{info.rendered}'" - else - "line #{l}, column #{c}: failed rule '#{@failed_rule}'" - end - end - - def failure_caret - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - line = lines[l-1] - "#{line}\n#{' ' * (c - 1)}^" - end - - def failure_character - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - lines[l-1][c-1, 1] - end - - def failure_oneline - l = current_line @failing_rule_offset - c = current_column @failing_rule_offset - - char = lines[l-1][c-1, 1] - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - "@#{l}:#{c} failed rule '#{info.name}', got '#{char}'" - else - "@#{l}:#{c} failed rule '#{@failed_rule}', got '#{char}'" - end - end - - class ParseError < RuntimeError - end - - def raise_error - raise ParseError, failure_oneline - end - - def show_error(io=STDOUT) - error_pos = @failing_rule_offset - line_no = current_line(error_pos) - col_no = current_column(error_pos) - - io.puts "On line #{line_no}, column #{col_no}:" - - if @failed_rule.kind_of? Symbol - info = self.class::Rules[@failed_rule] - io.puts "Failed to match '#{info.rendered}' (rule '#{info.name}')" - else - io.puts "Failed to match rule '#{@failed_rule}'" - end - - io.puts "Got: #{string[error_pos,1].inspect}" - line = lines[line_no-1] - io.puts "=> #{line}" - io.print(" " * (col_no + 3)) - io.puts "^" - end - - def set_failed_rule(name) - if @pos > @failing_rule_offset - @failed_rule = name - @failing_rule_offset = @pos - end - end - - attr_reader :failed_rule - - def match_string(str) - len = str.size - if @string[pos,len] == str - @pos += len - return str - end - - return nil - end - - def scan(reg) - if m = reg.match(@string[@pos..-1]) - width = m.end(0) - @pos += width - return true - end - - return nil - end - - if "".respond_to? :ord - def get_byte - if @pos >= @string_size - return nil - end - - s = @string[@pos].ord - @pos += 1 - s - end - else - def get_byte - if @pos >= @string_size - return nil - end - - s = @string[@pos] - @pos += 1 - s - end - end - - def parse(rule=nil) - # We invoke the rules indirectly via apply - # instead of by just calling them as methods because - # if the rules use left recursion, apply needs to - # manage that. - - if !rule - apply(:_root) - else - method = rule.gsub("-","_hyphen_") - apply :"_#{method}" - end - end - - class MemoEntry - def initialize(ans, pos) - @ans = ans - @pos = pos - @result = nil - @set = false - @left_rec = false - end - - attr_reader :ans, :pos, :result, :set - attr_accessor :left_rec - - def move!(ans, pos, result) - @ans = ans - @pos = pos - @result = result - @set = true - @left_rec = false - end - end - - def external_invoke(other, rule, *args) - old_pos = @pos - old_string = @string - - set_string other.string, other.pos - - begin - if val = __send__(rule, *args) - other.pos = @pos - other.result = @result - else - other.set_failed_rule "#{self.class}##{rule}" - end - val - ensure - set_string old_string, old_pos - end - end - - def apply_with_args(rule, *args) - memo_key = [rule, args] - if m = @memoizations[memo_key][@pos] - @pos = m.pos - if !m.set - m.left_rec = true - return nil - end - - @result = m.result - - return m.ans - else - m = MemoEntry.new(nil, @pos) - @memoizations[memo_key][@pos] = m - start_pos = @pos - - ans = __send__ rule, *args - - lr = m.left_rec - - m.move! ans, @pos, @result - - # Don't bother trying to grow the left recursion - # if it's failing straight away (thus there is no seed) - if ans and lr - return grow_lr(rule, args, start_pos, m) - else - return ans - end - - return ans - end - end - - def apply(rule) - if m = @memoizations[rule][@pos] - @pos = m.pos - if !m.set - m.left_rec = true - return nil - end - - @result = m.result - - return m.ans - else - m = MemoEntry.new(nil, @pos) - @memoizations[rule][@pos] = m - start_pos = @pos - - ans = __send__ rule - - lr = m.left_rec - - m.move! ans, @pos, @result - - # Don't bother trying to grow the left recursion - # if it's failing straight away (thus there is no seed) - if ans and lr - return grow_lr(rule, nil, start_pos, m) - else - return ans - end - - return ans - end - end - - def grow_lr(rule, args, start_pos, m) - while true - @pos = start_pos - @result = m.result - - if args - ans = __send__ rule, *args - else - ans = __send__ rule - end - return nil unless ans - - break if @pos <= m.pos - - m.move! ans, @pos, @result - end - - @result = m.result - @pos = m.pos - return m.ans - end - - class RuleInfo - def initialize(name, rendered) - @name = name - @rendered = rendered - end - - attr_reader :name, :rendered - end - - def self.rule_info(name, rendered) - RuleInfo.new(name, rendered) - end - - - # :startdoc: - # :stopdoc: - def setup_foreign_grammar; end - - # Alphanumeric = /\p{Word}/ - def _Alphanumeric - _tmp = scan(/\A(?-mix:\p{Word})/) - set_failed_rule :_Alphanumeric unless _tmp - return _tmp - end - - # AlphanumericAscii = /[A-Za-z0-9]/ - def _AlphanumericAscii - _tmp = scan(/\A(?-mix:[A-Za-z0-9])/) - set_failed_rule :_AlphanumericAscii unless _tmp - return _tmp - end - - # BOM = "uFEFF" - def _BOM - _tmp = match_string("uFEFF") - set_failed_rule :_BOM unless _tmp - return _tmp - end - - # Newline = /\n|\r\n?|\p{Zl}|\p{Zp}/ - def _Newline - _tmp = scan(/\A(?-mix:\n|\r\n?|\p{Zl}|\p{Zp})/) - set_failed_rule :_Newline unless _tmp - return _tmp - end - - # NonAlphanumeric = /\p{^Word}/ - def _NonAlphanumeric - _tmp = scan(/\A(?-mix:\p{^Word})/) - set_failed_rule :_NonAlphanumeric unless _tmp - return _tmp - end - - # Spacechar = /\t|\p{Zs}/ - def _Spacechar - _tmp = scan(/\A(?-mix:\t|\p{Zs})/) - set_failed_rule :_Spacechar unless _tmp - return _tmp - end - - Rules = {} - Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/\\p{Word}/") - Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/") - Rules[:_BOM] = rule_info("BOM", "\"uFEFF\"") - Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?|\\p{Zl}|\\p{Zp}/") - Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/\\p{^Word}/") - Rules[:_Spacechar] = rule_info("Spacechar", "/\\t|\\p{Zs}/") - # :startdoc: -end diff --git a/lib/rdoc/markup/formatter_test_case.rb b/lib/rdoc/markup/formatter_test_case.rb index 776fe00537..a5b4933de4 100644 --- a/lib/rdoc/markup/formatter_test_case.rb +++ b/lib/rdoc/markup/formatter_test_case.rb @@ -177,9 +177,6 @@ class RDoc::Markup::FormatterTestCase < RDoc::TestCase # Calls accept_heading_3 with a level 3 RDoc::Markup::Heading def test_accept_heading_3 - # HACK this doesn't belong here - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars - @to.start_accepting @to.accept_heading @RM::Heading.new(3, 'Hello') @@ -765,4 +762,3 @@ class RDoc::Markup::FormatterTestCase < RDoc::TestCase end end - diff --git a/lib/rdoc/rdoc.gemspec b/lib/rdoc/rdoc.gemspec index 9c2609b434..606021f8b1 100644 --- a/lib/rdoc/rdoc.gemspec +++ b/lib/rdoc/rdoc.gemspec @@ -1,7 +1,60 @@ +# -*- encoding: utf-8 -*- +$:.unshift File.expand_path("../lib", __FILE__) +require 'rdoc' + Gem::Specification.new do |s| s.name = "rdoc" - s.version = "4.2.3" - s.summary = "This rdoc is bundled with Ruby" + s.version = RDoc::VERSION + + s.required_rubygems_version = Gem::Requirement.new(">= 1.3") if + s.respond_to? :required_rubygems_version= + + s.require_paths = ["lib"] + s.authors = [ + "Eric Hodel", + "Dave Thomas", + "Phil Hagelberg", + "Tony Strauss", + "Zachary Scott", + "Hiroshi SHIBATA" + ] + + s.description = <<-DESCRIPTION +RDoc produces HTML and command-line documentation for Ruby projects. +RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentation from the command-line. + DESCRIPTION + + s.email = ["drbrain@segment7.net", "mail@zzak.io", "hsbt@ruby-lang.org"] + + s.bindir = "exe" s.executables = ["rdoc", "ri"] - s.files = ["rdoc.rb", "rdoc/alias.rb", "rdoc/anon_class.rb", "rdoc/any_method.rb", "rdoc/attr.rb", "rdoc/class_module.rb", "rdoc/code_object.rb", "rdoc/code_objects.rb", "rdoc/comment.rb", "rdoc/constant.rb", "rdoc/context.rb", "rdoc/context/section.rb", "rdoc/cross_reference.rb", "rdoc/encoding.rb", "rdoc/erb_partial.rb", "rdoc/erbio.rb", "rdoc/extend.rb", "rdoc/generator.rb", "rdoc/generator/darkfish.rb", "rdoc/generator/json_index.rb", "rdoc/generator/markup.rb", "rdoc/generator/pot.rb", "rdoc/generator/pot/message_extractor.rb", "rdoc/generator/pot/po.rb", "rdoc/generator/pot/po_entry.rb", "rdoc/generator/ri.rb", "rdoc/ghost_method.rb", "rdoc/i18n.rb", "rdoc/i18n/locale.rb", "rdoc/i18n/text.rb", "rdoc/include.rb", "rdoc/known_classes.rb", "rdoc/markdown.rb", "rdoc/markdown/entities.rb", "rdoc/markdown/literals_1_9.rb", "rdoc/markup.rb", "rdoc/markup/attr_changer.rb", "rdoc/markup/attr_span.rb", "rdoc/markup/attribute_manager.rb", "rdoc/markup/attributes.rb", "rdoc/markup/blank_line.rb", "rdoc/markup/block_quote.rb", "rdoc/markup/document.rb", "rdoc/markup/formatter.rb", "rdoc/markup/formatter_test_case.rb", "rdoc/markup/hard_break.rb", "rdoc/markup/heading.rb", "rdoc/markup/include.rb", "rdoc/markup/indented_paragraph.rb", "rdoc/markup/inline.rb", "rdoc/markup/list.rb", "rdoc/markup/list_item.rb", "rdoc/markup/paragraph.rb", "rdoc/markup/parser.rb", "rdoc/markup/pre_process.rb", "rdoc/markup/raw.rb", "rdoc/markup/rule.rb", "rdoc/markup/special.rb", "rdoc/markup/text_formatter_test_case.rb", "rdoc/markup/to_ansi.rb", "rdoc/markup/to_bs.rb", "rdoc/markup/to_html.rb", "rdoc/markup/to_html_crossref.rb", "rdoc/markup/to_html_snippet.rb", "rdoc/markup/to_joined_paragraph.rb", "rdoc/markup/to_label.rb", "rdoc/markup/to_markdown.rb", "rdoc/markup/to_rdoc.rb", "rdoc/markup/to_table_of_contents.rb", "rdoc/markup/to_test.rb", "rdoc/markup/to_tt_only.rb", "rdoc/markup/verbatim.rb", "rdoc/meta_method.rb", "rdoc/method_attr.rb", "rdoc/mixin.rb", "rdoc/normal_class.rb", "rdoc/normal_module.rb", "rdoc/options.rb", "rdoc/parser.rb", "rdoc/parser/c.rb", "rdoc/parser/changelog.rb", "rdoc/parser/markdown.rb", "rdoc/parser/rd.rb", "rdoc/parser/ruby.rb", "rdoc/parser/ruby_tools.rb", "rdoc/parser/simple.rb", "rdoc/parser/text.rb", "rdoc/rd.rb", "rdoc/rd/block_parser.rb", "rdoc/rd/inline.rb", "rdoc/rd/inline_parser.rb", "rdoc/rdoc.rb", "rdoc/require.rb", "rdoc/ri.rb", "rdoc/ri/driver.rb", "rdoc/ri/formatter.rb", "rdoc/ri/paths.rb", "rdoc/ri/store.rb", "rdoc/ri/task.rb", "rdoc/ruby_lex.rb", "rdoc/ruby_token.rb", "rdoc/rubygems_hook.rb", "rdoc/servlet.rb", "rdoc/single_class.rb", "rdoc/stats.rb", "rdoc/stats/normal.rb", "rdoc/stats/quiet.rb", "rdoc/stats/verbose.rb", "rdoc/store.rb", "rdoc/task.rb", "rdoc/test_case.rb", "rdoc/text.rb", "rdoc/token_stream.rb", "rdoc/tom_doc.rb", "rdoc/top_level.rb"] + + s.extra_rdoc_files += %w[ + CVE-2013-0256.rdoc + CONTRIBUTING.rdoc + ExampleMarkdown.md + ExampleRDoc.rdoc + History.rdoc + LEGAL.rdoc + LICENSE.rdoc + README.rdoc + RI.rdoc + TODO.rdoc + ] + + s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" + + s.homepage = "http://docs.seattlerb.org/rdoc" + s.licenses = ["Ruby"] + + s.rdoc_options = ["--main", "README.rdoc"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9.3") + s.rubygems_version = "2.5.2" + s.summary = "RDoc produces HTML and command-line documentation for Ruby projects" + + s.add_development_dependency("rake", "~> 10.5") + s.add_development_dependency("racc", "~> 1.4", "> 1.4.10") + s.add_development_dependency("kpeg", "~> 0.9") + s.add_development_dependency("minitest", "~> 4") end diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb index 11ac8da85c..25788b6a29 100644 --- a/lib/rdoc/ruby_lex.rb +++ b/lib/rdoc/ruby_lex.rb @@ -1180,10 +1180,8 @@ class RDoc::RubyLex str = if ltype == quoted and %w[" ' /].include? ltype then ltype.dup - elsif RUBY_VERSION > '1.9' then - "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" else - "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" + "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}" end subtype = nil @@ -1371,4 +1369,3 @@ class RDoc::RubyLex end #RDoc::RubyLex.debug_level = 1 - diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index 3f91f05824..37bf03fc24 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -450,18 +450,12 @@ class RDoc::Store # inherit from Object, we have the above wrong inheritance. # # We fix BasicObject right away if we are running in a Ruby - # version >= 1.9. If not, we may be documenting 1.9 source - # while running under 1.8: we search the files of BasicObject - # for "object.c", and fix the inheritance if we find it. + # version >= 1.9. def fix_basic_object_inheritance basic = classes_hash['BasicObject'] return unless basic - if RUBY_VERSION >= '1.9' - basic.superclass = nil - elsif basic.in_files.any? { |f| File.basename(f.full_name) == 'object.c' } - basic.superclass = nil - end + basic.superclass = nil end ## @@ -977,4 +971,3 @@ class RDoc::Store end end - diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb index 1d5469bc19..3b928f2f3d 100644 --- a/lib/rdoc/test_case.rb +++ b/lib/rdoc/test_case.rb @@ -177,8 +177,6 @@ class RDoc::TestCase < MiniTest::Unit::TestCase # Depends upon Dir.mktmpdir def temp_dir - skip "No Dir::mktmpdir, upgrade your ruby" unless Dir.respond_to? :mktmpdir - Dir.mktmpdir do |temp_dir| Dir.chdir temp_dir do yield temp_dir @@ -208,11 +206,3 @@ class RDoc::TestCase < MiniTest::Unit::TestCase end end end - -# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since -# -I paths are not expanded. -$LOAD_PATH.each do |load_path| - break if load_path[0] == ?/ - load_path.replace File.expand_path load_path -end if RUBY_VERSION < '1.9' - -- cgit v1.2.3