ruby-changes:43999
From: hsbt <ko1@a...>
Date: Mon, 5 Sep 2016 19:35:39 +0900 (JST)
Subject: [ruby-changes:43999] hsbt:r56072 (trunk): * lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
hsbt 2016-09-05 19:35:30 +0900 (Mon, 05 Sep 2016) New Revision: 56072 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56072 Log: * lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513) https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016-- https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09 Modified files: trunk/ChangeLog trunk/lib/rdoc/context/section.rb trunk/lib/rdoc/context.rb trunk/lib/rdoc/encoding.rb trunk/lib/rdoc/generator/template/darkfish/_head.rhtml trunk/lib/rdoc/generator/template/darkfish/css/fonts.css trunk/lib/rdoc/generator/template/darkfish/js/darkfish.js trunk/lib/rdoc/generator/template/json_index/js/searcher.js trunk/lib/rdoc/markdown.rb trunk/lib/rdoc/parser/c.rb trunk/lib/rdoc/parser/changelog.rb trunk/lib/rdoc/rd/block_parser.rb trunk/lib/rdoc/rd/inline_parser.rb trunk/lib/rdoc/rdoc.gemspec trunk/lib/rdoc/rdoc.rb trunk/lib/rdoc/ri/driver.rb trunk/lib/rdoc/ruby_lex.rb trunk/lib/rdoc/servlet.rb trunk/lib/rdoc.rb trunk/test/rdoc/test_rdoc_context.rb trunk/test/rdoc/test_rdoc_context_section.rb trunk/test/rdoc/test_rdoc_encoding.rb trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb trunk/test/rdoc/test_rdoc_parser_c.rb trunk/test/rdoc/test_rdoc_rdoc.rb trunk/test/rdoc/test_rdoc_ri_driver.rb trunk/test/rdoc/test_rdoc_servlet.rb Index: test/rdoc/test_rdoc_servlet.rb =================================================================== --- test/rdoc/test_rdoc_servlet.rb (revision 56071) +++ test/rdoc/test_rdoc_servlet.rb (revision 56072) @@ -66,14 +66,15 @@ class TestRDocServlet < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_servlet.rb#L66 def test_asset temp_dir do - now = Time.now + FileUtils.mkdir 'css' - open 'rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end - File.utime now, now, 'rdoc.css' + now = Time.now + open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end + File.utime now, now, 'css/rdoc.css' @s.asset_dirs[:darkfish] = '.' - @req.path = 'rdoc.css' + @req.path = '/css/rdoc.css' @s.asset :darkfish, @req, @res @@ -95,11 +96,12 @@ class TestRDocServlet < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_servlet.rb#L96 def test_do_GET_asset_darkfish temp_dir do - FileUtils.touch 'rdoc.css' + FileUtils.mkdir 'css' + FileUtils.touch 'css/rdoc.css' @s.asset_dirs[:darkfish] = '.' - @req.path = '/rdoc.css' + @req.path = '/css/rdoc.css' @s.do_GET @req, @res @@ -136,11 +138,12 @@ class TestRDocServlet < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_servlet.rb#L138 @s = RDoc::Servlet.new @server, @stores, @cache, '/mount/path' temp_dir do - FileUtils.touch 'rdoc.css' + FileUtils.mkdir 'css' + FileUtils.touch 'css/rdoc.css' @s.asset_dirs[:darkfish] = '.' - @req.path = '/mount/path/rdoc.css' + @req.path = '/mount/path/css/rdoc.css' @s.do_GET @req, @res Index: test/rdoc/test_rdoc_ri_driver.rb =================================================================== --- test/rdoc/test_rdoc_ri_driver.rb (revision 56071) +++ test/rdoc/test_rdoc_ri_driver.rb (revision 56072) @@ -834,6 +834,24 @@ Foo::Bar#bother https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_ri_driver.rb#L834 end end + def test_expand_class_2 + @store1 = RDoc::RI::Store.new @home_ri, :home + + @top_level = @store1.add_file 'file.rb' + + @cFoo = @top_level.add_class RDoc::NormalClass, 'Foo' + @mFox = @top_level.add_module RDoc::NormalModule, 'Fox' + @cFoo_Bar = @cFoo.add_class RDoc::NormalClass, 'Bar' + @store1.save + + @driver.stores = [@store1] + assert_raises RDoc::RI::Driver::NotFoundError do + @driver.expand_class 'F' + end + assert_equal 'Foo::Bar', @driver.expand_class('F::Bar') + assert_equal 'Foo::Bar', @driver.expand_class('F::B') + end + def test_expand_name util_store Index: test/rdoc/test_rdoc_encoding.rb =================================================================== --- test/rdoc/test_rdoc_encoding.rb (revision 56071) +++ test/rdoc/test_rdoc_encoding.rb (revision 56072) @@ -217,6 +217,45 @@ class TestRDocEncoding < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_encoding.rb#L217 end end + def test_skip_frozen_string_literal + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + expected = "# frozen_string_literal: false\nhi everybody" + + @tempfile.write expected + @tempfile.flush + + contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 + assert_equal "hi everybody", contents + assert_equal Encoding::UTF_8, contents.encoding + end + + def test_skip_frozen_string_literal_after_coding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + expected = "# coding: utf-8\n# frozen-string-literal: false\nhi everybody" + + @tempfile.write expected + @tempfile.flush + + contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 + assert_equal "hi everybody", contents + assert_equal Encoding::UTF_8, contents.encoding + end + + def test_skip_frozen_string_literal_before_coding + skip "Encoding not implemented" unless Object.const_defined? :Encoding + + expected = "# frozen_string_literal: false\n# coding: utf-8\nhi everybody" + + @tempfile.write expected + @tempfile.flush + + contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 + assert_equal "hi everybody", contents + assert_equal Encoding::UTF_8, contents.encoding + end + def test_sanity skip "Encoding not implemented" unless Object.const_defined? :Encoding Index: test/rdoc/test_rdoc_parser_c.rb =================================================================== --- test/rdoc/test_rdoc_parser_c.rb (revision 56071) +++ test/rdoc/test_rdoc_parser_c.rb (revision 56072) @@ -176,6 +176,50 @@ void Init_Blah(void) { https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_c.rb#L176 assert_equal 'This is a writer', writer.comment.text end + def test_do_attr_rb_attr_2 + content = <<-EOF +void Init_Blah(void) { + cBlah = rb_define_class("Blah", rb_cObject); + + /* + * This is an accessor + */ + rb_attr(cBlah, rb_intern_const("accessor"), 1, 1, Qfalse); + + /* + * This is a reader + */ + rb_attr(cBlah, rb_intern_const("reader"), 1, 0, Qfalse); + + /* + * This is a writer + */ + rb_attr(cBlah, rb_intern_const("writer"), 0, 1, Qfalse); +} + EOF + + klass = util_get_class content, 'cBlah' + + attrs = klass.attributes + assert_equal 3, attrs.length, attrs.inspect + + accessor = attrs.shift + assert_equal 'accessor', accessor.name + assert_equal 'RW', accessor.rw + assert_equal 'This is an accessor', accessor.comment.text + assert_equal @top_level, accessor.file + + reader = attrs.shift + assert_equal 'reader', reader.name + assert_equal 'R', reader.rw + assert_equal 'This is a reader', reader.comment.text + + writer = attrs.shift + assert_equal 'writer', writer.name + assert_equal 'W', writer.rw + assert_equal 'This is a writer', writer.comment.text + end + def test_do_attr_rb_define_attr content = <<-EOF void Init_Blah(void) { Index: test/rdoc/test_rdoc_context_section.rb =================================================================== --- test/rdoc/test_rdoc_context_section.rb (revision 56071) +++ test/rdoc/test_rdoc_context_section.rb (revision 56072) @@ -48,6 +48,22 @@ class TestRDocContextSection < RDoc::Tes https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_context_section.rb#L48 assert_equal 'one+two', @S.new(nil, 'one two', nil).aref end + def test_eql_eh + other = @S.new @klass, 'other', comment('# comment', @top_level) + + assert @s.eql? @s + assert @s.eql? @s.dup + refute @s.eql? other + end + + def test_equals + other = @S.new @klass, 'other', comment('# comment', @top_level) + + assert_equal @s, @s + assert_equal @s, @s.dup + refute_equal @s, other + end + def test_extract_comment assert_equal '', @s.extract_comment(comment('')).text assert_equal '', @s.extract_comment(comment("# :section: b\n")).text @@ -56,6 +72,14 @@ class TestRDocContextSection < RDoc::Tes https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_context_section.rb#L72 @s.extract_comment(comment("# a\n# :section: b\n# c")).text end + def test_hash + other = @S.new @klass, 'other', comment('# comment', @top_level) + + assert_equal @s.hash, @s.hash + assert_equal @s.hash, @s.dup.hash + refute_equal @s.hash, other.hash + end + def test_marshal_dump loaded = Marshal.load Marshal.dump @s Index: test/rdoc/test_rdoc_context.rb =================================================================== --- test/rdoc/test_rdoc_context.rb (revision 56071) +++ test/rdoc/test_rdoc_context.rb (revision 56072) @@ -417,7 +417,7 @@ class TestRDocContext < XrefTestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_context.rb#L417 def bench_add_include cm = RDoc::ClassModule.new 'Klass' - assert_performance_linear 0.9 do |count| + assert_performance_linear 0.5 do |count| count.times do |i| cm.add_include RDoc::Include.new("N::M#{i}", nil) end Index: test/rdoc/test_rdoc_rdoc.rb =================================================================== --- test/rdoc/test_rdoc_rdoc.rb (revision 56071) +++ test/rdoc/test_rdoc_rdoc.rb (revision 56072) @@ -300,6 +300,7 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L300 blah.eps blah.erb blah.scpt.txt + blah.svg blah.ttf blah.yml ] Index: test/rdoc/test_rdoc_markup_to_html_crossref.rb =================================================================== --- test/rdoc/test_rdoc_markup_to_html_crossref.rb (revision 56071) +++ test/rdoc/test_rdoc_markup_to_html_crossref.rb (revision 56072) @@ -44,6 +44,12 @@ class TestRDocMarkupToHtmlCrossref < Xre https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_markup_to_html_crossref.rb#L44 assert_equal para("<a href=\"C1.html#Section\">Section at C1</a>"), result end + def test_convert_CROSSREF_constant + result = @to.convert 'C1::CONST' + + assert_equal para("<a href=\"C1.html#CONST\">C1::CONST</a>"), result + end + def test_convert_RDOCLINK_rdoc_ref result = @to.convert 'rdoc-ref:C1' Index: ChangeLog =================================================================== --- ChangeLog (revision 56071) +++ ChangeLog (revision 56072) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Sep 5 19:35:22 2016 SHIBATA Hiroshi <hsbt@r...> + + * lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513) + https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016-- + https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09 + Sun Sep 4 00:17:55 2016 Sho Hashimoto <sho-h@r...> * proc.c: [DOC] fix Object#define_singleton_method and Index: lib/rdoc.rb =================================================================== --- lib/rdoc.rb (revision 56071) +++ lib/rdoc.rb (revision 56072) @@ -65,7 +65,7 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc.rb#L65 ## # RDoc version you are using - VERSION = '4.2.1' + VERSION = '4.2.3' ## # Method visibilities Index: lib/rdoc/markdown.rb =================================================================== --- lib/rdoc/markdown.rb (revision 56071) +++ lib/rdoc/markdown.rb (revision 56072) @@ -1,5 +1,4 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L1 # coding: UTF-8 -# frozen_string_literal: false # :markup: markdown ## @@ -15,7 +14,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L14 # # data = File.read("README.md") # formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil) -# html = RDoc::Markdown.parse(data).accept(@formatter) +# html = RDoc::Markdown.parse(data).accept(formatter) # # # do something with html # @@ -447,8 +446,6 @@ class RDoc::Markdown https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L446 else return ans end - - return ans end end @@ -481,8 +478,6 @@ class RDoc::Markdown https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L478 else return ans end - - return ans end end @@ -15290,7 +15285,7 @@ class RDoc::Markdown https://github.com/ruby/ruby/blob/trunk/lib/rdoc/markdown.rb#L15285 self.pos = _save break end - @result = begin; + @result = begin; ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a Index: lib/rdoc/context.rb =================================================================== --- lib/rdoc/context.rb (revision 56071) +++ lib/rdoc/context.rb (revision 56072) @@ -789,7 +789,9 @@ class RDoc::Context < RDoc::CodeObject https://github.com/ruby/ruby/blob/trunk/lib/rdoc/context.rb#L789 # Finds a constant with +name+ in this context def find_constant_named(name) - @constants.find {|m| m.name == name} + @constants.find do |m| + m.name == name || m.full_name == name + end end ## Index: lib/rdoc/generator/template/darkfish/css/fonts.css =================================================================== --- lib/rdoc/generator/template/darkfish/css/fonts.css (revision 56071) +++ lib/rdoc/generator/template/darkfish/css/fonts.css (revision 56072) @@ -17,7 +17,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L17 font-weight: 400; src: local("Source Code Pro"), local("SourceCodePro-Regular"), - url("fonts/SourceCodePro-Regular.ttf") format("truetype"); + url("../fonts/SourceCodePro-Regular.ttf") format("truetype"); } @font-face { @@ -26,7 +26,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L26 font-weight: 700; src: local("Source Code Pro Bold"), local("SourceCodePro-Bold"), - url("fonts/SourceCodePro-Bold.ttf") format("truetype"); + url("../fonts/SourceCodePro-Bold.ttf") format("truetype"); } /* @@ -46,7 +46,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L46 font-weight: 300; src: local("Lato Light"), local("Lato-Light"), - url("fonts/Lato-Light.ttf") format("truetype"); + url("../fonts/Lato-Light.ttf") format("truetype"); } @font-face { @@ -55,7 +55,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L55 font-weight: 300; src: local("Lato Light Italic"), local("Lato-LightItalic"), - url("fonts/Lato-LightItalic.ttf") format("truetype"); + url("../fonts/Lato-LightItalic.ttf") format("truetype"); } @font-face { @@ -64,7 +64,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L64 font-weight: 700; src: local("Lato Regular"), local("Lato-Regular"), - url("fonts/Lato-Regular.ttf") format("truetype"); + url("../fonts/Lato-Regular.ttf") format("truetype"); } @font-face { @@ -73,7 +73,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/css/fonts.css#L73 font-weight: 700; src: local("Lato Italic"), local("Lato-Italic"), - url("fonts/Lato-RegularItalic.ttf") format("truetype"); + url("../fonts/Lato-RegularItalic.ttf") format("truetype"); } /* Index: lib/rdoc/generator/template/darkfish/js/darkfish.js =================================================================== --- lib/rdoc/generator/template/darkfish/js/darkfish.js (revision 56071) +++ lib/rdoc/generator/template/darkfish/js/darkfish.js (revision 56072) @@ -59,7 +59,7 @@ function hookSearch() { https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/js/darkfish.js#L59 var html = ''; // TODO add relative path to <script> per-page - html += '<p class="search-match"><a href="' + rdoc_rel_prefix + result.path + '">' + this.hlt(result.title); + html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title); if (result.params) html += '<span class="params">' + result.params + '</span>'; html += '</a>'; @@ -121,9 +121,9 @@ function highlightClickTarget( event ) { https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/js/darkfish.js#L121 }; }; -function loadAsync(path, success) { +function loadAsync(path, success, prefix) { $.ajax({ - url: rdoc_rel_prefix + path, + url: prefix + path, dataType: 'script', success: success, cache: true @@ -154,8 +154,8 @@ $(document).ready( function() { https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/js/darkfish.js#L154 }); } - loadAsync('js/navigation.js', search_success_function('navigation_loaded')); - loadAsync('js/search.js', search_success_function('search_loaded')); - loadAsync('js/search_index.js', search_success_function('search_index_loaded')); - loadAsync('js/searcher.js', search_success_function('searcher_loaded')); + loadAsync('js/navigation.js', search_success_function('navigation_loaded'), rdoc_rel_prefix); + loadAsync('js/search.js', search_success_function('search_loaded'), rdoc_rel_prefix); + loadAsync('js/search_index.js', search_success_function('search_index_loaded'), index_rel_prefix); + loadAsync('js/searcher.js', search_success_function('searcher_loaded'), rdoc_rel_prefix); }); Index: lib/rdoc/generator/template/darkfish/_head.rhtml =================================================================== --- lib/rdoc/generator/template/darkfish/_head.rhtml (revision 56071) +++ lib/rdoc/generator/template/darkfish/_head.rhtml (revision 56072) @@ -3,7 +3,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/darkfish/_head.rhtml#L3 <title><%= h @title %></title> <script type="text/javascript"> - var rdoc_rel_prefix = "<%= rel_prefix %>/"; + var rdoc_rel_prefix = "<%= asset_rel_prefix %>/"; + var index_rel_prefix = "<%= rel_prefix %>/"; </script> <script src="<%= asset_rel_prefix %>/js/jquery.js"></script> Index: lib/rdoc/generator/template/json_index/js/searcher.js =================================================================== --- lib/rdoc/generator/template/json_index/js/searcher.js (revision 56071) +++ lib/rdoc/generator/template/json_index/js/searcher.js (revision 56072) @@ -172,6 +172,7 @@ Searcher.prototype = new function() { https://github.com/ruby/ruby/blob/trunk/lib/rdoc/generator/template/json_index/js/searcher.js#L172 result.path = info[2]; result.params = info[3]; result.snippet = info[4]; + result.badge = info[6]; return result; } Index: lib/rdoc/rdoc.rb =================================================================== --- lib/rdoc/rdoc.rb (revision 56071) +++ lib/rdoc/rdoc.rb (revision 56072) @@ -437,7 +437,7 @@ The internal error was: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L437 def remove_unparseable files files.reject do |file| - file =~ /\.(?:class|eps|erb|scpt\.txt|ttf|yml)$/i or + file =~ /\.(?:class|eps|erb|scpt\.txt|svg|ttf|yml)$/i or (file =~ /tags$/i and open(file, 'rb') { |io| io.read(100) =~ /\A(\f\n[^,]+,\d+$|!_TAG_)/ Index: lib/rdoc/rd/inline_parser.rb =================================================================== --- lib/rdoc/rd/inline_parser.rb (revision 56071) +++ lib/rdoc/rd/inline_parser.rb (revision 56072) @@ -1,8 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rd/inline_parser.rb#L1 -# frozen_string_literal: false # # DO NOT MODIFY!!!! -# This file is automatically generated by Racc 1.4.12 -# from Racc grammar file "". +# This file is automatically generated by Racc 1.4.14 +# from Racc grammer file "". # require 'racc/parser.rb' @@ -244,152 +243,152 @@ end https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rd/inline_parser.rb#L243 ##### State transition tables begin ### racc_action_table = [ - 63, 64, 65, 153, 81, 62, 76, 78, 79, 87, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 77, 80, 152, 63, 64, 65, 61, 81, 62, 76, - 78, 79, 124, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 77, 80, 149, 104, 103, 102, 100, - 101, 99, 115, 116, 117, 164, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 96, 118, 119, 104, - 103, 102, 100, 101, 99, 115, 116, 117, 89, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 88, + 104, 103, 102, 100, 101, 99, 115, 116, 117, 8 (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/