diff --git a/.travis.yml b/.travis.yml index a83d6f3591..b5f465071d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ notifications: email: - mail@zzak.io rvm: - - 1.8.7 - 1.9.3 - 2.0.0 - 2.1.10 diff --git a/CONTRIBUTING.rdoc b/CONTRIBUTING.rdoc index 0aaff642b2..8cdbc7abe4 100644 --- a/CONTRIBUTING.rdoc +++ b/CONTRIBUTING.rdoc @@ -22,9 +22,11 @@ issues: == Developer Quick Start -RDoc uses hoe for development. To get ready to work on RDoc run: +RDoc uses bundler for development. To get ready to work on RDoc run: - $ gem install hoe + $ gem install bundler + [...] + $ bundle install [...] $ rake [...] @@ -216,4 +218,3 @@ To register the parser with rdoc, add the markup type's name and class to the RDoc::Text::MARKUP_FORMAT hash like: RDoc::Text::MARKUP_FORMAT['rdoc'] = RDoc::Markup - diff --git a/History.rdoc b/History.rdoc index 18764b0f95..8b17d2fb54 100644 --- a/History.rdoc +++ b/History.rdoc @@ -1,4 +1,7 @@ -=== 4.2.3 / 2016-??-?? +=== 5.0.0 / 2016-??-?? + +* Major enhancements + * Drop to support Ruby 1.8 * Bug fixes * Ensure badge data is included in result of JsonIndex template. diff --git a/Manifest.txt b/Manifest.txt deleted file mode 100644 index 9dcceea56b..0000000000 --- a/Manifest.txt +++ /dev/null @@ -1,309 +0,0 @@ -.autotest -.document -CONTRIBUTING.rdoc -CVE-2013-0256.rdoc -ExampleMarkdown.md -ExampleRDoc.rdoc -History.rdoc -LEGAL.rdoc -LICENSE.rdoc -Manifest.txt -README.rdoc -RI.rdoc -Rakefile -TODO.rdoc -bin/rdoc -bin/ri -lib/gauntlet_rdoc.rb -lib/rdoc.rb -lib/rdoc/alias.rb -lib/rdoc/anon_class.rb -lib/rdoc/any_method.rb -lib/rdoc/attr.rb -lib/rdoc/class_module.rb -lib/rdoc/code_object.rb -lib/rdoc/code_objects.rb -lib/rdoc/comment.rb -lib/rdoc/constant.rb -lib/rdoc/context.rb -lib/rdoc/context/section.rb -lib/rdoc/cross_reference.rb -lib/rdoc/encoding.rb -lib/rdoc/erb_partial.rb -lib/rdoc/erbio.rb -lib/rdoc/extend.rb -lib/rdoc/generator.rb -lib/rdoc/generator/darkfish.rb -lib/rdoc/generator/json_index.rb -lib/rdoc/generator/markup.rb -lib/rdoc/generator/ri.rb -lib/rdoc/generator/pot.rb -lib/rdoc/generator/pot/message_extractor.rb -lib/rdoc/generator/pot/po.rb -lib/rdoc/generator/pot/po_entry.rb -lib/rdoc/generator/template/darkfish/.document -lib/rdoc/generator/template/darkfish/_footer.rhtml -lib/rdoc/generator/template/darkfish/_head.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml -lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml -lib/rdoc/generator/template/darkfish/class.rhtml -lib/rdoc/generator/template/darkfish/css/fonts.css -lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf -lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf -lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf -lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf -lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf -lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf -lib/rdoc/generator/template/darkfish/images/add.png -lib/rdoc/generator/template/darkfish/images/arrow_up.png -lib/rdoc/generator/template/darkfish/images/brick.png -lib/rdoc/generator/template/darkfish/images/brick_link.png -lib/rdoc/generator/template/darkfish/images/bug.png -lib/rdoc/generator/template/darkfish/images/bullet_black.png -lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png -lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png -lib/rdoc/generator/template/darkfish/images/date.png -lib/rdoc/generator/template/darkfish/images/delete.png -lib/rdoc/generator/template/darkfish/images/find.png -lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif -lib/rdoc/generator/template/darkfish/images/macFFBgHack.png -lib/rdoc/generator/template/darkfish/images/package.png -lib/rdoc/generator/template/darkfish/images/page_green.png -lib/rdoc/generator/template/darkfish/images/page_white_text.png -lib/rdoc/generator/template/darkfish/images/page_white_width.png -lib/rdoc/generator/template/darkfish/images/plugin.png -lib/rdoc/generator/template/darkfish/images/ruby.png -lib/rdoc/generator/template/darkfish/images/tag_blue.png -lib/rdoc/generator/template/darkfish/images/tag_green.png -lib/rdoc/generator/template/darkfish/images/transparent.png -lib/rdoc/generator/template/darkfish/images/wrench.png -lib/rdoc/generator/template/darkfish/images/wrench_orange.png -lib/rdoc/generator/template/darkfish/images/zoom.png -lib/rdoc/generator/template/darkfish/index.rhtml -lib/rdoc/generator/template/darkfish/js/darkfish.js -lib/rdoc/generator/template/darkfish/js/jquery.js -lib/rdoc/generator/template/darkfish/js/search.js -lib/rdoc/generator/template/darkfish/page.rhtml -lib/rdoc/generator/template/darkfish/css/rdoc.css -lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml -lib/rdoc/generator/template/darkfish/servlet_root.rhtml -lib/rdoc/generator/template/darkfish/table_of_contents.rhtml -lib/rdoc/generator/template/json_index/.document -lib/rdoc/generator/template/json_index/js/navigation.js -lib/rdoc/generator/template/json_index/js/searcher.js -lib/rdoc/ghost_method.rb -lib/rdoc/i18n.rb -lib/rdoc/i18n/locale.rb -lib/rdoc/i18n/text.rb -lib/rdoc/include.rb -lib/rdoc/known_classes.rb -lib/rdoc/markdown.kpeg -lib/rdoc/markdown.rb -lib/rdoc/markdown/entities.rb -lib/rdoc/markdown/literals_1_8.kpeg -lib/rdoc/markdown/literals_1_8.rb -lib/rdoc/markdown/literals_1_9.kpeg -lib/rdoc/markdown/literals_1_9.rb -lib/rdoc/markup.rb -lib/rdoc/markup/attr_changer.rb -lib/rdoc/markup/attr_span.rb -lib/rdoc/markup/attribute_manager.rb -lib/rdoc/markup/attributes.rb -lib/rdoc/markup/blank_line.rb -lib/rdoc/markup/block_quote.rb -lib/rdoc/markup/document.rb -lib/rdoc/markup/formatter.rb -lib/rdoc/markup/formatter_test_case.rb -lib/rdoc/markup/hard_break.rb -lib/rdoc/markup/heading.rb -lib/rdoc/markup/include.rb -lib/rdoc/markup/indented_paragraph.rb -lib/rdoc/markup/inline.rb -lib/rdoc/markup/list.rb -lib/rdoc/markup/list_item.rb -lib/rdoc/markup/paragraph.rb -lib/rdoc/markup/parser.rb -lib/rdoc/markup/pre_process.rb -lib/rdoc/markup/raw.rb -lib/rdoc/markup/rule.rb -lib/rdoc/markup/special.rb -lib/rdoc/markup/text_formatter_test_case.rb -lib/rdoc/markup/to_ansi.rb -lib/rdoc/markup/to_bs.rb -lib/rdoc/markup/to_html.rb -lib/rdoc/markup/to_html_crossref.rb -lib/rdoc/markup/to_html_snippet.rb -lib/rdoc/markup/to_joined_paragraph.rb -lib/rdoc/markup/to_label.rb -lib/rdoc/markup/to_markdown.rb -lib/rdoc/markup/to_rdoc.rb -lib/rdoc/markup/to_table_of_contents.rb -lib/rdoc/markup/to_test.rb -lib/rdoc/markup/to_tt_only.rb -lib/rdoc/markup/verbatim.rb -lib/rdoc/meta_method.rb -lib/rdoc/method_attr.rb -lib/rdoc/mixin.rb -lib/rdoc/normal_class.rb -lib/rdoc/normal_module.rb -lib/rdoc/options.rb -lib/rdoc/parser.rb -lib/rdoc/parser/c.rb -lib/rdoc/parser/changelog.rb -lib/rdoc/parser/markdown.rb -lib/rdoc/parser/rd.rb -lib/rdoc/parser/ruby.rb -lib/rdoc/parser/ruby_tools.rb -lib/rdoc/parser/simple.rb -lib/rdoc/parser/text.rb -lib/rdoc/rd.rb -lib/rdoc/rd/block_parser.rb -lib/rdoc/rd/block_parser.ry -lib/rdoc/rd/inline.rb -lib/rdoc/rd/inline_parser.rb -lib/rdoc/rd/inline_parser.ry -lib/rdoc/rdoc.rb -lib/rdoc/require.rb -lib/rdoc/ri.rb -lib/rdoc/ri/driver.rb -lib/rdoc/ri/formatter.rb -lib/rdoc/ri/paths.rb -lib/rdoc/ri/store.rb -lib/rdoc/ruby_lex.rb -lib/rdoc/ruby_token.rb -lib/rdoc/rubygems_hook.rb -lib/rdoc/servlet.rb -lib/rdoc/single_class.rb -lib/rdoc/stats.rb -lib/rdoc/stats/normal.rb -lib/rdoc/stats/quiet.rb -lib/rdoc/stats/verbose.rb -lib/rdoc/store.rb -lib/rdoc/task.rb -lib/rdoc/test_case.rb -lib/rdoc/text.rb -lib/rdoc/token_stream.rb -lib/rdoc/tom_doc.rb -lib/rdoc/top_level.rb -test/MarkdownTest_1.0.3/Amps and angle encoding.text -test/MarkdownTest_1.0.3/Auto links.text -test/MarkdownTest_1.0.3/Backslash escapes.text -test/MarkdownTest_1.0.3/Blockquotes with code blocks.text -test/MarkdownTest_1.0.3/Code Blocks.text -test/MarkdownTest_1.0.3/Code Spans.text -test/MarkdownTest_1.0.3/Hard-wrapped paragraphs with list-like lines.text -test/MarkdownTest_1.0.3/Horizontal rules.text -test/MarkdownTest_1.0.3/Inline HTML (Advanced).text -test/MarkdownTest_1.0.3/Inline HTML (Simple).text -test/MarkdownTest_1.0.3/Inline HTML comments.text -test/MarkdownTest_1.0.3/Links, inline style.text -test/MarkdownTest_1.0.3/Links, reference style.text -test/MarkdownTest_1.0.3/Links, shortcut references.text -test/MarkdownTest_1.0.3/Literal quotes in titles.text -test/MarkdownTest_1.0.3/Markdown Documentation - Basics.text -test/MarkdownTest_1.0.3/Markdown Documentation - Syntax.text -test/MarkdownTest_1.0.3/Nested blockquotes.text -test/MarkdownTest_1.0.3/Ordered and unordered lists.text -test/MarkdownTest_1.0.3/Strong and em together.text -test/MarkdownTest_1.0.3/Tabs.text -test/MarkdownTest_1.0.3/Tidyness.text -test/README -test/binary.dat -test/hidden.zip.txt -test/test.ja.largedoc -test/test.ja.rdoc -test/test.ja.txt -test/test.txt -test/test_rdoc_alias.rb -test/test_rdoc_any_method.rb -test/test_rdoc_attr.rb -test/test_rdoc_class_module.rb -test/test_rdoc_code_object.rb -test/test_rdoc_comment.rb -test/test_rdoc_constant.rb -test/test_rdoc_context.rb -test/test_rdoc_context_section.rb -test/test_rdoc_cross_reference.rb -test/test_rdoc_encoding.rb -test/test_rdoc_extend.rb -test/test_rdoc_generator_darkfish.rb -test/test_rdoc_generator_json_index.rb -test/test_rdoc_generator_markup.rb -test/test_rdoc_generator_ri.rb -test/test_rdoc_generator_pot.rb -test/test_rdoc_generator_pot_po.rb -test/test_rdoc_generator_pot_po_entry.rb -test/test_rdoc_i18n_locale.rb -test/test_rdoc_i18n_text.rb -test/test_rdoc_include.rb -test/test_rdoc_markdown.rb -test/test_rdoc_markdown_test.rb -test/test_rdoc_markup.rb -test/test_rdoc_markup_attribute_manager.rb -test/test_rdoc_markup_attributes.rb -test/test_rdoc_markup_document.rb -test/test_rdoc_markup_formatter.rb -test/test_rdoc_markup_hard_break.rb -test/test_rdoc_markup_heading.rb -test/test_rdoc_markup_include.rb -test/test_rdoc_markup_indented_paragraph.rb -test/test_rdoc_markup_paragraph.rb -test/test_rdoc_markup_parser.rb -test/test_rdoc_markup_pre_process.rb -test/test_rdoc_markup_raw.rb -test/test_rdoc_markup_to_ansi.rb -test/test_rdoc_markup_to_bs.rb -test/test_rdoc_markup_to_html.rb -test/test_rdoc_markup_to_html_crossref.rb -test/test_rdoc_markup_to_html_snippet.rb -test/test_rdoc_markup_to_joined_paragraph.rb -test/test_rdoc_markup_to_label.rb -test/test_rdoc_markup_to_markdown.rb -test/test_rdoc_markup_to_rdoc.rb -test/test_rdoc_markup_to_table_of_contents.rb -test/test_rdoc_markup_to_tt_only.rb -test/test_rdoc_markup_verbatim.rb -test/test_rdoc_method_attr.rb -test/test_rdoc_normal_class.rb -test/test_rdoc_normal_module.rb -test/test_rdoc_options.rb -test/test_rdoc_parser.rb -test/test_rdoc_parser_c.rb -test/test_rdoc_parser_changelog.rb -test/test_rdoc_parser_markdown.rb -test/test_rdoc_parser_rd.rb -test/test_rdoc_parser_ruby.rb -test/test_rdoc_parser_simple.rb -test/test_rdoc_rd.rb -test/test_rdoc_rd_block_parser.rb -test/test_rdoc_rd_inline.rb -test/test_rdoc_rd_inline_parser.rb -test/test_rdoc_rdoc.rb -test/test_rdoc_require.rb -test/test_rdoc_ri_driver.rb -test/test_rdoc_ri_paths.rb -test/test_rdoc_ruby_lex.rb -test/test_rdoc_ruby_token.rb -test/test_rdoc_rubygems_hook.rb -test/test_rdoc_servlet.rb -test/test_rdoc_single_class.rb -test/test_rdoc_stats.rb -test/test_rdoc_store.rb -test/test_rdoc_task.rb -test/test_rdoc_text.rb -test/test_rdoc_token_stream.rb -test/test_rdoc_tom_doc.rb -test/test_rdoc_top_level.rb -test/xref_data.rb -test/xref_test_case.rb diff --git a/Rakefile b/Rakefile index 3c4bba8220..67f944708e 100644 --- a/Rakefile +++ b/Rakefile @@ -12,8 +12,7 @@ PARSER_FILES = %w[ lib/rdoc/rd/block_parser.ry lib/rdoc/rd/inline_parser.ry lib/rdoc/markdown.kpeg - lib/rdoc/markdown/literals_1_8.kpeg - lib/rdoc/markdown/literals_1_9.kpeg + lib/rdoc/markdown/literals.kpeg ] $rdoc_rakefile = true diff --git a/bin/console b/bin/console new file mode 100755 index 0000000000..c5ee285473 --- /dev/null +++ b/bin/console @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby + +require "bundler/setup" +require "rdoc" + +require "irb" +IRB.start diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000000..cf4ad25e19 --- /dev/null +++ b/bin/setup @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install diff --git a/bin/rdoc b/exe/rdoc similarity index 100% rename from bin/rdoc rename to exe/rdoc diff --git a/bin/ri b/exe/ri similarity index 100% rename from bin/ri rename to exe/ri diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 494d5d9f4a..43da573d26 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '4.2.3' + VERSION = '5.0.0.beta1' ## # Method visibilities @@ -185,4 +185,3 @@ def self.load_yaml autoload :Require, 'rdoc/require' end - diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index f51e81c619..fd96dc85ce 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -179,11 +179,7 @@ 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_1_9.kpeg b/lib/rdoc/markdown/literals.kpeg similarity index 100% rename from lib/rdoc/markdown/literals_1_9.kpeg rename to lib/rdoc/markdown/literals.kpeg diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals.rb similarity index 99% rename from lib/rdoc/markdown/literals_1_9.rb rename to lib/rdoc/markdown/literals.rb index d7a27f12b1..cde761a2f7 100644 --- a/lib/rdoc/markdown/literals_1_9.rb +++ b/lib/rdoc/markdown/literals.rb @@ -289,8 +289,6 @@ def apply_with_args(rule, *args) else return ans end - - return ans end end @@ -323,8 +321,6 @@ def apply(rule) else return ans end - - return ans end end diff --git a/lib/rdoc/markdown/literals_1_8.kpeg b/lib/rdoc/markdown/literals_1_8.kpeg deleted file mode 100644 index d1a705ed13..0000000000 --- a/lib/rdoc/markdown/literals_1_8.kpeg +++ /dev/null @@ -1,18 +0,0 @@ -%% name = RDoc::Markdown::Literals - -%% header { -# :markup: markdown - -## -# Provides Literals appropriate for your ruby version. -#-- -# This set of literals is for Ruby 1.8 regular expressions. -} - -Alphanumeric = /[0-9A-Za-z\200-\377]/ -AlphanumericAscii = /[A-Za-z0-9]/ -BOM = "\357\273\277" -Newline = /\n|\r\n?/ -NonAlphanumeric = /[\000-\057\072-\100\133-\140\173-\177]/ -Spacechar = / |\t/ - diff --git a/lib/rdoc/markdown/literals_1_8.rb b/lib/rdoc/markdown/literals_1_8.rb deleted file mode 100644 index 1fdae566ed..0000000000 --- a/lib/rdoc/markdown/literals_1_8.rb +++ /dev/null @@ -1,417 +0,0 @@ -# frozen_string_literal: false -# :markup: markdown - -## -# Provides Literals appropriate for your ruby version. -#-- -# This set of literals is for Ruby 1.8 regular expressions. -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 = /[0-9A-Za-z\200-\377]/ - def _Alphanumeric - _tmp = scan(/\A(?-mix:[0-9A-Za-z\200-\377])/) - 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 = "" - def _BOM - _tmp = match_string("\303\257\302\273\302\277") - set_failed_rule :_BOM unless _tmp - return _tmp - end - - # Newline = /\n|\r\n?/ - def _Newline - _tmp = scan(/\A(?-mix:\n|\r\n?)/) - set_failed_rule :_Newline unless _tmp - return _tmp - end - - # NonAlphanumeric = /[\000-\057\072-\100\133-\140\173-\177]/ - def _NonAlphanumeric - _tmp = scan(/\A(?-mix:[\000-\057\072-\100\133-\140\173-\177])/) - set_failed_rule :_NonAlphanumeric unless _tmp - return _tmp - end - - # Spacechar = / |\t/ - def _Spacechar - _tmp = scan(/\A(?-mix: |\t)/) - set_failed_rule :_Spacechar unless _tmp - return _tmp - end - - Rules = {} - Rules[:_Alphanumeric] = rule_info("Alphanumeric", "/[0-9A-Za-z\\200-\\377]/") - Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "/[A-Za-z0-9]/") - Rules[:_BOM] = rule_info("BOM", "\"\"") - Rules[:_Newline] = rule_info("Newline", "/\\n|\\r\\n?/") - Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "/[\\000-\\057\\072-\\100\\133-\\140\\173-\\177]/") - Rules[:_Spacechar] = rule_info("Spacechar", "/ |\\t/") - # :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 @@ def test_accept_heading_2 # 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 @@ def test_list_verbatim # HACK overblown end 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 @@ def identify_string(ltype, quoted = ltype, type = nil) 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 @@ def read_escape 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 @@ def find_unique all_hash # 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 @@ def unique_modules 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 @@ def raw *contents # 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 @@ def verbose_capture_io 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' - diff --git a/rdoc.gemspec b/rdoc.gemspec index 65b183470c..ada7bf9028 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -41,25 +41,18 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat TODO.rdoc ] - s.files = File.readlines("Manifest.txt").map { |l| l.gsub("\n",'') } + 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.bindir = "exe" s.homepage = "http://docs.seattlerb.org/rdoc" s.licenses = ["Ruby"] - s.post_install_message = <<-MESSAGE -Depending on your version of ruby, you may need to install ruby rdoc/ri data: - -<= 1.8.6 : unsupported - = 1.8.7 : gem install rdoc-data; rdoc-data --install - = 1.9.1 : gem install rdoc-data; rdoc-data --install ->= 1.9.2 : nothing to do! Yay! - MESSAGE s.rdoc_options = ["--main", "README.rdoc"] - s.required_ruby_version = Gem::Requirement.new(">= 1.8.7") + 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_runtime_dependency("json", "~> 1.4") s.add_development_dependency("rake", "~> 10.5") s.add_development_dependency("racc", "~> 1.4", "> 1.4.10") s.add_development_dependency("kpeg", "~> 0.9") diff --git a/test/test_rdoc_markup_to_bs.rb b/test/test_rdoc_markup_to_bs.rb index 33d274a97f..153a121d78 100644 --- a/test/test_rdoc_markup_to_bs.rb +++ b/test/test_rdoc_markup_to_bs.rb @@ -25,7 +25,6 @@ def accept_document end def accept_heading - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "===== H\bHe\bel\bll\blo\bo\n", @to.res.join end @@ -216,37 +215,30 @@ def start_accepting end def accept_heading_1 - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_2 - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "== H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_3 - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "=== H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_4 - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "==== H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_indent - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal " = H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_b - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting end def accept_heading_suppressed_crossref - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "= H\bHe\bel\bll\blo\bo\n", @to.end_accepting end @@ -264,24 +256,20 @@ def accept_list_item_start_note_multi_label end def accept_paragraph_b - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "reg b\bbo\bol\bld\bd \b w\bwo\bor\brd\bds\bs reg\n", @to.end_accepting end def accept_paragraph_br - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "one\ntwo\n", @to.end_accepting end def accept_paragraph_break - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "hello\nworld\n", @to.end_accepting end def accept_paragraph_i - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc_\b _\bw_\bo_\br_\bd_\bs reg\n", @to.end_accepting end @@ -301,12 +289,10 @@ def accept_paragraph_plus end def accept_paragraph_star - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "reg b\bbo\bol\bld\bd reg\n", @to.end_accepting end def accept_paragraph_underscore - skip "No String#chars, upgrade your ruby" unless ''.respond_to? :chars assert_equal "reg _\bi_\bt_\ba_\bl_\bi_\bc reg\n", @to.end_accepting end @@ -364,4 +350,3 @@ def list_verbatim end end -