From 4d81a1eb22b51eef485420be897bbea937d37f28 Mon Sep 17 00:00:00 2001 From: Alex Wood Date: Mon, 3 Aug 2015 15:39:53 -0400 Subject: [PATCH 0001/1389] Fix broken links to assets. Fixes #359. --- .../generator/template/darkfish/_head.rhtml | 2 +- .../generator/template/darkfish/css/fonts.css | 12 ++++++------ lib/rdoc/servlet.rb | 6 +++--- test/test_rdoc_servlet.rb | 19 +++++++++++-------- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml index 70f1c188d6..2a1d0b89d7 100644 --- a/lib/rdoc/generator/template/darkfish/_head.rhtml +++ b/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -3,7 +3,7 @@ <%= h @title %> diff --git a/lib/rdoc/generator/template/darkfish/css/fonts.css b/lib/rdoc/generator/template/darkfish/css/fonts.css index e9e721183b..57302b5183 100644 --- a/lib/rdoc/generator/template/darkfish/css/fonts.css +++ b/lib/rdoc/generator/template/darkfish/css/fonts.css @@ -17,7 +17,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ font-weight: 700; src: local("Lato Italic"), local("Lato-Italic"), - url("fonts/Lato-RegularItalic.ttf") format("truetype"); + url("../fonts/Lato-RegularItalic.ttf") format("truetype"); } /* diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index ec8fd739f1..94c3d39626 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -114,8 +114,8 @@ def do_GET req, res case req.path when '/' then root req, res - when '/rdoc.css', '/js/darkfish.js', '/js/jquery.js', '/js/search.js', - %r%^/images/% then + when '/js/darkfish.js', '/js/jquery.js', '/js/search.js', + %r%^/css/%, %r%^/images/%, %r%^/fonts/% then asset :darkfish, req, res when '/js/navigation.js', '/js/searcher.js' then asset :json_index, req, res @@ -202,7 +202,7 @@ def error exception, req, res Error - #{ERB::Util.html_escape exception.class} - +

Error

diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 143e2f225b..acd37cf402 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -65,14 +65,15 @@ def teardown 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 @@ -94,11 +95,12 @@ def test_do_GET 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 @@ -135,11 +137,12 @@ def test_do_GET_mount_path @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 From cfde4f9891764439d747fb646686e76adaf4f2e4 Mon Sep 17 00:00:00 2001 From: Alex Wood Date: Mon, 17 Aug 2015 11:13:55 -0400 Subject: [PATCH 0002/1389] Use gem search index instead of global index. --- lib/rdoc/generator/template/darkfish/_head.rhtml | 1 + .../generator/template/darkfish/js/darkfish.js | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml index 2a1d0b89d7..f308526823 100644 --- a/lib/rdoc/generator/template/darkfish/_head.rhtml +++ b/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -4,6 +4,7 @@ diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js index b789a65631..38f877ed40 100644 --- a/lib/rdoc/generator/template/darkfish/js/darkfish.js +++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js @@ -59,7 +59,7 @@ function hookSearch() { var html = ''; // TODO add relative path to >, yield_arg' @attr = RDoc::Attr.new nil, 'attr', 'RW', '' @klass.add_method @meth @klass.add_method @meth_bang + @klass.add_method @meth_with_html_tag_yield @klass.add_attribute @attr @ignored = @top_level.add_class RDoc::NormalClass, 'Ignored' @@ -167,7 +170,7 @@ def test_setup assert_equal [@klass_alias, @ignored, @klass, @object], @g.classes.sort_by { |klass| klass.full_name } assert_equal [@top_level], @g.files - assert_equal [@meth, @meth, @meth_bang, @meth_bang], @g.methods + assert_equal [@meth, @meth, @meth_bang, @meth_bang, @meth_with_html_tag_yield, @meth_with_html_tag_yield], @g.methods assert_equal [@klass_alias, @klass, @object], @g.modsort end @@ -199,6 +202,23 @@ def test_template_for_partial assert_same template, @g.send(:template_for, partial) end + def test_generated_method_with_html_tag_yield + top_level = @store.add_file 'file.rb' + top_level.add_class @klass.class, @klass.name + + @g.generate + + path = File.join @tmpdir, 'A.html' + + f = open(path) + internal_file = f.read + method_name_index = internal_file.index('method_with_html_tag_yield') + last_of_method_name_index = method_name_index + internal_file[method_name_index..-1].index('
') - 1 + method_name = internal_file[method_name_index..last_of_method_name_index] + + assert_includes method_name, '{ |%<<script>alert("atui")</script>>, yield_arg| ... }' + end + ## # Asserts that +filename+ has a link count greater than 1 if hard links to # @tmpdir are supported. From 0897476ff7e860cb0c6969398254817be172e982 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Thu, 28 Sep 2017 06:52:31 +0900 Subject: [PATCH 0422/1389] Remove lib/rdoc/ruby_token.rb --- lib/rdoc/ruby_token.rb | 470 ----------------------------------------- 1 file changed, 470 deletions(-) delete mode 100644 lib/rdoc/ruby_token.rb diff --git a/lib/rdoc/ruby_token.rb b/lib/rdoc/ruby_token.rb deleted file mode 100644 index baab3fe836..0000000000 --- a/lib/rdoc/ruby_token.rb +++ /dev/null @@ -1,470 +0,0 @@ -# frozen_string_literal: false -#-- -# irb/ruby-token.rb - ruby tokens -# $Release Version: 0.9.5$ -# $Revision: 11708 $ -# $Date: 2007-02-12 15:01:19 -0800 (Mon, 12 Feb 2007) $ -# by Keiju ISHITSUKA(keiju@ruby-lang.org) -#++ -# Definitions of all tokens involved in the lexical analysis. -# -# This class is not documented because it is so deep in the internals. - -module RDoc::RubyToken - # :stopdoc: - - EXPR_BEG = :EXPR_BEG - EXPR_MID = :EXPR_MID - EXPR_END = :EXPR_END - EXPR_ARG = :EXPR_ARG - EXPR_FNAME = :EXPR_FNAME - EXPR_DOT = :EXPR_DOT - EXPR_CLASS = :EXPR_CLASS - - # for ruby 1.4X - if !defined?(Symbol) - Symbol = Integer - end - - def set_token_position(seek, line, char) - @prev_seek = seek - @prev_line_no = line - @prev_char_no = char - end - - class Token - def initialize(seek, line_no, char_no, text = nil) - @seek = seek - @line_no = line_no - @char_no = char_no - @text = text - end - - attr_reader :seek - attr_reader :line_no - attr_reader :char_no - - attr_accessor :text - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.text == @text - end - - ## - # Because we're used in contexts that expect to return a token, we set the - # text string and then return ourselves - - def set_text(text) - @text = text - self - end - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @text] - end - - end - - class TkNode < Token - def initialize(seek, line_no, char_no, node = nil) - super seek, line_no, char_no - @node = node - end - - attr_reader:node - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.node == @node - end - - def set_text text - @node = text - self - end - - alias text node - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @node] - end - - end - - class TkId < Token - def initialize(seek, line_no, char_no, name) - super(seek, line_no, char_no) - @name = name - end - attr_reader:name - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.name == @name - end - - def set_text text - @name = text - self - end - - alias text name - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name] - end - - end - - class TkKW < TkId - end - - class TkVal < Token - def initialize(seek, line_no, char_no, value = nil) - super(seek, line_no, char_no) - @value = value - end - attr_accessor :value - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.value == @value - end - - def set_text text - @value = text - self - end - - alias text value - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %s, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @value] - end - - end - - class TkOp < Token - def initialize(seek, line_no, char_no, name = nil) - super seek, line_no, char_no - @name = name - end - - attr_accessor :name - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.name == @name - end - - def set_text text - @name = text - self - end - - alias text name - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name] - end - - end - - class TkOPASGN < TkOp - def initialize(seek, line_no, char_no, op) - super(seek, line_no, char_no) - op = TkReading2Token[op][0] unless op.kind_of?(Symbol) - @op = op - @text = nil - end - - attr_reader:op - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.op == @op - end - - def text - @text ||= "#{TkToken2Reading[op]}=" - end - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @op] - end - - end - - class TkUnknownChar < Token - def initialize(seek, line_no, char_no, name) - super(seek, line_no, char_no) - @name = name - end - attr_reader:name - - def ==(other) - self.class == other.class and - other.line_no == @line_no and - other.char_no == @char_no and - other.name == @name - end - - def set_text text - @name = text - self - end - - alias text name - - def inspect # :nodoc: - klass = self.class.name.split('::').last - "{%s %d, %d:%d %p}" % [klass, @seek, @line_no, @char_no, @name] - end - - end - - class TkError < Token - end - - def Token(token, value = nil) - value ||= TkToken2Reading[token] - - case token - when String - if (tk = TkReading2Token[token]).nil? - IRB.fail TkReading2TokenNoKey, token - end - - tk = Token(tk[0], value) - - if tk.kind_of?(TkOp) then - tk.name = token - end - when Symbol - if (tk = TkSymbol2Token[token]).nil? - IRB.fail TkSymbol2TokenNoKey, token - end - - tk = Token(tk[0], value) - else - if token.instance_method(:initialize).arity == 3 then - tk = token.new(@prev_seek, @prev_line_no, @prev_char_no) - tk.set_text value - else - tk = token.new(@prev_seek, @prev_line_no, @prev_char_no, value) - end - end - - tk - end - - TokenDefinitions = [ - [:TkCLASS, TkKW, "class", :EXPR_CLASS], - [:TkMODULE, TkKW, "module", :EXPR_BEG], - [:TkDEF, TkKW, "def", :EXPR_FNAME], - [:TkUNDEF, TkKW, "undef", :EXPR_FNAME], - [:TkBEGIN, TkKW, "begin", :EXPR_BEG], - [:TkRESCUE, TkKW, "rescue", :EXPR_MID], - [:TkENSURE, TkKW, "ensure", :EXPR_BEG], - [:TkEND, TkKW, "end", :EXPR_END], - [:TkIF, TkKW, "if", :EXPR_BEG, :TkIF_MOD], - [:TkUNLESS, TkKW, "unless", :EXPR_BEG, :TkUNLESS_MOD], - [:TkTHEN, TkKW, "then", :EXPR_BEG], - [:TkELSIF, TkKW, "elsif", :EXPR_BEG], - [:TkELSE, TkKW, "else", :EXPR_BEG], - [:TkCASE, TkKW, "case", :EXPR_BEG], - [:TkWHEN, TkKW, "when", :EXPR_BEG], - [:TkWHILE, TkKW, "while", :EXPR_BEG, :TkWHILE_MOD], - [:TkUNTIL, TkKW, "until", :EXPR_BEG, :TkUNTIL_MOD], - [:TkFOR, TkKW, "for", :EXPR_BEG], - [:TkBREAK, TkKW, "break", :EXPR_MID], - [:TkNEXT, TkKW, "next", :EXPR_END], - [:TkREDO, TkKW, "redo", :EXPR_END], - [:TkRETRY, TkKW, "retry", :EXPR_END], - [:TkIN, TkKW, "in", :EXPR_BEG], - [:TkDO, TkKW, "do", :EXPR_BEG], - [:TkRETURN, TkKW, "return", :EXPR_MID], - [:TkYIELD, TkKW, "yield", :EXPR_ARG], - [:TkSUPER, TkKW, "super", :EXPR_ARG], - [:TkSELF, TkKW, "self", :EXPR_END], - [:TkNIL, TkKW, "nil", :EXPR_END], - [:TkTRUE, TkKW, "true", :EXPR_END], - [:TkFALSE, TkKW, "false", :EXPR_END], - [:TkAND, TkKW, "and", :EXPR_BEG], - [:TkOR, TkKW, "or", :EXPR_BEG], - [:TkNOT, TkKW, "not", :EXPR_BEG], - [:TkIF_MOD, TkKW], - [:TkUNLESS_MOD, TkKW], - [:TkWHILE_MOD, TkKW], - [:TkUNTIL_MOD, TkKW], - [:TkALIAS, TkKW, "alias", :EXPR_FNAME], - [:TkDEFINED, TkKW, "defined?", :EXPR_ARG], - [:TklBEGIN, TkKW, "BEGIN", :EXPR_END], - [:TklEND, TkKW, "END", :EXPR_END], - [:Tk__LINE__, TkKW, "__LINE__", :EXPR_END], - [:Tk__FILE__, TkKW, "__FILE__", :EXPR_END], - [:Tk__ENCODING__,TkKW, "__ENCODING__", :EXPR_END], - - [:TkIDENTIFIER, TkId], - [:TkFID, TkId], - [:TkGVAR, TkId], - [:TkCVAR, TkId], - [:TkIVAR, TkId], - [:TkCONSTANT, TkId], - [:TkHEREDOCBEG, TkId], - [:TkHEREDOCEND, TkId], - - [:TkINTEGER, TkVal], - [:TkFLOAT, TkVal], - [:TkRATIONAL, TkVal], - [:TkIMAGINARY, TkVal], - [:TkSTRING, TkVal], - [:TkHEREDOC, TkVal], - [:TkXSTRING, TkVal], - [:TkREGEXP, TkVal], - [:TkSYMBOL, TkVal], - [:TkCHAR, TkVal], - - [:TkDSTRING, TkNode], - [:TkDXSTRING, TkNode], - [:TkDREGEXP, TkNode], - [:TkNTH_REF, TkNode], - [:TkBACK_REF, TkNode], - - [:TkUPLUS, TkOp, "+@"], - [:TkUMINUS, TkOp, "-@"], - [:TkPOW, TkOp, "**"], - [:TkCMP, TkOp, "<=>"], - [:TkEQ, TkOp, "=="], - [:TkEQQ, TkOp, "==="], - [:TkNEQ, TkOp, "!="], - [:TkGEQ, TkOp, ">="], - [:TkLEQ, TkOp, "<="], - [:TkHASHROCKET, TkOp, "=>"], - [:TkANDOP, TkOp, "&&"], - [:TkOROP, TkOp, "||"], - [:TkMATCH, TkOp, "=~"], - [:TkNMATCH, TkOp, "!~"], - [:TkDOT2, TkOp, ".."], - [:TkDOT3, TkOp, "..."], - [:TkAREF, TkOp, "[]"], - [:TkASET, TkOp, "[]="], - [:TkLSHFT, TkOp, "<<"], - [:TkRSHFT, TkOp, ">>"], - [:TkCOLON2, TkOp, '::'], - [:TkCOLON3, TkOp, '::'], - #[:OPASGN, TkOp], # +=, -= etc. # - [:TkASSOC, TkOp, "=>"], - [:TkLAMBDA, TkOp, "->"], - [:TkQUESTION, TkOp, "?"], #? - [:TkCOLON, TkOp, ":"], #: - - [:TkfLPAREN, Token, "("], # func( # - [:TkfLBRACK, Token, "["], # func[ # - [:TkfLBRACE, Token, "{"], # func{ # - [:TkSYMBEG, Token, ":"], # :SYMBOL - - [:TkAMPER, TkOp, "&"], - [:TkGT, TkOp, ">"], - [:TkLT, TkOp, "<"], - [:TkPLUS, TkOp, "+"], - [:TkSTAR, TkOp, "*"], - [:TkMINUS, TkOp, "-"], - [:TkMULT, TkOp, "*"], - [:TkDIV, TkOp, "/"], - [:TkMOD, TkOp, "%"], - [:TkBITOR, TkOp, "|"], - [:TkBITXOR, TkOp, "^"], - [:TkBITAND, TkOp, "&"], - [:TkBITNOT, TkOp, "~"], - [:TkNOTOP, TkOp, "!"], - - [:TkBACKQUOTE, TkOp, "`"], - - [:TkASSIGN, Token, "="], - [:TkDOT, Token, "."], - [:TkSAFENAV, Token, "&."], - [:TkLPAREN, Token, "("], #(exp) - [:TkLBRACK, Token, "["], #[arry] - [:TkLBRACE, Token, "{"], #{hash} - [:TkRPAREN, Token, ")"], - [:TkRBRACK, Token, "]"], - [:TkRBRACE, Token, "}"], - [:TkCOMMA, Token, ","], - [:TkSEMICOLON, Token, ";"], - - [:TkCOMMENT, TkVal], - [:TkSPACE, Token, " "], - [:TkNL, Token, "\n"], - [:TkEND_OF_SCRIPT], - - [:TkBACKSLASH, TkUnknownChar, "\\"], - [:TkAT, TkUnknownChar, "@"], - [:TkDOLLAR, TkUnknownChar, "$"], - ] - - # {reading => token_class} - # {reading => [token_class, *opt]} - TkReading2Token = {} - TkToken2Reading = {} - TkSymbol2Token = {} - - def self.def_token(token_n, super_token = Token, reading = nil, *opts) - token_n = token_n.id2name if token_n.kind_of?(Symbol) - if const_defined?(token_n) - IRB.fail AlreadyDefinedToken, token_n - end - token_c = eval("class #{token_n} < #{super_token}; end; #{token_n}") - - if reading - TkToken2Reading[token_c] = reading - - return if TkReading2Token[reading] - - if opts.empty? - TkReading2Token[reading] = [token_c] - else - TkReading2Token[reading] = [token_c].concat(opts) - end - end - TkSymbol2Token[token_n.intern] = token_c - end - - for defs in TokenDefinitions - def_token(*defs) - end - - def_token :TkRD_COMMENT, TkCOMMENT - - NEWLINE_TOKEN = TkNL.new 0, 0, 0, "\n" - - class TkSYMBOL - - def to_sym - @sym ||= text[1..-1].intern - end - - end - - # :startdoc: -end - From 4c5251f127903628bbcec5ba4a1861fbf5d2efff Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Thu, 28 Sep 2017 19:16:32 +0900 Subject: [PATCH 0423/1389] Fix CodeFence with unintended Array for format The rule ( !"`" Nonspacechar )+ for "format" variable becomes Array but #intern is called for "format" variable and it means "format" variable is expected as String, so this commit adds checking instance_of?(String). --- lib/rdoc/markdown.kpeg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 34f4de4657..e08aa5b828 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -1161,7 +1161,7 @@ CodeFence = &{ github? } @Newline )+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text - verbatim.format = format.intern if format + verbatim.format = format.intern if format.instance_of?(String) verbatim } From 07492e929ba540f6006d55724d8d269de8c9aba0 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Fri, 29 Sep 2017 00:03:17 +0900 Subject: [PATCH 0424/1389] Add test_code_fence_with_unintended_array --- test/test_rdoc_markdown.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_rdoc_markdown.rb b/test/test_rdoc_markdown.rb index 6c7bf4ae32..79b0175293 100644 --- a/test/test_rdoc_markdown.rb +++ b/test/test_rdoc_markdown.rb @@ -973,6 +973,14 @@ def test_strong assert_equal '_emphasis_', @parser.strong('_emphasis_') end + def test_code_fence_with_unintended_array + doc = parse '``````' + + expected = doc(verb('')) + + assert_equal expected, doc + end + def parse text @parser.parse text end From 89ed3d2ddb26ea942aa75465bd706a3457f8cf3c Mon Sep 17 00:00:00 2001 From: Yuji Yaginuma Date: Fri, 29 Sep 2017 10:12:13 +0900 Subject: [PATCH 0425/1389] Fix typo --- lib/rdoc/i18n.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb index 20848aad75..14a3739c1c 100644 --- a/lib/rdoc/i18n.rb +++ b/lib/rdoc/i18n.rb @@ -1,6 +1,6 @@ # frozen_string_literal: false ## -# This module provides i18n realated features. +# This module provides i18n related features. module RDoc::I18n From 48b14ac5a2374d098401a9bb50e44eefc029a62b Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Fri, 29 Sep 2017 23:14:21 +0900 Subject: [PATCH 0426/1389] Fix broken links --- CONTRIBUTING.rdoc | 8 ++++---- README.rdoc | 2 +- lib/rdoc/generator/template/darkfish/_footer.rhtml | 4 ++-- lib/rdoc/markup.rb | 4 ++-- lib/rdoc/servlet.rb | 2 +- test/test_rdoc_markup_to_html_snippet.rb | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.rdoc b/CONTRIBUTING.rdoc index 8cdbc7abe4..b5c551c77a 100644 --- a/CONTRIBUTING.rdoc +++ b/CONTRIBUTING.rdoc @@ -8,7 +8,7 @@ classes for each feature. == Bugs If you think you found a bug, file a ticket on the {issues -tracker}[https://github.com/rdoc/rdoc/issues] on github. +tracker}[https://github.com/ruby/rdoc/issues] on github. If your bug involves an error RDoc produced please include a sample file that illustrates the problem or link to the repository or gem that is associated @@ -17,8 +17,8 @@ with the bug. Please include steps to reproduce the issue. Here are some examples of good issues: -* https://github.com/rdoc/rdoc/issues/55 -* https://github.com/rdoc/rdoc/issues/61 +* https://github.com/ruby/rdoc/issues/55 +* https://github.com/ruby/rdoc/issues/61 == Developer Quick Start @@ -35,7 +35,7 @@ This will install all the necessary dependencies for development with rake, generate documentation and run the tests for the first time. If the tests don't pass on the first run check the {Travis CI page for -RDoc}[https://travis-ci.org/rdoc/rdoc] to see if there are any known failures +RDoc}[https://travis-ci.org/ruby/rdoc] to see if there are any known failures (there shouldn't be). You can now use `rake` and `autotest` to run the tests. diff --git a/README.rdoc b/README.rdoc index 3403cdc6b2..1ab223b1c2 100644 --- a/README.rdoc +++ b/README.rdoc @@ -47,7 +47,7 @@ contain just Markup-style markup (with or without leading '#' comment markers). If directory names are passed to RDoc, they are scanned recursively for C and Ruby source files only. -To generate documentation using +rake+ see RDoc::Task[https://rdoc.github.io/rdoc/RDocTask.html]. +To generate documentation using +rake+ see RDoc::Task[https://ruby.github.io/rdoc/RDocTask.html]. To generate documentation programmatically: diff --git a/lib/rdoc/generator/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml index 7c4debd1f7..9791b42901 100644 --- a/lib/rdoc/generator/template/darkfish/_footer.rhtml +++ b/lib/rdoc/generator/template/darkfish/_footer.rhtml @@ -1,5 +1,5 @@ diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb index 3406522596..982bc13e88 100644 --- a/lib/rdoc/markup.rb +++ b/lib/rdoc/markup.rb @@ -377,7 +377,7 @@ # # Example links: # -# https://github.com/rdoc/rdoc +# https://github.com/ruby/rdoc # mailto:user@example.com # {RDoc Documentation}[http://rdoc.rubyforge.org] # {RDoc Markup}[rdoc-ref:RDoc::Markup] @@ -764,7 +764,7 @@ def self.parse str Please file a bug report with the above information at: -https://github.com/rdoc/rdoc/issues +https://github.com/ruby/rdoc/issues EOF raise diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index 90f403bc64..dfc71436b8 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -217,7 +217,7 @@ def error exception, req, res
#{ERB::Util.html_escape exception.message}

Please report this to the -RDoc issues tracker. Please +RDoc issues tracker. Please include the RDoc version, the URI above and exception class, message and backtrace. If you're viewing a gem's documentation, include the gem name and version. If you're viewing Ruby's documentation, include the version of ruby. diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index d180f551c9..19c534863e 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -494,9 +494,9 @@ def test_convert_limit_paragraphs rdoc = <<-RDOC = \RDoc - Ruby Documentation System -* {RDoc Project Page}[https://github.com/rdoc/rdoc/] -* {RDoc Documentation}[https://rdoc.github.io/rdoc] -* {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues] +* {RDoc Project Page}[https://github.com/ruby/rdoc] +* {RDoc Documentation}[https://ruby.github.io/rdoc] +* {RDoc Bug Tracker}[https://github.com/ruby/rdoc/issues] == DESCRIPTION: From 1557d21b4e1af76e950e536bbb106c0449042007 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Sat, 30 Sep 2017 09:21:47 +0900 Subject: [PATCH 0427/1389] Remove RDoc::RubyLex::Error for rescue --- lib/rdoc/markup/to_html.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 98ed7926fd..d2c9a23a79 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -206,7 +206,7 @@ def accept_verbatim verbatim result = RDoc::TokenStream.to_html tokens result = result + "\n" unless "\n" == result[-1] result - rescue RDoc::RubyLex::Error + rescue CGI.escapeHTML text end else From 594577079ed057c7fee296e85f525476c1597a1c Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Tue, 3 Oct 2017 05:36:42 +0900 Subject: [PATCH 0428/1389] Support did_you_mean DidYouMean::SpellChecker exists Ruby 2.3 or later, did_you_mean gem is adopted as standard library. The did_you_mean gem can be used as a library via DidYouMean::SpellChecker at 1.0.3 or later, so checks that the class is defined and uses it. And then, this feature will become enabled if the gem 1.0.3 or later is installed. --- lib/rdoc/ri/driver.rb | 60 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 8e68f72d53..fd43f062df 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -47,13 +47,24 @@ class Error < RDoc::RI::Error; end class NotFoundError < Error + def initialize(klass, suggestions = nil) # :nodoc: + @klass = klass + @suggestions = suggestions + end + ## # Name that wasn't found - alias name message + def name + @klass + end def message # :nodoc: - "Nothing known about #{super}" + str = "Nothing known about #{@klass}" + if @suggestions and !@suggestions.empty? + str += "\nDid you mean? #{@suggestions.join("\n ")}" + end + str end end @@ -917,13 +928,38 @@ def display_page_list store, pages = store.cache[:pages], search = nil display out end + def check_did_you_mean # :nodoc: + if defined? DidYouMean::SpellChecker + true + else + begin + require 'did_you_mean' + if defined? DidYouMean::SpellChecker + true + else + false + end + rescue + false + end + end + end + ## # Expands abbreviated klass +klass+ into a fully-qualified class. "Zl::Da" # will be expanded to Zlib::DataError. def expand_class klass - ary = classes.keys.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z")) - raise NotFoundError, klass if ary.length != 1 && ary.first != klass + class_names = classes.keys + ary = class_names.grep(Regexp.new("\\A#{klass.gsub(/(?=::|\z)/, '[^:]*')}\\z")) + if ary.length != 1 && ary.first != klass + if check_did_you_mean + suggestions = DidYouMean::SpellChecker.new(dictionary: class_names).correct(klass) + raise NotFoundError.new(klass, suggestions) + else + raise NotFoundError, klass + end + end ary.first end @@ -1235,7 +1271,21 @@ def load_methods_matching name def lookup_method name found = load_methods_matching name - raise NotFoundError, name if found.empty? + if found.empty? + if check_did_you_mean + methods = [] + _, _, method_name = parse_name name + find_methods name do |store, klass, ancestor, types, method| + methods.push(*store.class_methods[klass]) if [:class, :both].include? types + methods.push(*store.instance_methods[klass]) if [:instance, :both].include? types + end + methods = methods.uniq + suggestions = DidYouMean::SpellChecker.new(dictionary: methods).correct(method_name) + raise NotFoundError.new(name, suggestions) + else + raise NotFoundError, name + end + end filter_methods found, name end From e492a67388c8d1826c43e47108b9ab88119b0271 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Tue, 3 Oct 2017 06:05:18 +0900 Subject: [PATCH 0429/1389] Add test_did_you_mean --- test/test_rdoc_ri_driver.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 1aa4762f92..81c8469e25 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -969,6 +969,27 @@ def test_find_store assert_equal 'nonexistent', e.name end + def test_did_you_mean + skip 'skip test with did_you_men' unless defined? DidYouMean::SpellChecker + + util_ancestors_store + + e = assert_raises RDoc::RI::Driver::NotFoundError do + @driver.lookup_method 'Foo.i_methdo' + end + assert_equal "Nothing known about Foo.i_methdo\nDid you mean? i_method", e.message + + e = assert_raises RDoc::RI::Driver::NotFoundError do + @driver.lookup_method 'Foo#i_methdo' + end + assert_equal "Nothing known about Foo#i_methdo\nDid you mean? i_method", e.message + + e = assert_raises RDoc::RI::Driver::NotFoundError do + @driver.lookup_method 'Foo::i_methdo' + end + assert_equal "Nothing known about Foo::i_methdo\nDid you mean? c_method", e.message + end + def test_formatter tty = Object.new def tty.tty?() true; end From b7dfb9c9b79f91eecc8ba57bf269db1d9d6e140b Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Tue, 3 Oct 2017 06:19:10 +0900 Subject: [PATCH 0430/1389] Specify LoadError for rescue LoadError isn't caught by rescue without class because the default exception class for rescue is StandardError. --- lib/rdoc/ri/driver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index fd43f062df..51d633be58 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -939,7 +939,7 @@ def check_did_you_mean # :nodoc: else false end - rescue + rescue LoadError false end end From 519ae4dc939da0dd777476be3307f89564445802 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 3 Oct 2017 09:33:00 -0500 Subject: [PATCH 0431/1389] Add trunk to appveyor, change ubygems to rubygems --- Rakefile | 4 ++-- appveyor.yml | 30 ++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index bd267f96cc..9a37e8fad1 100644 --- a/Rakefile +++ b/Rakefile @@ -62,11 +62,11 @@ parsed_files = PARSER_FILES.map do |parser_file| if parser_file =~ /\.ry\z/ # need racc racc = Gem.bin_path 'racc', 'racc' rb_file = parser_file.gsub(/\.ry\z/, ".rb") - ruby "-rubygems #{racc} -l -o #{rb_file} #{parser_file}" + ruby "-rrubygems #{racc} -l -o #{rb_file} #{parser_file}" elsif parser_file =~ /\.kpeg\z/ # need kpeg kpeg = Gem.bin_path 'kpeg', 'kpeg' rb_file = parser_file.gsub(/\.kpeg\z/, ".rb") - ruby "-rubygems #{kpeg} -fsv -o #{rb_file} #{parser_file}" + ruby "-rrubygems #{kpeg} -fsv -o #{rb_file} #{parser_file}" end end diff --git a/appveyor.yml b/appveyor.yml index 5ec4b4e915..93e7745823 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,18 +1,32 @@ --- +init: + # To avoid duplicated executables in PATH, see https://github.com/ruby/spec/pull/468 + - set PATH=C:\ruby%RUBY_VERSION%\bin;C:\msys64\usr\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Program Files;C:\Windows + # Loads trunk build and updates MSYS2 / MinGW to most recent gcc compiler + - if %ruby_version%==_trunk ( + appveyor DownloadFile %APPVEYOR_URL%/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z -FileName C:\ruby_trunk.7z & + 7z x C:\ruby_trunk.7z -oC:\ruby_trunk) + install: - - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% - - gem install bundler --no-document - bundle install + build: off + test_script: - rake + +on_finish: + - ruby -v + deploy: off + environment: NOBENCHMARK: 1 matrix: - - ruby_version: "22" - - ruby_version: "22-x64" - - ruby_version: "23" - - ruby_version: "23-x64" - - ruby_version: "24" - - ruby_version: "24-x64" + - ruby_version: 22 + - ruby_version: 22-x64 + - ruby_version: 23 + - ruby_version: 23-x64 + - ruby_version: 24 + - ruby_version: 24-x64 + - ruby_version: _trunk From c9a82b0305a8aa97957d154b0d12fdfeee651b81 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Wed, 4 Oct 2017 18:13:35 +0900 Subject: [PATCH 0432/1389] Use Ruby 2.4.2, 2.3.5, 2.2.8 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 38c19852e6..7dff74823d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ before_install: - gem install bundler --no-document language: ruby rvm: - - 2.2.7 - - 2.3.4 - - 2.4.1 + - 2.2.8 + - 2.3.5 + - 2.4.2 - ruby-head - jruby-9.1.13.0 env: From f6d0c6cd1a5b8bbecdf02475f429174a6e17391d Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Fri, 6 Oct 2017 16:27:03 +0900 Subject: [PATCH 0433/1389] Remove RDoc::Parser.process_directive This is deprecated, and deprecated messages is outputed for 6 years. --- lib/rdoc/parser.rb | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index ead96b3f50..823a6d014c 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -87,31 +87,6 @@ def self.binary?(file) not s.valid_encoding? end - ## - # Processes common directives for CodeObjects for the C and Ruby parsers. - # - # Applies +directive+'s +value+ to +code_object+, if appropriate - - def self.process_directive code_object, directive, value - warn "RDoc::Parser::process_directive is deprecated and wil be removed in RDoc 4. Use RDoc::Markup::PreProcess#handle_directive instead" if $-w - - case directive - when 'nodoc' then - code_object.document_self = nil # notify nodoc - code_object.document_children = value.downcase != 'all' - when 'doc' then - code_object.document_self = true - code_object.force_documentation = true - when 'yield', 'yields' then - # remove parameter &block - code_object.params.sub!(/,?\s*&\w+/, '') if code_object.params - - code_object.block_params = value - when 'arg', 'args' then - code_object.params = value - end - end - ## # Checks if +file+ is a zip file in disguise. Signatures from # http://www.garykessler.net/library/file_sigs.html From 00d7eb7dcf99321383d380fb6bd0f4a467939b40 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 09:46:15 +0900 Subject: [PATCH 0434/1389] Remove needless library lock with gem methods. This code inserted at https://github.com/ruby/rdoc/commit/978cd909829806527a2f76e1cf98e64cc5dc8e49 But current rdoc/text.rb implementation did not use JSON library. --- lib/rdoc/text.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index cf708e6bbd..88ff255f01 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -5,16 +5,6 @@ require 'strscan' -## -# For RDoc::Text#snippet - -begin - gem 'json' -rescue NameError => e # --disable-gems - raise unless e.name == :gem -rescue Gem::LoadError -end - ## # Methods for manipulating comment text From 6fd4e1c8aeaac63280c65b21f0ff272816927656 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 10:34:09 +0900 Subject: [PATCH 0435/1389] Removed needless -rrubygems option --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 9a37e8fad1..bb86e99d5e 100644 --- a/Rakefile +++ b/Rakefile @@ -62,11 +62,11 @@ parsed_files = PARSER_FILES.map do |parser_file| if parser_file =~ /\.ry\z/ # need racc racc = Gem.bin_path 'racc', 'racc' rb_file = parser_file.gsub(/\.ry\z/, ".rb") - ruby "-rrubygems #{racc} -l -o #{rb_file} #{parser_file}" + ruby "#{racc} -l -o #{rb_file} #{parser_file}" elsif parser_file =~ /\.kpeg\z/ # need kpeg kpeg = Gem.bin_path 'kpeg', 'kpeg' rb_file = parser_file.gsub(/\.kpeg\z/, ".rb") - ruby "-rrubygems #{kpeg} -fsv -o #{rb_file} #{parser_file}" + ruby "#{kpeg} -fsv -o #{rb_file} #{parser_file}" end end From 3eb1b14b128248607a960aec99490ca09aa92ce8 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 10:39:21 +0900 Subject: [PATCH 0436/1389] Added simple description for kpeg task --- Rakefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index bb86e99d5e..4108582b1d 100644 --- a/Rakefile +++ b/Rakefile @@ -74,9 +74,11 @@ parsed_files = PARSER_FILES.map do |parser_file| end task "#{path}.gem" => package_parser_files -task :generate => parsed_files task :check_manifest => :generate +desc "Genrate all files used racc and kpeg" +task :generate => parsed_files + # These tasks expect to have the following directory structure: # # git/git.rubini.us/code # Rubinius git HEAD checkout From a91b46664a796c7c1203ae5947381c023cbdd8b9 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 10:42:05 +0900 Subject: [PATCH 0437/1389] Added @aycabta to authors --- rdoc.gemspec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 8aadb510e2..8ade7de923 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -16,9 +16,10 @@ Gem::Specification.new do |s| "Phil Hagelberg", "Tony Strauss", "Zachary Scott", - "Hiroshi SHIBATA" + "Hiroshi SHIBATA", + "ITOYANAGI Sakura" ] - s.email = ["drbrain@segment7.net", "", "", "", "mail@zzak.io", "hsbt@ruby-lang.org"] + s.email = ["drbrain@segment7.net", "", "", "", "mail@zzak.io", "hsbt@ruby-lang.org", "aycabta@gmail.com"] s.summary = "RDoc produces HTML and command-line documentation for Ruby projects" s.description = <<-DESCRIPTION From e8fa85912b63d1d857564fbcc9a95fc99df15c46 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 10:42:31 +0900 Subject: [PATCH 0438/1389] bump version to 6.0.0.beta3 --- lib/rdoc.rb | 2 +- rdoc.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 3856468421..56411e6a04 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.0.beta2' + VERSION = '6.0.0.beta3' ## # Method visibilities diff --git a/rdoc.gemspec b/rdoc.gemspec index 8ade7de923..7187bcaf2e 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -8,7 +8,7 @@ end Gem::Specification.new do |s| s.name = "rdoc" s.version = RDoc::VERSION - s.date = "2017-09-12" + s.date = "2017-10-10" s.authors = [ "Eric Hodel", From 9bed2e17ee2ac8619afbac9189ebb51a1092847a Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 10:46:18 +0900 Subject: [PATCH 0439/1389] Update Gem::Specification#files --- rdoc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 7187bcaf2e..2787f07654 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -33,7 +33,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "lib/rdoc/markdown/literals.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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "lib/rdoc/markdown/literals.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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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", "rdoc.gemspec"] # files from .gitignore s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" From a5804225accc4819612b6dcc4a7674b1bfca1504 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 13:51:59 +0900 Subject: [PATCH 0440/1389] Removed RubyToken test --- lib/rdoc.rb | 1 - test/test_rdoc_ruby_token.rb | 20 -------------------- 2 files changed, 21 deletions(-) delete mode 100644 test/test_rdoc_ruby_token.rb diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 56411e6a04..af05b57116 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -149,7 +149,6 @@ def self.load_yaml autoload :KNOWN_CLASSES, 'rdoc/known_classes' autoload :RipperStateLex, 'rdoc/parser/ripper_state_lex' - autoload :RubyToken, 'rdoc/ruby_token' autoload :TokenStream, 'rdoc/token_stream' autoload :Comment, 'rdoc/comment' diff --git a/test/test_rdoc_ruby_token.rb b/test/test_rdoc_ruby_token.rb deleted file mode 100644 index 4638606ef3..0000000000 --- a/test/test_rdoc_ruby_token.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: false -require 'rdoc/test_case' - -class TestRDocRubyToken < RDoc::TestCase - - def test_Token_text - token = RDoc::RubyToken::Token.new 0, 0, 0, 'text' - - assert_equal 'text', token.text - end - - def test_TkOp_name - token = RDoc::RubyToken::TkOp.new 0, 0, 0, '&' - - assert_equal '&', token.text - assert_equal '&', token.name - end - -end - From 34c89b0723128f6ed326f1e56312da2aa450beaa Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 10 Oct 2017 14:54:34 +0900 Subject: [PATCH 0441/1389] Removed useless method related RubyToken. --- test/test_rdoc_parser_ruby.rb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index e9e3fcf246..26b8d72c28 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -3758,21 +3758,6 @@ class Baz assert_equal 'there', baz.comment.text end - def tk klass, scan, line, char, name, text - klass = RDoc::RubyToken.const_get "Tk#{klass.to_s.upcase}" - - token = if klass.instance_method(:initialize).arity == 3 then - raise ArgumentError, "name not used for #{klass}" if name - klass.new scan, line, char - else - klass.new scan, line, char, name - end - - token.set_text text - - token - end - def util_parser(content) @parser = RDoc::Parser::Ruby.new @top_level, @filename, content, @options, @stats From f466dc6489d5a189e7cffec64bb0b23b621ab918 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Tue, 10 Oct 2017 20:59:08 +0900 Subject: [PATCH 0442/1389] Use `tr_s` instead of `tr` and `squeeze` --- lib/rdoc/any_method.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index c5cb9c079a..5dbdf9e0ef 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -265,7 +265,7 @@ def param_seq params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2') elsif @params then params = @params.gsub(/\s*\#.*/, '') - params = params.tr("\n", " ").squeeze(" ") + params = params.tr_s("\n ", " ") params = "(#{params})" unless params[0] == ?( else params = '' @@ -276,7 +276,7 @@ def param_seq # &block params.sub!(/,?\s*&\w+/, '') - block = @block_params.tr("\n", " ").squeeze(" ") + block = @block_params.tr_s("\n ", " ") if block[0] == ?( block.sub!(/^\(/, '').sub!(/\)/, '') end From 57b30aa402f3a82d578c1df8de0a468f5a493e62 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Wed, 11 Oct 2017 23:25:47 +0900 Subject: [PATCH 0443/1389] Support :args: directive before method The :args: directive is supported only by after "def" keyword line like below: def method_with_args_comment(*array) # :args: a, b, c end # => documented as method_with_args_comment(a, b, c) This commit changes to support like below: ## # :args: a, b, c def meth(*array) end # => documented as meth(a, b, c) --- lib/rdoc/markup/pre_process.rb | 2 +- lib/rdoc/parser/ruby.rb | 9 ++++++--- test/test_rdoc_parser_ruby.rb | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb index 6ce523be89..e2115f0c56 100644 --- a/lib/rdoc/markup/pre_process.rb +++ b/lib/rdoc/markup/pre_process.rb @@ -150,7 +150,7 @@ def handle_directive prefix, directive, param, code_object = nil, case directive when 'arg', 'args' then - return "#{prefix}:#{directive}: #{param}\n" unless code_object + return "#{prefix}:#{directive}: #{param}\n" unless code_object && code_object.kind_of?(RDoc::AnyMethod) code_object.params = param diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index c81f152b56..a840fd6614 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -574,14 +574,15 @@ def suppress_parents container, ancestor # :nodoc: # # This routine modifies its +comment+ parameter. - def look_for_directives_in context, comment - @preprocess.handle comment, context do |directive, param| + def look_for_directives_in container, comment + @preprocess.handle comment, container do |directive, param| case directive when 'method', 'singleton-method', 'attr', 'attr_accessor', 'attr_reader', 'attr_writer' then false # handled elsewhere when 'section' then - context.set_current_section param, comment.dup + break unless container.kind_of?(RDoc::Context) + container.set_current_section param, comment.dup comment.text = '' break end @@ -1290,6 +1291,7 @@ def parse_meta_method_params container, single, meth, tk, comment # :nodoc: token_listener meth do meth.params = '' + look_for_directives_in meth, comment comment.normalize comment.extract_call_seq meth @@ -1336,6 +1338,7 @@ def parse_method(container, single, tk, comment) return unless name meth = RDoc::AnyMethod.new get_tkread, name + look_for_directives_in meth, comment meth.singleton = single == SINGLE ? true : singleton record_location meth diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index e9e3fcf246..fa607ab87f 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1762,6 +1762,28 @@ def test_parse_redefinable_methods end end + def test_parse_method_with_args_directive + util_parser <<-RUBY +class C + def meth_with_args_after # :args: a, b, c + end + + ## + # :args: d, e, f + def meth_with_args_before +end + RUBY + + @parser.scan + + c = @store.find_class_named 'C' + + assert_equal 'C#meth_with_args_after', c.method_list[0].full_name + assert_equal 'a, b, c', c.method_list[0].params + assert_equal 'C#meth_with_args_before', c.method_list[1].full_name + assert_equal 'd, e, f', c.method_list[1].params + end + def test_parse_method_bracket util_parser <<-RUBY class C From e629a82b70c58994bc7725b6a3009bd675d94288 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Thu, 12 Oct 2017 00:01:49 +0900 Subject: [PATCH 0444/1389] Remove comment against RubyLex and RubyToken --- lib/rdoc/parser/ruby_tools.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb index 0a566827a5..ecd7065e4f 100644 --- a/lib/rdoc/parser/ruby_tools.rb +++ b/lib/rdoc/parser/ruby_tools.rb @@ -1,7 +1,6 @@ # frozen_string_literal: false ## -# Collection of methods for writing parsers against RDoc::RubyLex and -# RDoc::RubyToken +# Collection of methods for writing parsers module RDoc::Parser::RubyTools From 499c029c7d530bcf69c6e4cbb9129af8e0d1d1e6 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Sat, 14 Oct 2017 19:46:48 +0900 Subject: [PATCH 0445/1389] Handle all definitions per file RDoc::Parser::C cann't discern each documents per file for one class, so RDoc::ClassModule adopts the latest comment per file, however RDoc::Parser::Ruby can take each documents per file for one class. This commit changes the behavior only when RDoc::ClassModule is for RDoc::Parser::C. Of course this works around RDoc::Parser::C. --- lib/rdoc/class_module.rb | 4 +++- test/test_rdoc_class_module.rb | 3 ++- test/test_rdoc_parser_c.rb | 19 +++++++++++++++++++ test/test_rdoc_parser_ruby.rb | 27 +++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb index 5881d6cf24..33a8baa6a6 100644 --- a/lib/rdoc/class_module.rb +++ b/lib/rdoc/class_module.rb @@ -136,7 +136,9 @@ def add_comment comment, location normalize_comment comment end - @comment_location.delete_if { |(_, l)| l == location } + if location.parser == RDoc::Parser::C + @comment_location.delete_if { |(_, l)| l == location } + end @comment_location << [comment, location] diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 7cbbcbcc52..503492fca5 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -42,7 +42,8 @@ def test_add_comment_duplicate cm.add_comment '# comment 1', tl1 cm.add_comment '# comment 2', tl1 - assert_equal [['comment 2', tl1]], cm.comment_location + assert_equal [['comment 1', tl1], + ['comment 2', tl1]], cm.comment_location end def test_add_comment_stopdoc diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 5341da16e2..77089a0ae4 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -357,6 +357,25 @@ def test_do_classes_class assert_equal "this is the Foo class", klass.comment.text end + def test_do_classes_duplicate_class + content = <<-EOF +/* Document-class: Foo + * first + */ +VALUE cFoo = rb_define_class("Foo", rb_cObject); +/* Document-class: Foo + * second + */ +VALUE cFoo = rb_define_class("Foo", rb_cObject); + EOF + + klass = util_get_class content, 'cFoo' + assert_equal 1, klass.comment_location.size + first = klass.comment_location.first + first_comment = first[0] + assert_equal 'first', first_comment.text + end + def test_do_classes_struct content = <<-EOF /* Document-class: Foo diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index e9e3fcf246..5d3cac66af 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -681,6 +681,32 @@ class Foo assert_equal @top_level, blah.file end + def test_parse_class_in_a_file_repeatedly + @filename = 'a.rb' + comment_a = RDoc::Comment.new "# aaa\n", @top_level + util_parser "class Foo\nend" + tk = @parser.get_tk + @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment_a + comment_b = RDoc::Comment.new "# bbb\n", @top_level + util_parser "class Foo\nend" + tk = @parser.get_tk + @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment_b + + @filename = 'b.rb' + comment_c = RDoc::Comment.new "# ccc\n", @top_level + util_parser "class Foo\nend" + tk = @parser.get_tk + @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment_c + + foo = @top_level.classes.first + assert_equal 'Foo', foo.full_name + assert_equal [[comment_a, @top_level], + [comment_b, @top_level], + [comment_c, @top_level]], foo.comment_location + assert_equal [@top_level], foo.in_files + assert_equal 1, foo.line + end + def test_parse_class_ghost_method_yields util_parser <<-CLASS class Foo @@ -3393,6 +3419,7 @@ module Foo foo = @top_level.modules.first expected = [ + RDoc::Comment.new('comment a', @top_level), RDoc::Comment.new('comment b', @top_level) ] From 57a4db7d8f38cb992afad6b9cfa6b8bb77a8e3f9 Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Mon, 16 Oct 2017 22:36:21 +0900 Subject: [PATCH 0446/1389] Fix for Ruby 2.5 warnings in tests --- test/test_rdoc_encoding.rb | 2 -- test/test_rdoc_parser_c.rb | 3 +++ test/test_rdoc_require.rb | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index 915f3ce5ec..e579fd5cc7 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -145,13 +145,11 @@ def test_class_set_encoding assert_equal Encoding::UTF_8, s.encoding s = "\n" - expected = s.encoding RDoc::Encoding.set_encoding s assert_equal Encoding::UTF_8, s.encoding s = "\n" - expected = s.encoding RDoc::Encoding.set_encoding s assert_equal Encoding::UTF_8, s.encoding diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 5341da16e2..d3d86d94fb 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -642,6 +642,7 @@ def test_do_methods_in_c klass = util_get_class content, 'cDate' end + assert_equal 'Date', klass.full_name assert_match ' blah.c ', err end @@ -664,6 +665,7 @@ def test_do_methods_in_cpp klass = util_get_class content, 'cDate' end + assert_equal 'Date', klass.full_name assert_match ' blah.cpp ', err end @@ -686,6 +688,7 @@ def test_do_methods_in_y klass = util_get_class content, 'cDate' end + assert_equal 'Date', klass.full_name assert_match ' blah.y ', err end diff --git a/test/test_rdoc_require.rb b/test/test_rdoc_require.rb index cbedf5c8a4..cfbdac7a57 100644 --- a/test/test_rdoc_require.rb +++ b/test/test_rdoc_require.rb @@ -12,13 +12,13 @@ def setup def test_initialize assert_equal 'foo', @req.name - req = RDoc::Require.new '"foo"', '' + RDoc::Require.new '"foo"', '' assert_equal 'foo', @req.name - req = RDoc::Require.new '\'foo\'', '' + RDoc::Require.new '\'foo\'', '' assert_equal 'foo', @req.name - req = RDoc::Require.new '|foo|', '' + RDoc::Require.new '|foo|', '' assert_equal 'foo', @req.name, 'for fortran?' end From aa0619755e141f5aef6b62b8fefcf30b4251e1eb Mon Sep 17 00:00:00 2001 From: Code Ahss Date: Tue, 17 Oct 2017 00:38:24 +0900 Subject: [PATCH 0447/1389] Fix for warnings on Ruby 2.5 in ERB binding ERB requires variable context as Binding object and Darkfish uses Kernel#binding for it, but it causes warnings "assigned but unused variable" on Ruby 1.9 or later, so there ware "suppress 1.9.3 warning" code like below: # suppress 1.9.3 warning variable = variable = expressions The "variable" variable is assigned but unused *at this scope* and used inside ERB template, so the double assign of "variable" is for suppress the warning. This code causes warning "assigned but unused variable" on Ruby 2.5 again. I fixed it with Binding#local_variable_set for "use" variable. --- lib/rdoc/generator/darkfish.rb | 68 ++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index e961518fcc..94e1320ded 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -313,12 +313,16 @@ def generate_index search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + asset_rel_prefix = rel_prefix + @asset_rel_path @title = @options.title - render_template template_file, out_file do |io| binding end + render_template template_file, out_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here + end rescue => e error = RDoc::Error.new \ "error generating index.html: #{e.message} (#{e.class})" @@ -343,14 +347,19 @@ def generate_class klass, template_file = nil search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path - svninfo = svninfo = get_svninfo(current) + asset_rel_prefix = rel_prefix + @asset_rel_path + svninfo = get_svninfo(current) @title = "#{klass.type} #{klass.full_name} - #{@options.title}" debug_msg " rendering #{out_file}" - render_template template_file, out_file do |io| binding end + render_template template_file, out_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here.local_variable_set(:svninfo, svninfo) + here + end end ## @@ -416,8 +425,7 @@ def generate_file_files search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + asset_rel_prefix = rel_prefix + @asset_rel_path unless filepage_file then if file.text? then @@ -434,7 +442,14 @@ def generate_file_files @title += " - #{@options.title}" template_file ||= filepage_file - render_template template_file, out_file do |io| binding end + putes template_file.inspect + render_template template_file, out_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here.local_variable_set(:current, current) + here + end end rescue => e error = @@ -458,14 +473,19 @@ def generate_page file search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - current = current = file - asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + current = file + asset_rel_prefix = rel_prefix + @asset_rel_path @title = "#{file.page_name} - #{@options.title}" debug_msg " rendering #{out_file}" - render_template template_file, out_file do |io| binding end + render_template template_file, out_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:current, current) + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here + end end ## @@ -483,12 +503,16 @@ def generate_servlet_not_found message search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - asset_rel_prefix = asset_rel_prefix = '' + asset_rel_prefix = '' @title = 'Not Found' - render_template template_file do |io| binding end + render_template template_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here + end rescue => e error = RDoc::Error.new \ "error generating servlet_not_found: #{e.message} (#{e.class})" @@ -540,12 +564,16 @@ def generate_table_of_contents search_index_rel_prefix = rel_prefix search_index_rel_prefix += @asset_rel_path if @file_output - # suppress 1.9.3 warning - asset_rel_prefix = asset_rel_prefix = rel_prefix + @asset_rel_path + asset_rel_prefix = rel_prefix + @asset_rel_path @title = "Table of Contents - #{@options.title}" - render_template template_file, out_file do |io| binding end + render_template template_file, out_file do |io| + here = binding + # suppress 1.9.3 warning + here.local_variable_set(:asset_rel_prefix, asset_rel_prefix) + here + end rescue => e error = RDoc::Error.new \ "error generating table_of_contents.html: #{e.message} (#{e.class})" From 67171e6c8e3ed31ea4fd35dc5627227f50cd3957 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 17 Oct 2017 17:47:17 +0900 Subject: [PATCH 0448/1389] Close leaked file descriptor. This patch is provided by @mame. Original commit is here: https://github.com/ruby/ruby/commit/2075bc51788e018c60c95c2f50442ad6092bba29 Fixed https://github.com/ruby/rdoc/issues/545 --- test/test_rdoc_generator_darkfish.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb index 352e9336ff..bbe351c0f6 100644 --- a/test/test_rdoc_generator_darkfish.rb +++ b/test/test_rdoc_generator_darkfish.rb @@ -215,6 +215,7 @@ def test_generated_method_with_html_tag_yield method_name_index = internal_file.index('method_with_html_tag_yield') last_of_method_name_index = method_name_index + internal_file[method_name_index..-1].index('

') - 1 method_name = internal_file[method_name_index..last_of_method_name_index] + f.close assert_includes method_name, '{ |%<<script>alert("atui")</script>>, yield_arg| ... }' end From 72ced08517274dc6bf165f714e1c65985d7444bd Mon Sep 17 00:00:00 2001 From: Code Ass Date: Thu, 19 Oct 2017 22:39:55 +0900 Subject: [PATCH 0449/1389] Don't use lex_state emulation on Ruby 2.5 or later RDoc::RipperStateLex has InnerStateLex that is emulation layer about lex_state of parse.y, but after Ruby 2.5 or later, Ripper gives lex_state value as state method inside Ripper::Filter's callback. On this commit, uses the new feature of Ripper on Ruby 2.5 or later. --- lib/rdoc/parser/ripper_state_lex.rb | 32 ++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index c9a0f5a21e..0aceda2108 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -1,6 +1,9 @@ require 'ripper' class RDoc::RipperStateLex + # TODO: Remove this constants after Ruby 2.4 EOL + RIPPER_HAS_LEX_STATE = (RUBY_VERSION >= '2.5.0') + EXPR_NONE = 0 EXPR_BEG = 1 EXPR_END = 2 @@ -283,7 +286,22 @@ def each(&block) @callback = block parse end - end + end unless RIPPER_HAS_LEX_STATE + + class InnerStateLex < Ripper::Filter + def initialize(code) + super(code) + end + + def on_default(event, tok, data) + @callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => state}) + end + + def each(&block) + @callback = block + parse + end + end if RIPPER_HAS_LEX_STATE def get_squashed_tk if @buf.empty? @@ -297,10 +315,10 @@ def get_squashed_tk when :on_tstring_beg then tk = get_string_tk(tk) when :on_backtick then - if (EXPR_FNAME & tk[:state]) != 0 - @inner_lex.lex_state = EXPR_ARG + if ((EXPR_FNAME | EXPR_ENDFN) & tk[:state]) != 0 + @inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE tk[:kind] = :on_ident - tk[:state] = @inner_lex.lex_state + tk[:state] = EXPR_ARG else tk = get_string_tk(tk) end @@ -310,7 +328,7 @@ def get_squashed_tk tk = get_embdoc_tk(tk) when :on_heredoc_beg then @heredoc_queue << retrieve_heredoc_info(tk) - @inner_lex.lex_state = EXPR_END + @inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then unless @heredoc_queue.empty? get_heredoc_tk(*@heredoc_queue.shift) @@ -541,9 +559,9 @@ def get_squashed_tk private def get_op_tk(tk) redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~] if redefinable_operators.include?(tk[:text]) and EXPR_ARG == tk[:state] then - @inner_lex.lex_state = EXPR_ARG + @inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE + tk[:state] = EXPR_ARG tk[:kind] = :on_ident - tk[:state] = @inner_lex.lex_state elsif tk[:text] =~ /^[-+]$/ then tk_ahead = get_squashed_tk case tk_ahead[:kind] From ee9d50abd0271eeaa10b5de0fe45d4b117e51309 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Wed, 25 Oct 2017 21:05:46 +0900 Subject: [PATCH 0450/1389] Use Ripper::Filter.method_defined?(:state) instead of RUBY_VERSION --- lib/rdoc/parser/ripper_state_lex.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 0aceda2108..cd3d799cdf 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -2,7 +2,7 @@ class RDoc::RipperStateLex # TODO: Remove this constants after Ruby 2.4 EOL - RIPPER_HAS_LEX_STATE = (RUBY_VERSION >= '2.5.0') + RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state) EXPR_NONE = 0 EXPR_BEG = 1 From 74befa2761b99cb9ddd2aaf82f896050a2fc3a57 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Mon, 6 Nov 2017 20:59:41 +0100 Subject: [PATCH 0451/1389] Avoid a trailing whitespace in generated markdown.rb --- lib/rdoc/markdown.kpeg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index e08aa5b828..e7fb5a70ca 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -1137,8 +1137,7 @@ InlineNote = &{ notes? } @StartList:a ( !"]" Inline:l { a << l } )+ "]" - { - ref = [:inline, @note_order.length] + { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref From ff817320672c36b1a449d6c59df02de762f7107b Mon Sep 17 00:00:00 2001 From: Code Ass Date: Wed, 8 Nov 2017 23:58:48 +0900 Subject: [PATCH 0452/1389] Remove debug puts with typo... --- lib/rdoc/generator/darkfish.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index 94e1320ded..6cf2896189 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -442,7 +442,6 @@ def generate_file_files @title += " - #{@options.title}" template_file ||= filepage_file - putes template_file.inspect render_template template_file, out_file do |io| here = binding # suppress 1.9.3 warning From dcdf4bf9e0e3936615be6a73687fc7138edebaa8 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Thu, 9 Nov 2017 02:22:25 +0900 Subject: [PATCH 0453/1389] Fix tag in table_of_contents.html RDoc::Markup::AttributeManager#convert_html that is called from RDoc::Markup::AttributeManager#flow replaces HTML tags of received "str" with "NULL" characters in HTML generation for each files, and the NULL characters are removed in RDoc::Markup::AttributeManager#split_into_flow. But the String objects are reused for table_of_contents.html generation, so the tags lose at that moment. This commit fixes it with using duplicated String object. --- lib/rdoc/markup/attribute_manager.rb | 2 +- test/test_rdoc_markup_attribute_manager.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 3296d17af2..6edb30b867 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -246,7 +246,7 @@ def add_special pattern, name # Processes +str+ converting attributes, HTML and specials def flow str - @str = str + @str = str.dup mask_protected_sequences diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb index c0f7666a01..b51e422474 100644 --- a/test/test_rdoc_markup_attribute_manager.rb +++ b/test/test_rdoc_markup_attribute_manager.rb @@ -332,6 +332,14 @@ def test_protect @am.flow("\\_cat_dog")) end + def test_lost_tag_for_the_second_time + str = "cat dog" + assert_equal(["cat ", @tt_on, "dog", @tt_off], + @am.flow(str)) + assert_equal(["cat ", @tt_on, "dog", @tt_off], + @am.flow(str)) + end + def test_special @am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF) From 8a8e8f63a4f85fe0a44ae4d62ef5e73ec0102677 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 9 Nov 2017 05:13:10 +0900 Subject: [PATCH 0454/1389] Support Ripper::Lexer::State In 60665 of Ruby repository, Ripper::Lexer::State is added. It has #== and #& and #|, so the Ripper::Lexer::State objects must be placed at left operand, and new value as lex_state must be created as a instance of the class. --- lib/rdoc/parser/ripper_state_lex.rb | 8 ++++---- lib/rdoc/parser/ruby.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index cd3d799cdf..b7cec84bfc 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -315,10 +315,10 @@ def get_squashed_tk when :on_tstring_beg then tk = get_string_tk(tk) when :on_backtick then - if ((EXPR_FNAME | EXPR_ENDFN) & tk[:state]) != 0 + if (tk[:state] & (EXPR_FNAME | EXPR_ENDFN)) != 0 @inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE tk[:kind] = :on_ident - tk[:state] = EXPR_ARG + tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG else tk = get_string_tk(tk) end @@ -558,9 +558,9 @@ def get_squashed_tk private def get_op_tk(tk) redefinable_operators = %w[! != !~ % & * ** + +@ - -@ / < << <= <=> == === =~ > >= >> [] []= ^ ` | ~] - if redefinable_operators.include?(tk[:text]) and EXPR_ARG == tk[:state] then + if redefinable_operators.include?(tk[:text]) and tk[:state] == EXPR_ARG then @inner_lex.lex_state = EXPR_ARG unless RIPPER_HAS_LEX_STATE - tk[:state] = EXPR_ARG + tk[:state] = Ripper::Lexer.const_defined?(:State) ? Ripper::Lexer::State.new(EXPR_ARG) : EXPR_ARG tk[:kind] = :on_ident elsif tk[:text] =~ /^[-+]$/ then tk_ahead = get_squashed_tk diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index a840fd6614..b8baa2e09e 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -945,7 +945,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc: elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then nest += 1 elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then - if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0 + if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 nest += 1 end elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) || @@ -1538,7 +1538,7 @@ def parse_method_or_yield_parameters(method = nil, when :on_comment, :on_embdoc then @read.pop if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and - (!continue or (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) != 0) then + (!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then if method && method.block_params.nil? then unget_tk tk read_documentation_modifiers method, modifiers @@ -1743,7 +1743,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, end when 'until', 'while' then - if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0 + if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 nest += 1 skip_optional_do_after_expression end @@ -1759,7 +1759,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, skip_optional_do_after_expression when 'case', 'do', 'if', 'unless', 'begin' then - if (RDoc::RipperStateLex::EXPR_LABEL & tk[:state]) == 0 + if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 nest += 1 end From eba6eb0c70d0c9a427984ae701e11e5f5340603a Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 10 Nov 2017 04:02:11 +0900 Subject: [PATCH 0455/1389] Bump JRuby version to 9.1.14.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7dff74823d..b40c3b0d1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ rvm: - 2.3.5 - 2.4.2 - ruby-head - - jruby-9.1.13.0 + - jruby-9.1.14.0 env: global: NOBENCHMARK=1 From 475e667ab26eb3d2759abb490ab8033503127ada Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 10 Nov 2017 04:47:10 +0900 Subject: [PATCH 0456/1389] Remove skipping test because JRuby bug was fixed --- test/test_rdoc_markup_to_html.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index b5edeb04d2..fd8a7bb0ca 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -452,9 +452,6 @@ def test_accept_verbatim_parseable_error end def test_accept_verbatim_nl_after_backslash - # TODO: Remove "skip" after the issue is resolved: https://github.com/jruby/jruby/issues/4787 - # This "skip" is for strange behavior around escaped newline on JRuby - skip if defined? JRUBY_VERSION verb = @RM::Verbatim.new("a = 1 if first_flag_var and \\\n", " this_is_flag_var\n") @to.start_accepting From 350f6acdb92d58f43011118a4a11b70112f99eb5 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 10 Nov 2017 19:00:51 +0900 Subject: [PATCH 0457/1389] Remove unnecessary condition of RDoc::TokenStream.to_html RDoc::TokenStream.to_html checks that :on_op and EXPR_ARG token comes for treating it as identifier but the case never come because RDoc::RipperStateLex#get_op_tk set :on_ident and EXPR_ARG when `:on_op` as identifier before RDoc::TokenStream.to_html. --- lib/rdoc/token_stream.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb index 2b69e943cd..eb3bb957e6 100644 --- a/lib/rdoc/token_stream.rb +++ b/lib/rdoc/token_stream.rb @@ -23,12 +23,8 @@ def self.to_html token_stream when :on_ivar then 'ruby-ivar' when :on_cvar then 'ruby-identifier' when :on_gvar then 'ruby-identifier' - when '=' != t[:text] && :on_op then - if RDoc::RipperStateLex::EXPR_ARG == t[:state] then - 'ruby-identifier' - else - 'ruby-operator' - end + when '=' != t[:text] && :on_op + then 'ruby-operator' when :on_tlambda then 'ruby-operator' when :on_ident then 'ruby-identifier' when :on_label then 'ruby-value' From adbc9dfa252c92c4b2fa3d774a032a9cec251344 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 10 Nov 2017 19:09:58 +0900 Subject: [PATCH 0458/1389] Add test_parse_instance_operation_method --- test/test_rdoc_parser_ruby.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index db2e4e9927..b4f0e39401 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2674,6 +2674,29 @@ def blah() assert_equal expected, markup_code end + def test_parse_instance_operation_method + util_parser <<-RUBY +class Foo + def self.& end +end + RUBY + + expected = <def self.& end +end +EXPECTED + expected = expected.rstrip + + @parser.scan + + foo = @top_level.classes.first + assert_equal 'Foo', foo.full_name + + blah = foo.method_list.first + markup_code = blah.markup_code.sub(/^.*\n/, '') + assert_equal expected, markup_code + end + def test_parse_statements_postfix_if_after_heredocbeg @filename = 'file.rb' util_parser < Date: Sat, 11 Nov 2017 23:30:17 +0900 Subject: [PATCH 0459/1389] Remove old token name --- lib/rdoc/parser/ruby.rb | 6 ++---- test/test_rdoc_parser_ruby.rb | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index b8baa2e09e..3ec3315320 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -318,8 +318,7 @@ def error(msg) end ## - # Looks for a true or false token. Returns false if TkFALSE or TkNIL are - # found. + # Looks for a true or false token. def get_bool skip_tkspace @@ -1461,8 +1460,7 @@ def parse_method_name_singleton container, name_t # :nodoc: name_t2 = get_tk if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then - # NOTE: work around '[' being consumed early and not being re-tokenized - # as a TkAREF + # NOTE: work around '[' being consumed early if :on_lbracket == name_t2[:kind] get_tk name = '[]' diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index db2e4e9927..376ade0f89 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2826,7 +2826,7 @@ def test_parse_statements_identifier_yields assert_nil m.params, 'Module parameter not removed' end - def test_parse_statements_stopdoc_TkALIAS + def test_parse_statements_stopdoc_alias klass = @top_level.add_class RDoc::NormalClass, 'Foo' util_parser "\n# :stopdoc:\nalias old new" @@ -2837,7 +2837,7 @@ def test_parse_statements_stopdoc_TkALIAS assert_empty klass.unmatched_alias_lists end - def test_parse_statements_stopdoc_TkIDENTIFIER_alias_method + def test_parse_statements_stopdoc_identifier_alias_method klass = @top_level.add_class RDoc::NormalClass, 'Foo' util_parser "\n# :stopdoc:\nalias_method :old :new" @@ -2848,7 +2848,7 @@ def test_parse_statements_stopdoc_TkIDENTIFIER_alias_method assert_empty klass.unmatched_alias_lists end - def test_parse_statements_stopdoc_TkIDENTIFIER_metaprogrammed + def test_parse_statements_stopdoc_identifier_metaprogrammed klass = @top_level.add_class RDoc::NormalClass, 'Foo' util_parser "\n# :stopdoc:\n# attr :meta" @@ -2859,7 +2859,7 @@ def test_parse_statements_stopdoc_TkIDENTIFIER_metaprogrammed assert_empty klass.attributes end - def test_parse_statements_stopdoc_TkCONSTANT + def test_parse_statements_stopdoc_constant klass = @top_level.add_class RDoc::NormalClass, 'Foo' util_parser "\n# :stopdoc:\nA = v" @@ -2869,7 +2869,7 @@ def test_parse_statements_stopdoc_TkCONSTANT assert_empty klass.constants end - def test_parse_statements_stopdoc_TkDEF + def test_parse_statements_stopdoc_def klass = @top_level.add_class RDoc::NormalClass, 'Foo' util_parser "\n# :stopdoc:\ndef m\n end" From acc499bad1984aeb4589334b4b434cb59df992ae Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 12 Nov 2017 04:29:54 +0900 Subject: [PATCH 0460/1389] Add ruby-title class to method name in HTML RDoc::RipperStateLex#get_op_tk set :on_ident to method name token before RDoc::TokenStream.to_html, so RDoc::TokenStream.to_html can detect method name token. This commit changes behavior of markup to add ruby-title class to method name in HTML. --- lib/rdoc/token_stream.rb | 12 ++++++++++++ test/test_rdoc_markup_to_html.rb | 10 +++++----- test/test_rdoc_parser_ruby.rb | 8 ++++---- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb index 2b69e943cd..f2f9db9870 100644 --- a/lib/rdoc/token_stream.rb +++ b/lib/rdoc/token_stream.rb @@ -14,6 +14,8 @@ module RDoc::TokenStream # with the given class names. Other token types are not wrapped in spans. def self.to_html token_stream + starting_title = false + token_stream.map do |t| next unless t @@ -53,6 +55,16 @@ def self.to_html token_stream else text = t[:text] end + + if :on_ident == t[:kind] && starting_title + starting_title = false + style = 'ruby-identifier ruby-title' + end + + if :on_kw == t[:kind] and 'def' == t[:text] + starting_title = true + end + text = CGI.escapeHTML text if style then diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index fd8a7bb0ca..6fdb0222db 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -517,7 +517,7 @@ def bar expected = <<-'EXPECTED' -
def foo
+
def foo
   [
     '\\',
     '\'',
@@ -537,7 +537,7 @@ def bar
     /#{}/
   ]
 end
-def bar
+def bar
 end
 
EXPECTED @@ -567,7 +567,7 @@ def bar expected = <<-'EXPECTED' -
def foo
+
def foo
   [
     `\\`,
     `\'\"\``,
@@ -577,7 +577,7 @@ def bar
     `#{}`
   ]
 end
-def bar
+def bar
 end
 
EXPECTED @@ -619,7 +619,7 @@ def test_accept_verbatim_redefinable_operators %w[| ^ & <=> == === =~ > >= < <= << >> + - * / % ** ~ +@ -@ [] []= ` ! != !~].each do |html_escaped_op| expected += <<-EXPECTED -def #{html_escaped_op} +def #{html_escaped_op} end EXPECTED end diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index db2e4e9927..53d05310e6 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1418,7 +1418,7 @@ def self.foo RUBY expected = <def self.foo +def self.foo A::B::C end EXPECTED @@ -2655,7 +2655,7 @@ def blah() RUBY expected = <def blah() +def blah() for i in (k)...n do end for i in (k)...n @@ -2686,7 +2686,7 @@ def blah() RUBY expected = <def blah() + def blah() <<-EOM if true EOM end @@ -2711,7 +2711,7 @@ def blah() /bar/ end RUBY expected = <def blah() /bar/ end +def blah() /bar/ end EXPECTED expected = expected.rstrip From 1db17e4992b4a04ef11802ebe047776a069ea2ae Mon Sep 17 00:00:00 2001 From: Code Ass Date: Sun, 12 Nov 2017 08:32:06 +0900 Subject: [PATCH 0461/1389] Use File.expand_path outside temp_dir According to circumstances, __FILE__ inside temp_dir returns invalid path for test, so uses File.expand_path('..', __FILE__) outside temp_dir instead of it. This bug is reproduced by a command below without this commit: ruby -Ilib:test test/test_rdoc_rdoc.rb -n test_normalized_file_list --- test/test_rdoc_rdoc.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 39f54555b5..be7a90c236 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -109,17 +109,18 @@ def load_options_no_file end def test_normalized_file_list + test_path = File.expand_path(__FILE__) files = temp_dir do |dir| flag_file = @rdoc.output_flag_file dir FileUtils.touch flag_file - @rdoc.normalized_file_list [__FILE__, flag_file] + @rdoc.normalized_file_list [test_path, flag_file] end files = files.map { |file| File.expand_path file } - assert_equal [File.expand_path(__FILE__)], files + assert_equal [test_path], files end def test_normalized_file_list_not_modified @@ -189,9 +190,10 @@ def test_parse_file_binary def test_parse_file_include_root @rdoc.store = RDoc::Store.new + test_path = File.expand_path('..', __FILE__) top_level = nil temp_dir do |dir| - @rdoc.options.parse %W[--root #{File.dirname(__FILE__)}] + @rdoc.options.parse %W[--root #{test_path}] open 'include.txt', 'w' do |io| io.puts ':include: test.txt' From 2502a6de6c76fb8e8f87c53e5c6f0f917be404bb Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 01:55:18 +0900 Subject: [PATCH 0462/1389] Applied 1a629de from peg-markdown Disallow blank space between [label] and ( in inline link. The official markdown syntax description says that a blank space is allowed between ] and [ in a reference style link, but it does not say this for an inline link; instead, it says that the ( must be immediately after the ]. This interpretation is confirmed by the behavior of Markdown.pl. This change brings peg-markdown into agreement with Markdown.pl, PHP markdown, and pandoc. Note that some markdown implementations (discount, sundown) do allow the space. Though something can be said in favor of allowing the space, it seems best to go with the spec to resolve such disagreements. In addition, with short reference style links, it is easy to do something like [my link] (word) [my link]: /url which we wouldn't want to parse as an inline link. --- lib/rdoc/markdown.kpeg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index e7fb5a70ca..9ebf769f09 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -971,7 +971,7 @@ ReferenceLinkDouble = Label:content < Spnl > !"[]" Label:label ReferenceLinkSingle = Label:content < (Spnl "[]")? > { link_to content, content, text } -ExplicitLink = Label:l Spnl "(" @Sp Source:s Spnl Title @Sp ")" +ExplicitLink = Label:l "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" } Source = ( "<" < SourceContents > ">" | < SourceContents > ) From 1b90e7f2383fb2d1b2d7aaecaf1a9706ffeb9f64 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 03:09:09 +0900 Subject: [PATCH 0463/1389] Applied 7cc5b73 from peg-markdown New extension: strike through with two tildes --- lib/rdoc/markdown.kpeg | 37 ++++++++++++++++++++++++++++++++++++- test/test_rdoc_markdown.rb | 18 ++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 9ebf769f09..54c5767d51 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -84,6 +84,18 @@ # : A little insect that is known # to enjoy picnics # +# ### Strike +# +# Example: +# +# ``` +# This is ~~striked~~. +# ``` +# +# Produces: +# +# This is ~~striked~~. +# # ### Github # # The #github extension enables a partial set of [Github Flavored Markdown] @@ -466,6 +478,17 @@ "#{text}" end end + + ## + # Wraps `text` in strike markup for rdoc inline formatting + + def strike text + if text =~ /\A[a-z\d.\/-]+\z/i then + "~#{text}~" + else + "#{text}" + end + end } root = Doc @@ -871,6 +894,7 @@ Inline = Str | @Space | Strong | Emph + | Strike | Image | Link | NoteReference @@ -913,6 +937,8 @@ StarLine = < /\*{4,}/ > { text } | < @Spacechar /\*+/ &@Spacechar > { text } UlLine = < /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text } +TildeLine = < /~{4,}/ > { text } | + < @Spacechar /~+/ &@Spacechar > { text } Emph = EmphStar | EmphUl @@ -957,6 +983,15 @@ StrongUl = TwoUlOpen TwoUlClose:l { a << l } { strong a.join } +TwoTildeOpen = !TildeLine "~~" !@Spacechar !@Newline +TwoTildeClose = !@Spacechar !@Newline Inline:a "~~" { a } + +Strike = TwoTildeOpen + @StartList:a + ( !TwoTildeClose Inline:i { a << i } )* + TwoTildeClose:l { a << l } + { strike a.join } + # TODO alt text support Image = "!" ( ExplicitLink | ReferenceLink ):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" } @@ -1068,7 +1103,7 @@ Eof = !. Nonspacechar = !@Spacechar !@Newline . Sp = @Spacechar* Spnl = @Sp (@Newline @Sp)? -SpecialChar = /[*_`&\[\]()works fine")) + + assert_equal expected, doc + end + def test_parse_style @parser.css = true From c5143b9d9a179a166d3c1983ebb94f62cc295f75 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 03:18:23 +0900 Subject: [PATCH 0464/1389] Applied 9556c54 from peg-markdown disable strike-through extension by default --- lib/rdoc/markdown.kpeg | 13 ++++++++++--- test/test_rdoc_markdown.rb | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 54c5767d51..0f433dca72 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -205,6 +205,7 @@ :github, :html, :notes, + :strike, ] # :section: Extensions @@ -255,6 +256,11 @@ extension :notes + ## + # Enables the strike extension + + extension :strike + # :section: ## @@ -983,10 +989,11 @@ StrongUl = TwoUlOpen TwoUlClose:l { a << l } { strong a.join } -TwoTildeOpen = !TildeLine "~~" !@Spacechar !@Newline -TwoTildeClose = !@Spacechar !@Newline Inline:a "~~" { a } +TwoTildeOpen = &{ strike? } !TildeLine "~~" !@Spacechar !@Newline +TwoTildeClose = &{ strike? } !@Spacechar !@Newline Inline:a "~~" { a } -Strike = TwoTildeOpen +Strike = &{ strike? } + TwoTildeOpen @StartList:a ( !TwoTildeClose Inline:i { a << i } )* TwoTildeClose:l { a << l } diff --git a/test/test_rdoc_markdown.rb b/test/test_rdoc_markdown.rb index fe146b9ebd..522538db9f 100644 --- a/test/test_rdoc_markdown.rb +++ b/test/test_rdoc_markdown.rb @@ -948,6 +948,17 @@ def test_parse_strike_words_tilde assert_equal expected, doc end + def test_parse_strike_tilde_no + @parser.strike = false + + doc = parse "it ~~works fine~~\n" + + expected = @RM::Document.new( + @RM::Paragraph.new("it ~~works fine~~")) + + assert_equal expected, doc + end + def test_parse_style @parser.css = true From fa953120c247bb738368e80397105265054e85f7 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 23:54:39 +0900 Subject: [PATCH 0465/1389] Applied c59e682 from peg-markdown Improved strong/emph parsers to avoid exponential blowup. --- lib/rdoc/markdown.kpeg | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 0f433dca72..322d18bcae 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -946,48 +946,49 @@ UlLine = < /_{4,}/ > { text } | TildeLine = < /~{4,}/ > { text } | < @Spacechar /~+/ &@Spacechar > { text } -Emph = EmphStar | EmphUl +SpaceInline = @StartList:a + ( (Space:b | Endline:b) { a << b } )+ + Inline:c { a << c; a } + +NonspaceInline = !@Spacechar !@Newline Inline -OneStarOpen = !StarLine "*" !@Spacechar !@Newline -OneStarClose = !@Spacechar !@Newline Inline:a "*" - { a } +Emph = EmphStar | EmphUl -EmphStar = OneStarOpen +EmphStar = "*" @StartList:a - ( !OneStarClose Inline:l { a << l } )* - OneStarClose:l { a << l } + ( !"*" NonspaceInline:b { a << b } + | SpaceInline:b { a << b } + | StrongStar:b { a << b } + )+ + "*" { emphasis a.join } -OneUlOpen = !UlLine "_" !@Spacechar !@Newline -OneUlClose = !@Spacechar !@Newline Inline:a "_" # !Alphanumeric # TODO check - { a } - -EmphUl = OneUlOpen +EmphUl = "_" @StartList:a - ( !OneUlClose Inline:l { a << l } )* - OneUlClose:l { a << l } + ( !"_" NonspaceInline:b { a << b } + | SpaceInline:b { a << b } + | StrongUl:b { a << b } + )+ + "_" { emphasis a.join } Strong = StrongStar | StrongUl -TwoStarOpen = !StarLine "**" !@Spacechar !@Newline -TwoStarClose = !@Spacechar !@Newline Inline:a "**" { a } - -StrongStar = TwoStarOpen +StrongStar = "**" @StartList:a - ( !TwoStarClose Inline:l { a << l } )* - TwoStarClose:l { a << l } + ( !"**" NonspaceInline:b { a << b } + | SpaceInline:b { a << b } + )+ + "**" { strong a.join } -TwoUlOpen = !UlLine "__" !@Spacechar !@Newline -TwoUlClose = !@Spacechar !@Newline Inline:a "__" # !Alphanumeric # TODO check - { a } - -StrongUl = TwoUlOpen - @StartList:a - ( !TwoUlClose Inline:i { a << i } )* - TwoUlClose:l { a << l } - { strong a.join } +StrongUl = "__" + @StartList:a + ( !"__" NonspaceInline:b { a << b } + | SpaceInline:b { a << b } + )+ + "__" + { strong a.join } TwoTildeOpen = &{ strike? } !TildeLine "~~" !@Spacechar !@Newline TwoTildeClose = &{ strike? } !@Spacechar !@Newline Inline:a "~~" { a } From 675cce46de004f2f60cf4c47d6a55156ea91c703 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 23:56:20 +0900 Subject: [PATCH 0466/1389] Applied ce835e5 from peg-markdown Require only one character for setext header lines. This is explicit in Gruber's syntax description. --- lib/rdoc/markdown.kpeg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 322d18bcae..4f2b768856 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -533,9 +533,9 @@ AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline SetextHeading = SetextHeading1 | SetextHeading2 -SetextBottom1 = /={3,}/ @Newline +SetextBottom1 = /={1,}/ @Newline -SetextBottom2 = /-{3,}/ @Newline +SetextBottom2 = /-{1,}/ @Newline SetextHeading1 = &(@RawLine SetextBottom1) @StartList:a ( !@Endline Inline:b { a << b } )+ @Sp? @Newline From 5c695f172fdcd339d1da6d5f2fb649edd2af619b Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 23:56:57 +0900 Subject: [PATCH 0467/1389] Applied 400b390 from peg-markdown Removed unused parser. --- lib/rdoc/markdown.kpeg | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 4f2b768856..ef5763393d 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -1120,7 +1120,6 @@ Alphanumeric = %literals.Alphanumeric AlphanumericAscii = %literals.AlphanumericAscii BOM = %literals.BOM Newline = %literals.Newline -NonAlphanumeric = %literals.NonAlphanumeric Spacechar = %literals.Spacechar HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";" From 5b1594c34d7345e70a05f7d97d0ff92b2456529d Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 23:57:51 +0900 Subject: [PATCH 0468/1389] Applied 482a0ba from peg-markdown Fixed Endline to allow 1 and 2-character setext header lines. --- lib/rdoc/markdown.kpeg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index ef5763393d..011cffeeec 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -926,7 +926,7 @@ Entity = ( HexEntity | DecEntity | CharEntity ):a { a } Endline = @LineBreak | @TerminalEndline | @NormalEndline NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart - !(Line /={3,}|-{3,}=/ @Newline) + !(Line /={1,}|-{1,}=/ @Newline) { "\n" } TerminalEndline = @Sp @Newline @Eof From bda5431454d10143963d929da657fae188ed6d78 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 14 Nov 2017 23:59:36 +0900 Subject: [PATCH 0469/1389] Fix NormalEndline of markdown.kpeg --- lib/rdoc/markdown.kpeg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 011cffeeec..a52f416ce4 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -926,7 +926,7 @@ Entity = ( HexEntity | DecEntity | CharEntity ):a { a } Endline = @LineBreak | @TerminalEndline | @NormalEndline NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart - !(Line /={1,}|-{1,}=/ @Newline) + !(Line /={1,}|-{1,}/ @Newline) { "\n" } TerminalEndline = @Sp @Newline @Eof From 810dc5433e43c15fe9fadeb4861a1f99ab21a58d Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:11:33 +0900 Subject: [PATCH 0470/1389] Applied 39dfc1c from peg-markdown Rewrote Emph/Strong parsers to avoid exponential blowup. --- lib/rdoc/markdown.kpeg | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index a52f416ce4..289bfdb49b 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -946,27 +946,19 @@ UlLine = < /_{4,}/ > { text } | TildeLine = < /~{4,}/ > { text } | < @Spacechar /~+/ &@Spacechar > { text } -SpaceInline = @StartList:a - ( (Space:b | Endline:b) { a << b } )+ - Inline:c { a << c; a } - -NonspaceInline = !@Spacechar !@Newline Inline - Emph = EmphStar | EmphUl -EmphStar = "*" +EmphStar = "*" &Nonspacechar @StartList:a - ( !"*" NonspaceInline:b { a << b } - | SpaceInline:b { a << b } + ( !"*" Inline:b { a << b } | StrongStar:b { a << b } )+ "*" { emphasis a.join } -EmphUl = "_" +EmphUl = "_" &Nonspacechar @StartList:a - ( !"_" NonspaceInline:b { a << b } - | SpaceInline:b { a << b } + ( !"_" Inline:b { a << b } | StrongUl:b { a << b } )+ "_" @@ -974,19 +966,15 @@ EmphUl = "_" Strong = StrongStar | StrongUl -StrongStar = "**" +StrongStar = "**" &Nonspacechar @StartList:a - ( !"**" NonspaceInline:b { a << b } - | SpaceInline:b { a << b } - )+ + ( !"**" Inline:b { a << b } )+ "**" { strong a.join } -StrongUl = "__" +StrongUl = "__" &Nonspacechar @StartList:a - ( !"__" NonspaceInline:b { a << b } - | SpaceInline:b { a << b } - )+ + ( !"__" Inline:b { a << b } )+ "__" { strong a.join } From fd745f693197a72be4370a2352ffb98bf2d1d42d Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:12:34 +0900 Subject: [PATCH 0471/1389] Applied 2a19a38 from peg-markdown Removed unused disjunct in SourceContents. --- lib/rdoc/markdown.kpeg | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 289bfdb49b..c63b0b8837 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -1009,7 +1009,6 @@ Source = ( "<" < SourceContents > ">" | < SourceContents > ) { text } SourceContents = ( ( !"(" !")" !">" Nonspacechar )+ | "(" SourceContents ")")* - | "" Title = ( TitleSingle | TitleDouble | "" ):a { a } From 8c4c7055a50e0617df1c0b22dcc037b0cba9cfc6 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:15:43 +0900 Subject: [PATCH 0472/1389] Applied c95552a from peg-markdown Efficiency improvement (!Whitespace instead of &Nonspacechar). --- lib/rdoc/markdown.kpeg | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index c63b0b8837..86cae62308 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -948,7 +948,9 @@ TildeLine = < /~{4,}/ > { text } | Emph = EmphStar | EmphUl -EmphStar = "*" &Nonspacechar +Whitespace = @Spacechar | @Newline + +EmphStar = "*" !@Whitespace @StartList:a ( !"*" Inline:b { a << b } | StrongStar:b { a << b } @@ -956,7 +958,7 @@ EmphStar = "*" &Nonspacechar "*" { emphasis a.join } -EmphUl = "_" &Nonspacechar +EmphUl = "_" !@Whitespace @StartList:a ( !"_" Inline:b { a << b } | StrongUl:b { a << b } @@ -966,13 +968,13 @@ EmphUl = "_" &Nonspacechar Strong = StrongStar | StrongUl -StrongStar = "**" &Nonspacechar +StrongStar = "**" !@Whitespace @StartList:a ( !"**" Inline:b { a << b } )+ "**" { strong a.join } -StrongUl = "__" &Nonspacechar +StrongUl = "__" !@Whitespace @StartList:a ( !"__" Inline:b { a << b } )+ "__" From 404c41cd8ab51877c3399fc0e3b5370539fb23f2 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:21:28 +0900 Subject: [PATCH 0473/1389] Applied a035b71 from peg-markdown Rewrote Strike parser to avoid exponential blowup. --- lib/rdoc/markdown.kpeg | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 86cae62308..3b367f4004 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -943,8 +943,6 @@ StarLine = < /\*{4,}/ > { text } | < @Spacechar /\*+/ &@Spacechar > { text } UlLine = < /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text } -TildeLine = < /~{4,}/ > { text } | - < @Spacechar /~+/ &@Spacechar > { text } Emph = EmphStar | EmphUl @@ -980,14 +978,11 @@ StrongUl = "__" !@Whitespace "__" { strong a.join } -TwoTildeOpen = &{ strike? } !TildeLine "~~" !@Spacechar !@Newline -TwoTildeClose = &{ strike? } !@Spacechar !@Newline Inline:a "~~" { a } - Strike = &{ strike? } - TwoTildeOpen + "~~" !@Whitespace @StartList:a - ( !TwoTildeClose Inline:i { a << i } )* - TwoTildeClose:l { a << l } + ( !"~~" Inline:b { a << b } )+ + "~~" { strike a.join } # TODO alt text support From 6fbcbf3a0986e24ebb71d2ba4819f5ae7c535eb8 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:27:31 +0900 Subject: [PATCH 0474/1389] Applied 2a009eb from peg-markdown Treat as block-level HTML tag. --- lib/rdoc/markdown.kpeg | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 3b367f4004..bdb3ad4a73 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -762,6 +762,9 @@ HtmlBlockOpenScript = "<" Spnl ("script" | "SCRIPT") Spnl HtmlAttribute* ">" HtmlBlockCloseScript = "<" Spnl "/" ("script" | "SCRIPT") Spnl ">" HtmlBlockScript = HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript +HtmlBlockOpenHead = "<" Spnl ("head" | "HEAD") Spnl HtmlAttribute* ">" +HtmlBlockCloseHead = "<" Spnl "/" ("head" | "HEAD") Spnl ">" +HtmlBlockHead = HtmlBlockOpenHead (!HtmlBlockCloseHead .)* HtmlBlockCloseHead HtmlBlockInTags = HtmlAnchor | HtmlBlockAddress @@ -797,6 +800,7 @@ HtmlBlockInTags = HtmlAnchor | HtmlBlockThead | HtmlBlockTr | HtmlBlockScript + | HtmlBlockHead HtmlBlock = < ( HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ From 8ab662cca22c6185e23590092579435bd3b5f054 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 15 Nov 2017 00:29:24 +0900 Subject: [PATCH 0475/1389] Applied b220285 from peg-markdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sp? is redundant… The definition of Sp is: Sp = Spacechar* so the matching of chars is already optional. --- lib/rdoc/markdown.kpeg | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index bdb3ad4a73..47e842b378 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -523,12 +523,12 @@ Para = @NonindentSpace Inlines:a @BlankLine+ Plain = Inlines:a { paragraph a } -AtxInline = !@Newline !(@Sp? /#*/ @Sp @Newline) Inline +AtxInline = !@Newline !(@Sp /#*/ @Sp @Newline) Inline AtxStart = < /\#{1,6}/ > { text.length } -AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline +AtxHeading = AtxStart:s @Sp AtxInline+:a (@Sp /#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) } SetextHeading = SetextHeading1 | SetextHeading2 @@ -538,12 +538,12 @@ SetextBottom1 = /={1,}/ @Newline SetextBottom2 = /-{1,}/ @Newline SetextHeading1 = &(@RawLine SetextBottom1) - @StartList:a ( !@Endline Inline:b { a << b } )+ @Sp? @Newline + @StartList:a ( !@Endline Inline:b { a << b } )+ @Sp @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) } SetextHeading2 = &(@RawLine SetextBottom2) - @StartList:a ( !@Endline Inline:b { a << b })+ @Sp? @Newline + @StartList:a ( !@Endline Inline:b { a << b })+ @Sp @Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) } From ec61a69c31d2d8b4c499b45b8adde21bb652416f Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 16 Nov 2017 07:32:02 +0900 Subject: [PATCH 0476/1389] Add lib/rdoc/markdown/literals.rb to .gitignore The file is generated by KPeg in Rakefile. --- .gitignore | 1 + lib/rdoc/markdown/literals.rb | 405 ---------------------------------- rdoc.gemspec | 4 +- 3 files changed, 3 insertions(+), 407 deletions(-) delete mode 100644 lib/rdoc/markdown/literals.rb diff --git a/.gitignore b/.gitignore index cf93d01611..40234874d7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ /lib/rdoc/rd/block_parser.rb /lib/rdoc/rd/inline_parser.rb /lib/rdoc/markdown.rb +/lib/rdoc/markdown/literals.rb /pkg /tmp Gemfile.lock diff --git a/lib/rdoc/markdown/literals.rb b/lib/rdoc/markdown/literals.rb deleted file mode 100644 index b6bb89e0c6..0000000000 --- a/lib/rdoc/markdown/literals.rb +++ /dev/null @@ -1,405 +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 - - def get_byte - if @pos >= @string_size - return nil - end - - s = @string[@pos].ord - @pos += 1 - s - 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/rdoc.gemspec b/rdoc.gemspec index 2787f07654..17d01e1746 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -33,9 +33,9 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "lib/rdoc/markdown/literals.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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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", "rdoc.gemspec"] # files from .gitignore - s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" + s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb" s.rdoc_options = ["--main", "README.rdoc"] s.extra_rdoc_files += %w[ From 3862a236d8b65dcf47a67a9f65d3cbf9541f5331 Mon Sep 17 00:00:00 2001 From: Masataka Pocke Kuwabara Date: Wed, 15 Nov 2017 20:18:56 -0600 Subject: [PATCH 0477/1389] Suppress "assigned but unused variable" warning Currently `rake -T` warns an unused local variable. ```console $ bundle exec rake -T /home/pocke/ghq/github.com/ruby/rdoc/Rakefile:107: warning: assigned but unused variable - options rake build # Build rdoc-6.0.0.beta3.gem into the pkg directory rake clean # Remove any temporary products rake clobber # Remove any generated files rake clobber_rdoc # Remove RDoc HTML files rake diff_rubinius # Diffs Rubinius HEAD with the currently checked-out copy of RDoc rake diff_ruby # Diffs Ruby HEAD with the currently checked-out copy of RDoc rake generate # Genrate all files used racc and kpeg rake install # Build and install rdoc-6.0.0.beta3.gem into system gems rake install:local # Build and install rdoc-6.0.0.beta3.gem into system gems without network access rake rdoc # Build RDoc HTML files rake release[remote] # Create tag v6.0.0.beta3 and build and push rdoc-6.0.0.beta3.gem to rubygems.org rake rerdoc # Rebuild RDoc HTML files rake test # Run tests rake update_rubinius # Updates Rubinius HEAD with the currently checked-out copy of RDoc rake update_ruby # Updates Ruby HEAD with the currently checked-out copy of RDoc ``` This change will suppress the warning. Note: The removed `options` variable value is same as `diff_options`. --- Rakefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Rakefile b/Rakefile index 4108582b1d..2dd5d21bd5 100644 --- a/Rakefile +++ b/Rakefile @@ -104,8 +104,6 @@ end desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc." task :diff_ruby do - options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'" - sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true" sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true" sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true" From ac43a5bda1592082f3fb6b397523b21a6baf3132 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 18 Nov 2017 06:33:49 +0900 Subject: [PATCH 0478/1389] Use Enumerable#chunk after drop Ruby 1.8 --- lib/rdoc/markup/to_joined_paragraph.rb | 36 ++++---------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/lib/rdoc/markup/to_joined_paragraph.rb b/lib/rdoc/markup/to_joined_paragraph.rb index 293258c092..3cc35e51d4 100644 --- a/lib/rdoc/markup/to_joined_paragraph.rb +++ b/lib/rdoc/markup/to_joined_paragraph.rb @@ -23,37 +23,11 @@ def end_accepting # :nodoc: # Converts the parts of +paragraph+ to a single entry. def accept_paragraph paragraph - parts = [] - string = false - - paragraph.parts.each do |part| - if String === part then - if string then - string << part - else - parts << part - string = part - end - else - parts << part - string = false - end - end - - parts = parts.map do |part| - if String === part then - part.rstrip - else - part - end - end - - # TODO use Enumerable#chunk when Ruby 1.8 support is dropped - #parts = paragraph.parts.chunk do |part| - # String === part - #end.map do |string, chunk| - # string ? chunk.join.rstrip : chunk - #end.flatten + parts = paragraph.parts.chunk do |part| + String === part + end.map do |string, chunk| + string ? chunk.join.rstrip : chunk + end.flatten paragraph.parts.replace parts end From 5a40835774ac031164f02b7385d92f5f898239ec Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 19 Nov 2017 23:46:38 +0900 Subject: [PATCH 0479/1389] Remove remove_private_comment --- lib/rdoc/parser/ruby.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 3ec3315320..97c0511eda 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -587,7 +587,7 @@ def look_for_directives_in container, comment end end - remove_private_comments comment + comment.remove_private end ## @@ -2054,15 +2054,6 @@ def record_location container # :nodoc: container.record_location @top_level end - ## - # Removes private comments from +comment+ - #-- - # TODO remove - - def remove_private_comments comment - comment.remove_private - end - ## # Scans this Ruby file for Ruby constructs From 2af6e854cda9ee803dd82fbc84727ac00c420e17 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 21 Nov 2017 06:45:45 +0900 Subject: [PATCH 0480/1389] Use ParseError that is auto-generated by KPeg --- lib/rdoc/markdown.kpeg | 2 +- test/test_rdoc_markdown.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 47e842b378..4148b06c3e 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -349,7 +349,7 @@ # with the linking `text` (usually whitespace). def link_to content, label = content, text = nil - raise 'enable notes extension' if + raise ParseError, 'enable notes extension' if content.start_with? '^' and label.equal? content if ref = @references[label] then diff --git a/test/test_rdoc_markdown.rb b/test/test_rdoc_markdown.rb index 522538db9f..e6c63ffb13 100644 --- a/test/test_rdoc_markdown.rb +++ b/test/test_rdoc_markdown.rb @@ -717,7 +717,7 @@ def test_parse_note_inline def test_parse_note_no_notes @parser.notes = false - assert_raises RuntimeError do # TODO use a real error + assert_raises RDoc::Markdown::ParseError do parse "Some text.[^1]" end end From b16b94bdf4f839e126db500512385c660c875d31 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 21 Nov 2017 21:12:45 +0900 Subject: [PATCH 0481/1389] Fix test_parse_instance_operation_method for ruby-title --- test/test_rdoc_parser_ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 02a60fbcd0..f846dc592a 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2682,7 +2682,7 @@ def self.& end RUBY expected = <def self.& end + def self.& end end EXPECTED expected = expected.rstrip From 395b0b45946e9f2d328b8fbb2e33de12842a33b9 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Sun, 5 Nov 2017 00:07:30 +0900 Subject: [PATCH 0482/1389] Set frozen_string_literal: true --- lib/rdoc.rb | 2 +- lib/rdoc/alias.rb | 2 +- lib/rdoc/anon_class.rb | 2 +- lib/rdoc/any_method.rb | 2 +- lib/rdoc/attr.rb | 2 +- lib/rdoc/class_module.rb | 2 +- lib/rdoc/code_object.rb | 2 +- lib/rdoc/code_objects.rb | 2 +- lib/rdoc/comment.rb | 2 +- lib/rdoc/constant.rb | 2 +- lib/rdoc/context.rb | 2 +- lib/rdoc/context/section.rb | 2 +- lib/rdoc/cross_reference.rb | 2 +- lib/rdoc/encoding.rb | 2 +- lib/rdoc/erb_partial.rb | 2 +- lib/rdoc/erbio.rb | 2 +- lib/rdoc/extend.rb | 2 +- lib/rdoc/generator.rb | 2 +- lib/rdoc/generator/darkfish.rb | 2 +- lib/rdoc/generator/json_index.rb | 2 +- lib/rdoc/generator/markup.rb | 2 +- lib/rdoc/generator/pot.rb | 2 +- lib/rdoc/generator/pot/message_extractor.rb | 2 +- lib/rdoc/generator/pot/po.rb | 2 +- lib/rdoc/generator/pot/po_entry.rb | 2 +- lib/rdoc/generator/ri.rb | 2 +- lib/rdoc/ghost_method.rb | 2 +- lib/rdoc/i18n.rb | 2 +- lib/rdoc/i18n/locale.rb | 2 +- lib/rdoc/i18n/text.rb | 2 +- lib/rdoc/include.rb | 2 +- lib/rdoc/known_classes.rb | 2 +- lib/rdoc/markdown/entities.rb | 2 +- lib/rdoc/markup.rb | 2 +- lib/rdoc/markup/attr_changer.rb | 2 +- lib/rdoc/markup/attr_span.rb | 2 +- lib/rdoc/markup/attribute_manager.rb | 2 +- lib/rdoc/markup/attributes.rb | 2 +- lib/rdoc/markup/blank_line.rb | 2 +- lib/rdoc/markup/block_quote.rb | 2 +- lib/rdoc/markup/document.rb | 2 +- lib/rdoc/markup/formatter.rb | 2 +- lib/rdoc/markup/formatter_test_case.rb | 2 +- lib/rdoc/markup/hard_break.rb | 2 +- lib/rdoc/markup/heading.rb | 2 +- lib/rdoc/markup/include.rb | 2 +- lib/rdoc/markup/indented_paragraph.rb | 2 +- lib/rdoc/markup/inline.rb | 2 +- lib/rdoc/markup/list.rb | 2 +- lib/rdoc/markup/list_item.rb | 2 +- lib/rdoc/markup/paragraph.rb | 2 +- lib/rdoc/markup/parser.rb | 2 +- lib/rdoc/markup/pre_process.rb | 2 +- lib/rdoc/markup/raw.rb | 2 +- lib/rdoc/markup/rule.rb | 2 +- lib/rdoc/markup/special.rb | 2 +- lib/rdoc/markup/text_formatter_test_case.rb | 2 +- lib/rdoc/markup/to_ansi.rb | 2 +- lib/rdoc/markup/to_bs.rb | 2 +- lib/rdoc/markup/to_html.rb | 2 +- lib/rdoc/markup/to_html_crossref.rb | 2 +- lib/rdoc/markup/to_html_snippet.rb | 2 +- lib/rdoc/markup/to_joined_paragraph.rb | 2 +- lib/rdoc/markup/to_label.rb | 2 +- lib/rdoc/markup/to_markdown.rb | 2 +- lib/rdoc/markup/to_rdoc.rb | 2 +- lib/rdoc/markup/to_table_of_contents.rb | 2 +- lib/rdoc/markup/to_test.rb | 2 +- lib/rdoc/markup/to_tt_only.rb | 2 +- lib/rdoc/markup/verbatim.rb | 2 +- lib/rdoc/meta_method.rb | 2 +- lib/rdoc/method_attr.rb | 2 +- lib/rdoc/mixin.rb | 2 +- lib/rdoc/normal_class.rb | 2 +- lib/rdoc/normal_module.rb | 2 +- lib/rdoc/options.rb | 2 +- lib/rdoc/parser.rb | 2 +- lib/rdoc/parser/c.rb | 2 +- lib/rdoc/parser/changelog.rb | 2 +- lib/rdoc/parser/markdown.rb | 2 +- lib/rdoc/parser/rd.rb | 2 +- lib/rdoc/parser/ruby.rb | 2 +- lib/rdoc/parser/ruby_tools.rb | 2 +- lib/rdoc/parser/simple.rb | 2 +- lib/rdoc/parser/text.rb | 2 +- lib/rdoc/rd.rb | 2 +- lib/rdoc/rd/inline.rb | 2 +- lib/rdoc/rdoc.rb | 2 +- lib/rdoc/require.rb | 2 +- lib/rdoc/ri.rb | 2 +- lib/rdoc/ri/driver.rb | 2 +- lib/rdoc/ri/formatter.rb | 2 +- lib/rdoc/ri/paths.rb | 2 +- lib/rdoc/ri/store.rb | 2 +- lib/rdoc/ri/task.rb | 2 +- lib/rdoc/rubygems_hook.rb | 2 +- lib/rdoc/servlet.rb | 2 +- lib/rdoc/single_class.rb | 2 +- lib/rdoc/stats.rb | 2 +- lib/rdoc/stats/normal.rb | 2 +- lib/rdoc/stats/quiet.rb | 2 +- lib/rdoc/stats/verbose.rb | 2 +- lib/rdoc/store.rb | 2 +- lib/rdoc/task.rb | 2 +- lib/rdoc/test_case.rb | 2 +- lib/rdoc/text.rb | 2 +- lib/rdoc/token_stream.rb | 2 +- lib/rdoc/tom_doc.rb | 2 +- lib/rdoc/top_level.rb | 2 +- test/test_rdoc_alias.rb | 2 +- test/test_rdoc_any_method.rb | 2 +- test/test_rdoc_attr.rb | 2 +- test/test_rdoc_class_module.rb | 2 +- test/test_rdoc_code_object.rb | 2 +- test/test_rdoc_comment.rb | 2 +- test/test_rdoc_constant.rb | 2 +- test/test_rdoc_context.rb | 2 +- test/test_rdoc_context_section.rb | 2 +- test/test_rdoc_cross_reference.rb | 2 +- test/test_rdoc_encoding.rb | 2 +- test/test_rdoc_extend.rb | 2 +- test/test_rdoc_generator_darkfish.rb | 2 +- test/test_rdoc_generator_json_index.rb | 2 +- test/test_rdoc_generator_markup.rb | 2 +- test/test_rdoc_generator_pot.rb | 2 +- test/test_rdoc_generator_pot_po.rb | 2 +- test/test_rdoc_generator_pot_po_entry.rb | 2 +- test/test_rdoc_generator_ri.rb | 2 +- test/test_rdoc_i18n_locale.rb | 2 +- test/test_rdoc_i18n_text.rb | 2 +- test/test_rdoc_include.rb | 2 +- test/test_rdoc_markdown.rb | 2 +- test/test_rdoc_markdown_test.rb | 2 +- test/test_rdoc_markup.rb | 2 +- test/test_rdoc_markup_attribute_manager.rb | 2 +- test/test_rdoc_markup_attributes.rb | 2 +- test/test_rdoc_markup_document.rb | 2 +- test/test_rdoc_markup_formatter.rb | 2 +- test/test_rdoc_markup_hard_break.rb | 2 +- test/test_rdoc_markup_heading.rb | 2 +- test/test_rdoc_markup_include.rb | 2 +- test/test_rdoc_markup_indented_paragraph.rb | 2 +- test/test_rdoc_markup_paragraph.rb | 2 +- test/test_rdoc_markup_parser.rb | 2 +- test/test_rdoc_markup_pre_process.rb | 2 +- test/test_rdoc_markup_raw.rb | 2 +- test/test_rdoc_markup_to_ansi.rb | 2 +- test/test_rdoc_markup_to_bs.rb | 2 +- test/test_rdoc_markup_to_html.rb | 2 +- test/test_rdoc_markup_to_html_crossref.rb | 2 +- test/test_rdoc_markup_to_html_snippet.rb | 2 +- test/test_rdoc_markup_to_joined_paragraph.rb | 2 +- test/test_rdoc_markup_to_label.rb | 2 +- test/test_rdoc_markup_to_markdown.rb | 2 +- test/test_rdoc_markup_to_rdoc.rb | 2 +- test/test_rdoc_markup_to_table_of_contents.rb | 2 +- test/test_rdoc_markup_to_tt_only.rb | 2 +- test/test_rdoc_markup_verbatim.rb | 2 +- test/test_rdoc_method_attr.rb | 2 +- test/test_rdoc_normal_class.rb | 2 +- test/test_rdoc_normal_module.rb | 2 +- test/test_rdoc_options.rb | 2 +- test/test_rdoc_parser.rb | 2 +- test/test_rdoc_parser_c.rb | 2 +- test/test_rdoc_parser_changelog.rb | 2 +- test/test_rdoc_parser_markdown.rb | 2 +- test/test_rdoc_parser_rd.rb | 2 +- test/test_rdoc_parser_ruby.rb | 2 +- test/test_rdoc_parser_simple.rb | 2 +- test/test_rdoc_rd.rb | 2 +- test/test_rdoc_rd_block_parser.rb | 2 +- test/test_rdoc_rd_inline.rb | 2 +- test/test_rdoc_rd_inline_parser.rb | 2 +- test/test_rdoc_rdoc.rb | 2 +- test/test_rdoc_require.rb | 2 +- test/test_rdoc_ri_driver.rb | 2 +- test/test_rdoc_ri_paths.rb | 2 +- test/test_rdoc_rubygems_hook.rb | 2 +- test/test_rdoc_servlet.rb | 2 +- test/test_rdoc_single_class.rb | 2 +- test/test_rdoc_stats.rb | 2 +- test/test_rdoc_store.rb | 2 +- test/test_rdoc_task.rb | 2 +- test/test_rdoc_text.rb | 2 +- test/test_rdoc_token_stream.rb | 2 +- test/test_rdoc_tom_doc.rb | 2 +- test/test_rdoc_top_level.rb | 2 +- test/xref_data.rb | 2 +- test/xref_test_case.rb | 2 +- 189 files changed, 189 insertions(+), 189 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index af05b57116..ee448e661d 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true $DEBUG_RDOC = nil # :main: README.rdoc diff --git a/lib/rdoc/alias.rb b/lib/rdoc/alias.rb index 1e06fb96e5..858e053049 100644 --- a/lib/rdoc/alias.rb +++ b/lib/rdoc/alias.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Represent an alias, which is an old_name/new_name pair associated with a # particular context diff --git a/lib/rdoc/anon_class.rb b/lib/rdoc/anon_class.rb index 098bfdfcf9..d02a38c2cf 100644 --- a/lib/rdoc/anon_class.rb +++ b/lib/rdoc/anon_class.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An anonymous class like: # diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index 5dbdf9e0ef..e61f263cdc 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # AnyMethod is the base class for objects representing methods diff --git a/lib/rdoc/attr.rb b/lib/rdoc/attr.rb index f77a5c04a7..f780b3b976 100644 --- a/lib/rdoc/attr.rb +++ b/lib/rdoc/attr.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An attribute created by \#attr, \#attr_reader, \#attr_writer or # \#attr_accessor diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb index 33a8baa6a6..fdd56e236b 100644 --- a/lib/rdoc/class_module.rb +++ b/lib/rdoc/class_module.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # ClassModule is the base class for objects representing either a class or a # module. diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb index 11c682b7fa..48a6761b87 100644 --- a/lib/rdoc/code_object.rb +++ b/lib/rdoc/code_object.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Base class for the RDoc code tree. # diff --git a/lib/rdoc/code_objects.rb b/lib/rdoc/code_objects.rb index 564849e1d1..434a25ac7f 100644 --- a/lib/rdoc/code_objects.rb +++ b/lib/rdoc/code_objects.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # This file was used to load all the RDoc::CodeObject subclasses at once. Now # autoload handles this. diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb index c655763b3e..f8482e2754 100644 --- a/lib/rdoc/comment.rb +++ b/lib/rdoc/comment.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A comment holds the text comment for a RDoc::CodeObject and provides a # unified way of cleaning it up and parsing it into an RDoc::Markup::Document. diff --git a/lib/rdoc/constant.rb b/lib/rdoc/constant.rb index 7e1e10da72..0c3d7505a1 100644 --- a/lib/rdoc/constant.rb +++ b/lib/rdoc/constant.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A constant diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index 3294b2561c..52f01be809 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'cgi' ## diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb index 7c3c8c603d..64877f944c 100644 --- a/lib/rdoc/context/section.rb +++ b/lib/rdoc/context/section.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A section of documentation like: # diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index 0e40d23159..d76ebaf2d0 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # RDoc::CrossReference is a reusable way to create cross references for names. diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index 44881d043c..150865b623 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -1,5 +1,5 @@ # coding: US-ASCII -# frozen_string_literal: false +# frozen_string_literal: true ## # This class is a wrapper around File IO and Encoding that helps RDoc load diff --git a/lib/rdoc/erb_partial.rb b/lib/rdoc/erb_partial.rb index d17dda20a9..8dc2c46013 100644 --- a/lib/rdoc/erb_partial.rb +++ b/lib/rdoc/erb_partial.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Allows an ERB template to be rendered in the context (binding) of an # existing ERB template evaluation. diff --git a/lib/rdoc/erbio.rb b/lib/rdoc/erbio.rb index a2aaa90e67..42ce895fb3 100644 --- a/lib/rdoc/erbio.rb +++ b/lib/rdoc/erbio.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'erb' ## diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb index 30b51a1dbd..e1b182902e 100644 --- a/lib/rdoc/extend.rb +++ b/lib/rdoc/extend.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A Module extension to a class with \#extend # diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb index 6efc5e4474..340dcbf7ae 100644 --- a/lib/rdoc/generator.rb +++ b/lib/rdoc/generator.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # RDoc uses generators to turn parsed source code in the form of an # RDoc::CodeObject tree into some form of output. RDoc comes with the HTML diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index 6cf2896189..bf4eb1f530 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # -*- mode: ruby; ruby-indent-level: 2; tab-width: 2 -*- require 'erb' diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb index ea9384e6d3..2a9db9bfc4 100644 --- a/lib/rdoc/generator/json_index.rb +++ b/lib/rdoc/generator/json_index.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'json' begin require 'zlib' diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb index 3ca423bb69..fef982d378 100644 --- a/lib/rdoc/generator/markup.rb +++ b/lib/rdoc/generator/markup.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Handle common RDoc::Markup tasks for various CodeObjects # diff --git a/lib/rdoc/generator/pot.rb b/lib/rdoc/generator/pot.rb index e2cf22d730..8a1e0b4bd0 100644 --- a/lib/rdoc/generator/pot.rb +++ b/lib/rdoc/generator/pot.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Generates a POT file. # diff --git a/lib/rdoc/generator/pot/message_extractor.rb b/lib/rdoc/generator/pot/message_extractor.rb index 0dd2497c26..313dfd2dc7 100644 --- a/lib/rdoc/generator/pot/message_extractor.rb +++ b/lib/rdoc/generator/pot/message_extractor.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Extracts message from RDoc::Store diff --git a/lib/rdoc/generator/pot/po.rb b/lib/rdoc/generator/pot/po.rb index 60e14db831..8cb61b8a1c 100644 --- a/lib/rdoc/generator/pot/po.rb +++ b/lib/rdoc/generator/pot/po.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Generates a PO format text diff --git a/lib/rdoc/generator/pot/po_entry.rb b/lib/rdoc/generator/pot/po_entry.rb index 515d02b48d..d537cb85e3 100644 --- a/lib/rdoc/generator/pot/po_entry.rb +++ b/lib/rdoc/generator/pot/po_entry.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A PO entry in PO diff --git a/lib/rdoc/generator/ri.rb b/lib/rdoc/generator/ri.rb index 830777e587..0eef1d03f5 100644 --- a/lib/rdoc/generator/ri.rb +++ b/lib/rdoc/generator/ri.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Generates ri data files diff --git a/lib/rdoc/ghost_method.rb b/lib/rdoc/ghost_method.rb index a1f75bfe4b..2488feb9d7 100644 --- a/lib/rdoc/ghost_method.rb +++ b/lib/rdoc/ghost_method.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # GhostMethod represents a method referenced only by a comment diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb index 14a3739c1c..4cb5986155 100644 --- a/lib/rdoc/i18n.rb +++ b/lib/rdoc/i18n.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # This module provides i18n related features. diff --git a/lib/rdoc/i18n/locale.rb b/lib/rdoc/i18n/locale.rb index 4d55f6965d..6a70d6c986 100644 --- a/lib/rdoc/i18n/locale.rb +++ b/lib/rdoc/i18n/locale.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A message container for a locale. # diff --git a/lib/rdoc/i18n/text.rb b/lib/rdoc/i18n/text.rb index fcfe7611bc..517abf1540 100644 --- a/lib/rdoc/i18n/text.rb +++ b/lib/rdoc/i18n/text.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An i18n supported text. # diff --git a/lib/rdoc/include.rb b/lib/rdoc/include.rb index efce43bffb..b3ad610649 100644 --- a/lib/rdoc/include.rb +++ b/lib/rdoc/include.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A Module included in a class with \#include # diff --git a/lib/rdoc/known_classes.rb b/lib/rdoc/known_classes.rb index 8d9421255b..4d7f4aa995 100644 --- a/lib/rdoc/known_classes.rb +++ b/lib/rdoc/known_classes.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true module RDoc ## diff --git a/lib/rdoc/markdown/entities.rb b/lib/rdoc/markdown/entities.rb index d32ae51053..d2cf610293 100644 --- a/lib/rdoc/markdown/entities.rb +++ b/lib/rdoc/markdown/entities.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # HTML entity name map for RDoc::Markdown diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb index 982bc13e88..08ecc6f7df 100644 --- a/lib/rdoc/markup.rb +++ b/lib/rdoc/markup.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # RDoc::Markup parses plain text documents and attempts to decompose them into # their constituent parts. Some of these parts are high-level: paragraphs, diff --git a/lib/rdoc/markup/attr_changer.rb b/lib/rdoc/markup/attr_changer.rb index 9a1a9c8c66..4c4bc6479e 100644 --- a/lib/rdoc/markup/attr_changer.rb +++ b/lib/rdoc/markup/attr_changer.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true class RDoc::Markup AttrChanger = Struct.new :turn_on, :turn_off # :nodoc: diff --git a/lib/rdoc/markup/attr_span.rb b/lib/rdoc/markup/attr_span.rb index 4d9e5b0217..63aace60d2 100644 --- a/lib/rdoc/markup/attr_span.rb +++ b/lib/rdoc/markup/attr_span.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An array of attributes which parallels the characters in a string. diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 6edb30b867..a10f731615 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Manages changes of attributes in a block of text diff --git a/lib/rdoc/markup/attributes.rb b/lib/rdoc/markup/attributes.rb index 8776c4ed29..ec30160d3d 100644 --- a/lib/rdoc/markup/attributes.rb +++ b/lib/rdoc/markup/attributes.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # We manage a set of attributes. Each attribute has a symbol name and a bit # value. diff --git a/lib/rdoc/markup/blank_line.rb b/lib/rdoc/markup/blank_line.rb index 2b1ab91b47..3129ab5e7f 100644 --- a/lib/rdoc/markup/blank_line.rb +++ b/lib/rdoc/markup/blank_line.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An empty line. This class is a singleton. diff --git a/lib/rdoc/markup/block_quote.rb b/lib/rdoc/markup/block_quote.rb index 3be022f9dd..7a4b3e36b0 100644 --- a/lib/rdoc/markup/block_quote.rb +++ b/lib/rdoc/markup/block_quote.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A quoted section which contains markup items. diff --git a/lib/rdoc/markup/document.rb b/lib/rdoc/markup/document.rb index 0692c3522f..f3a5de1fc3 100644 --- a/lib/rdoc/markup/document.rb +++ b/lib/rdoc/markup/document.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A Document containing lists, headings, paragraphs, etc. diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb index 197ff003e3..5dc71d2242 100644 --- a/lib/rdoc/markup/formatter.rb +++ b/lib/rdoc/markup/formatter.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Base class for RDoc markup formatters # diff --git a/lib/rdoc/markup/formatter_test_case.rb b/lib/rdoc/markup/formatter_test_case.rb index a5b4933de4..076b7c81bb 100644 --- a/lib/rdoc/markup/formatter_test_case.rb +++ b/lib/rdoc/markup/formatter_test_case.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'minitest/unit' ## diff --git a/lib/rdoc/markup/hard_break.rb b/lib/rdoc/markup/hard_break.rb index 5898bfb644..046068d5c2 100644 --- a/lib/rdoc/markup/hard_break.rb +++ b/lib/rdoc/markup/hard_break.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A hard-break in the middle of a paragraph. diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb index 5229287d5b..233774c5c4 100644 --- a/lib/rdoc/markup/heading.rb +++ b/lib/rdoc/markup/heading.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A heading with a level (1-6) and text diff --git a/lib/rdoc/markup/include.rb b/lib/rdoc/markup/include.rb index 891be71b85..ad7c4a9640 100644 --- a/lib/rdoc/markup/include.rb +++ b/lib/rdoc/markup/include.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A file included at generation time. Objects of this class are created by # RDoc::RD for an extension-less include. diff --git a/lib/rdoc/markup/indented_paragraph.rb b/lib/rdoc/markup/indented_paragraph.rb index 56a96bd3c9..d42b2e52b8 100644 --- a/lib/rdoc/markup/indented_paragraph.rb +++ b/lib/rdoc/markup/indented_paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An Indented Paragraph of text diff --git a/lib/rdoc/markup/inline.rb b/lib/rdoc/markup/inline.rb index 58072fef06..aba7ec21ce 100644 --- a/lib/rdoc/markup/inline.rb +++ b/lib/rdoc/markup/inline.rb @@ -1,2 +1,2 @@ -# frozen_string_literal: false +# frozen_string_literal: true warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w diff --git a/lib/rdoc/markup/list.rb b/lib/rdoc/markup/list.rb index bcaea7d7c1..05c3609202 100644 --- a/lib/rdoc/markup/list.rb +++ b/lib/rdoc/markup/list.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A List is a homogeneous set of ListItems. # diff --git a/lib/rdoc/markup/list_item.rb b/lib/rdoc/markup/list_item.rb index 115ec0412c..d22554ee73 100644 --- a/lib/rdoc/markup/list_item.rb +++ b/lib/rdoc/markup/list_item.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # An item within a List that contains paragraphs, headings, etc. # diff --git a/lib/rdoc/markup/paragraph.rb b/lib/rdoc/markup/paragraph.rb index fefa12f9ef..a2e45ef009 100644 --- a/lib/rdoc/markup/paragraph.rb +++ b/lib/rdoc/markup/paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A Paragraph of text diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index 22cca20420..9e6505da9d 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'strscan' ## diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb index e2115f0c56..c3c51b765c 100644 --- a/lib/rdoc/markup/pre_process.rb +++ b/lib/rdoc/markup/pre_process.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Handle common directives that can occur in a block of text: # diff --git a/lib/rdoc/markup/raw.rb b/lib/rdoc/markup/raw.rb index 8012d2cea6..85e2c8b825 100644 --- a/lib/rdoc/markup/raw.rb +++ b/lib/rdoc/markup/raw.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A section of text that is added to the output document as-is diff --git a/lib/rdoc/markup/rule.rb b/lib/rdoc/markup/rule.rb index b96d4fb293..38c1dc7f56 100644 --- a/lib/rdoc/markup/rule.rb +++ b/lib/rdoc/markup/rule.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A horizontal rule with a weight diff --git a/lib/rdoc/markup/special.rb b/lib/rdoc/markup/special.rb index 4d834b9e37..57261b44a7 100644 --- a/lib/rdoc/markup/special.rb +++ b/lib/rdoc/markup/special.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Hold details of a special sequence diff --git a/lib/rdoc/markup/text_formatter_test_case.rb b/lib/rdoc/markup/text_formatter_test_case.rb index 1c8882aa36..22a762b5f0 100644 --- a/lib/rdoc/markup/text_formatter_test_case.rb +++ b/lib/rdoc/markup/text_formatter_test_case.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Test case for creating new plain-text RDoc::Markup formatters. See also # RDoc::Markup::FormatterTestCase diff --git a/lib/rdoc/markup/to_ansi.rb b/lib/rdoc/markup/to_ansi.rb index 56cd1fe446..6cc3b70e93 100644 --- a/lib/rdoc/markup/to_ansi.rb +++ b/lib/rdoc/markup/to_ansi.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Outputs RDoc markup with vibrant ANSI color! diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb index 9a1c7c6ccd..fea017e89d 100644 --- a/lib/rdoc/markup/to_bs.rb +++ b/lib/rdoc/markup/to_bs.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Outputs RDoc markup with hot backspace action! You will probably need a # pager to use this output format. diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index d2c9a23a79..c5e1f073f8 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'cgi' ## diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 3f03c65898..2911aee954 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Subclass of the RDoc::Markup::ToHtml class that supports looking up method # names, classes, etc to create links. RDoc::CrossReference is used to diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb index 75c1df94d9..24aa1d32d9 100644 --- a/lib/rdoc/markup/to_html_snippet.rb +++ b/lib/rdoc/markup/to_html_snippet.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Outputs RDoc markup as paragraphs with inline markup only. diff --git a/lib/rdoc/markup/to_joined_paragraph.rb b/lib/rdoc/markup/to_joined_paragraph.rb index 3cc35e51d4..795f3f62ee 100644 --- a/lib/rdoc/markup/to_joined_paragraph.rb +++ b/lib/rdoc/markup/to_joined_paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Joins the parts of an RDoc::Markup::Paragraph into a single String. # diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb index bdf08b7aee..9f179013f2 100644 --- a/lib/rdoc/markup/to_label.rb +++ b/lib/rdoc/markup/to_label.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'cgi' ## diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb index 9074547b4c..d471032f9f 100644 --- a/lib/rdoc/markup/to_markdown.rb +++ b/lib/rdoc/markup/to_markdown.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # :markup: markdown ## diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb index a40c09859f..1cb4d6bab2 100644 --- a/lib/rdoc/markup/to_rdoc.rb +++ b/lib/rdoc/markup/to_rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Outputs RDoc markup as RDoc markup! (mostly) diff --git a/lib/rdoc/markup/to_table_of_contents.rb b/lib/rdoc/markup/to_table_of_contents.rb index eae7c59d94..f68b90bcf6 100644 --- a/lib/rdoc/markup/to_table_of_contents.rb +++ b/lib/rdoc/markup/to_table_of_contents.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Extracts just the RDoc::Markup::Heading elements from a # RDoc::Markup::Document to help build a table of contents diff --git a/lib/rdoc/markup/to_test.rb b/lib/rdoc/markup/to_test.rb index 7b1fa8c630..61d3cffaf0 100644 --- a/lib/rdoc/markup/to_test.rb +++ b/lib/rdoc/markup/to_test.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # This Markup outputter is used for testing purposes. diff --git a/lib/rdoc/markup/to_tt_only.rb b/lib/rdoc/markup/to_tt_only.rb index ba20fcdd00..4f43546e3d 100644 --- a/lib/rdoc/markup/to_tt_only.rb +++ b/lib/rdoc/markup/to_tt_only.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Extracts sections of text enclosed in plus, tt or code. Used to discover # undocumented parameters. diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb index a0b1d05928..7f1bc29a09 100644 --- a/lib/rdoc/markup/verbatim.rb +++ b/lib/rdoc/markup/verbatim.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A section of verbatim text diff --git a/lib/rdoc/meta_method.rb b/lib/rdoc/meta_method.rb index 408c089dd1..7927a9ce9c 100644 --- a/lib/rdoc/meta_method.rb +++ b/lib/rdoc/meta_method.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # MetaMethod represents a meta-programmed method diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb index 50eab141be..a1625a8872 100644 --- a/lib/rdoc/method_attr.rb +++ b/lib/rdoc/method_attr.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Abstract class representing either a method or an attribute. diff --git a/lib/rdoc/mixin.rb b/lib/rdoc/mixin.rb index 14f04c15e7..379d7cc526 100644 --- a/lib/rdoc/mixin.rb +++ b/lib/rdoc/mixin.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A Mixin adds features from a module into another context. RDoc::Include and # RDoc::Extend are both mixins. diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb index eb53e964dd..9278011778 100644 --- a/lib/rdoc/normal_class.rb +++ b/lib/rdoc/normal_class.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A normal class, neither singleton nor anonymous diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb index d046c8cbfe..8f364be41c 100644 --- a/lib/rdoc/normal_module.rb +++ b/lib/rdoc/normal_module.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A normal module, like NormalClass diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 60cfb5e553..e4fe4f75e9 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'optparse' require 'pathname' diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index 823a6d014c..2b826d9284 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -1,5 +1,5 @@ # -*- coding: us-ascii -*- -# frozen_string_literal: false +# frozen_string_literal: true ## # A parser is simple a class that subclasses RDoc::Parser and implements #scan diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 5c940ab28e..10061bfc7d 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'tsort' ## diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index c6c2d2bb23..f460321d3a 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'time' ## diff --git a/lib/rdoc/parser/markdown.rb b/lib/rdoc/parser/markdown.rb index feffb26ced..9ff478f872 100644 --- a/lib/rdoc/parser/markdown.rb +++ b/lib/rdoc/parser/markdown.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Parse a Markdown format file. The parsed RDoc::Markup::Document is attached # as a file comment. diff --git a/lib/rdoc/parser/rd.rb b/lib/rdoc/parser/rd.rb index e6693b9ac8..25f5711731 100644 --- a/lib/rdoc/parser/rd.rb +++ b/lib/rdoc/parser/rd.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Parse a RD format file. The parsed RDoc::Markup::Document is attached as a # file comment. diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 97c0511eda..9d0344283b 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # This file contains stuff stolen outright from: # diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb index ecd7065e4f..1f621cd32e 100644 --- a/lib/rdoc/parser/ruby_tools.rb +++ b/lib/rdoc/parser/ruby_tools.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Collection of methods for writing parsers diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb index f2ab27a92e..bef6da177f 100644 --- a/lib/rdoc/parser/simple.rb +++ b/lib/rdoc/parser/simple.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Parse a non-source file. We basically take the whole thing as one big # comment. diff --git a/lib/rdoc/parser/text.rb b/lib/rdoc/parser/text.rb index 1a13fd1186..01de0cc595 100644 --- a/lib/rdoc/parser/text.rb +++ b/lib/rdoc/parser/text.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Indicates this parser is text and doesn't contain code constructs. # diff --git a/lib/rdoc/rd.rb b/lib/rdoc/rd.rb index 39af3294f5..0d3d3cea85 100644 --- a/lib/rdoc/rd.rb +++ b/lib/rdoc/rd.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # RDoc::RD implements the RD format from the rdtool gem. # diff --git a/lib/rdoc/rd/inline.rb b/lib/rdoc/rd/inline.rb index 011ec67e33..cf37ed9f05 100644 --- a/lib/rdoc/rd/inline.rb +++ b/lib/rdoc/rd/inline.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Inline keeps track of markup and labels to create proper links. diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index adcb65b13b..48c2d099b6 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc' require 'find' diff --git a/lib/rdoc/require.rb b/lib/rdoc/require.rb index f565ffad78..91f9c24e5d 100644 --- a/lib/rdoc/require.rb +++ b/lib/rdoc/require.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A file loaded by \#require diff --git a/lib/rdoc/ri.rb b/lib/rdoc/ri.rb index 388cb12c70..c798c1fc49 100644 --- a/lib/rdoc/ri.rb +++ b/lib/rdoc/ri.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc' ## diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 51d633be58..fa0e040a42 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'abbrev' require 'optparse' diff --git a/lib/rdoc/ri/formatter.rb b/lib/rdoc/ri/formatter.rb index d0c85dbe6b..832a101e6c 100644 --- a/lib/rdoc/ri/formatter.rb +++ b/lib/rdoc/ri/formatter.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # For RubyGems backwards compatibility diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb index 94db2216a2..d41e610591 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/ri' ## diff --git a/lib/rdoc/ri/store.rb b/lib/rdoc/ri/store.rb index 66e234f521..9f4b03734a 100644 --- a/lib/rdoc/ri/store.rb +++ b/lib/rdoc/ri/store.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true module RDoc::RI Store = RDoc::Store # :nodoc: diff --git a/lib/rdoc/ri/task.rb b/lib/rdoc/ri/task.rb index cc0a85d4b7..6a6ea572bf 100644 --- a/lib/rdoc/ri/task.rb +++ b/lib/rdoc/ri/task.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true begin gem 'rdoc' rescue Gem::LoadError diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index e9351b7280..90b0541fcf 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/user_interaction' require 'fileutils' require 'rdoc' diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index dfc71436b8..89f26553ac 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc' require 'time' require 'json' diff --git a/lib/rdoc/single_class.rb b/lib/rdoc/single_class.rb index 7affa027e1..6a7b67deb3 100644 --- a/lib/rdoc/single_class.rb +++ b/lib/rdoc/single_class.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A singleton class diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb index 354e904b19..bd6c0ef23a 100644 --- a/lib/rdoc/stats.rb +++ b/lib/rdoc/stats.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # RDoc statistics collector which prints a summary and report of a project's # documentation totals. diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index 9f7ca59c34..9ab878e7e8 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true begin require 'io/console/size' rescue LoadError diff --git a/lib/rdoc/stats/quiet.rb b/lib/rdoc/stats/quiet.rb index 561c272ef7..bc4161b2d4 100644 --- a/lib/rdoc/stats/quiet.rb +++ b/lib/rdoc/stats/quiet.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Stats printer that prints nothing diff --git a/lib/rdoc/stats/verbose.rb b/lib/rdoc/stats/verbose.rb index e04edade52..6ace8937a2 100644 --- a/lib/rdoc/stats/verbose.rb +++ b/lib/rdoc/stats/verbose.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # Stats printer that prints everything documented, including the documented # status diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index aaefff8f13..999aa76f92 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'fileutils' ## diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb index 1074de0197..323d00eabc 100644 --- a/lib/rdoc/task.rb +++ b/lib/rdoc/task.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true #-- # Copyright (c) 2003, 2004 Jim Weirich, 2009 Eric Hodel # diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb index 594fb31272..501f5c3b8b 100644 --- a/lib/rdoc/test_case.rb +++ b/lib/rdoc/test_case.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true begin gem 'minitest', '~> 4.0' unless defined?(Test::Unit) rescue NoMethodError, Gem::LoadError diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 88ff255f01..2890d1901f 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # For RDoc::Text#to_html diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb index 3e6a71e089..05fb46e89a 100644 --- a/lib/rdoc/token_stream.rb +++ b/lib/rdoc/token_stream.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A TokenStream is a list of tokens, gathered during the parse of some entity # (say a method). Entities populate these streams by being registered with the diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb index d760849938..66a5ae7a33 100644 --- a/lib/rdoc/tom_doc.rb +++ b/lib/rdoc/tom_doc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # :markup: tomdoc # A parser for TomDoc based on TomDoc 1.0.0-rc1 (02adef9b5a) diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb index 38be646ad0..6186722772 100644 --- a/lib/rdoc/top_level.rb +++ b/lib/rdoc/top_level.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ## # A TopLevel context is a representation of the contents of a single file diff --git a/test/test_rdoc_alias.rb b/test/test_rdoc_alias.rb index fa0ab0f366..89ae2d5a56 100644 --- a/test/test_rdoc_alias.rb +++ b/test/test_rdoc_alias.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocAlias < XrefTestCase diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index 20d041bd7e..55793255ba 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocAnyMethod < XrefTestCase diff --git a/test/test_rdoc_attr.rb b/test/test_rdoc_attr.rb index e4062d1807..ae702ac702 100644 --- a/test/test_rdoc_attr.rb +++ b/test/test_rdoc_attr.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocAttr < RDoc::TestCase diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 503492fca5..273a21120f 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocClassModule < XrefTestCase diff --git a/test/test_rdoc_code_object.rb b/test/test_rdoc_code_object.rb index be4ca268e4..bdf6d8ae85 100644 --- a/test/test_rdoc_code_object.rb +++ b/test/test_rdoc_code_object.rb @@ -1,5 +1,5 @@ # coding: US-ASCII -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb index 3b0927212f..9eba298017 100644 --- a/test/test_rdoc_comment.rb +++ b/test/test_rdoc_comment.rb @@ -1,5 +1,5 @@ # coding: us-ascii -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_constant.rb b/test/test_rdoc_constant.rb index a03ab97a7d..e715131579 100644 --- a/test/test_rdoc_constant.rb +++ b/test/test_rdoc_constant.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocConstant < XrefTestCase diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index ceac14ac90..a7d6a58716 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocContext < XrefTestCase diff --git a/test/test_rdoc_context_section.rb b/test/test_rdoc_context_section.rb index b008c60c57..ff88b9b66a 100644 --- a/test/test_rdoc_context_section.rb +++ b/test/test_rdoc_context_section.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocContextSection < RDoc::TestCase diff --git a/test/test_rdoc_cross_reference.rb b/test/test_rdoc_cross_reference.rb index c39d6ad356..a294553704 100644 --- a/test/test_rdoc_cross_reference.rb +++ b/test/test_rdoc_cross_reference.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocCrossReference < XrefTestCase diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index e579fd5cc7..d9298880d7 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -1,5 +1,5 @@ # coding: US-ASCII -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_extend.rb b/test/test_rdoc_extend.rb index bc50a657ac..f4c8425864 100644 --- a/test/test_rdoc_extend.rb +++ b/test/test_rdoc_extend.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocExtend < XrefTestCase diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb index bbe351c0f6..c004bb271e 100644 --- a/test/test_rdoc_generator_darkfish.rb +++ b/test/test_rdoc_generator_darkfish.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorDarkfish < RDoc::TestCase diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 52c35a564d..154dfe7c4b 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -1,5 +1,5 @@ # coding: US-ASCII -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_generator_markup.rb b/test/test_rdoc_generator_markup.rb index d546c2f87f..d13f5119be 100644 --- a/test/test_rdoc_generator_markup.rb +++ b/test/test_rdoc_generator_markup.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorMarkup < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot.rb b/test/test_rdoc_generator_pot.rb index 3f1bee70c9..5675f96b75 100644 --- a/test/test_rdoc_generator_pot.rb +++ b/test/test_rdoc_generator_pot.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorPOT < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot_po.rb b/test/test_rdoc_generator_pot_po.rb index ae60ff004e..8786f632c0 100644 --- a/test/test_rdoc_generator_pot_po.rb +++ b/test/test_rdoc_generator_pot_po.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorPOTPO < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot_po_entry.rb b/test/test_rdoc_generator_pot_po_entry.rb index 36b85df864..5c24c2d70d 100644 --- a/test/test_rdoc_generator_pot_po_entry.rb +++ b/test/test_rdoc_generator_pot_po_entry.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorPOTPOEntry < RDoc::TestCase diff --git a/test/test_rdoc_generator_ri.rb b/test/test_rdoc_generator_ri.rb index d9f7b7ebc6..02bcee8904 100644 --- a/test/test_rdoc_generator_ri.rb +++ b/test/test_rdoc_generator_ri.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocGeneratorRI < RDoc::TestCase diff --git a/test/test_rdoc_i18n_locale.rb b/test/test_rdoc_i18n_locale.rb index e9dce78472..ff9836f9a6 100644 --- a/test/test_rdoc_i18n_locale.rb +++ b/test/test_rdoc_i18n_locale.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocI18nLocale < RDoc::TestCase diff --git a/test/test_rdoc_i18n_text.rb b/test/test_rdoc_i18n_text.rb index 4169b92079..be5ff581f5 100644 --- a/test/test_rdoc_i18n_text.rb +++ b/test/test_rdoc_i18n_text.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocI18nText < RDoc::TestCase diff --git a/test/test_rdoc_include.rb b/test/test_rdoc_include.rb index 6a34f5d4b8..67d3dfd88e 100644 --- a/test/test_rdoc_include.rb +++ b/test/test_rdoc_include.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocInclude < XrefTestCase diff --git a/test/test_rdoc_markdown.rb b/test/test_rdoc_markdown.rb index e6c63ffb13..99f8abf5ab 100644 --- a/test/test_rdoc_markdown.rb +++ b/test/test_rdoc_markdown.rb @@ -1,5 +1,5 @@ # coding: UTF-8 -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' require 'rdoc/markup/block_quote' diff --git a/test/test_rdoc_markdown_test.rb b/test/test_rdoc_markdown_test.rb index e738832fed..8664ac45a0 100644 --- a/test/test_rdoc_markdown_test.rb +++ b/test/test_rdoc_markdown_test.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'minitest/autorun' require 'pp' diff --git a/test/test_rdoc_markup.rb b/test/test_rdoc_markup.rb index ad13211f7b..8e4e8b968e 100644 --- a/test/test_rdoc_markup.rb +++ b/test/test_rdoc_markup.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkup < RDoc::TestCase diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb index b51e422474..9389e4cf64 100644 --- a/test/test_rdoc_markup_attribute_manager.rb +++ b/test/test_rdoc_markup_attribute_manager.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupAttributeManager < RDoc::TestCase diff --git a/test/test_rdoc_markup_attributes.rb b/test/test_rdoc_markup_attributes.rb index 077b6a5474..1fad62208c 100644 --- a/test/test_rdoc_markup_attributes.rb +++ b/test/test_rdoc_markup_attributes.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupAttributes < RDoc::TestCase diff --git a/test/test_rdoc_markup_document.rb b/test/test_rdoc_markup_document.rb index e5a61daea5..d817f1b9aa 100644 --- a/test/test_rdoc_markup_document.rb +++ b/test/test_rdoc_markup_document.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupDocument < RDoc::TestCase diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb index 02a6844a3a..1b0a011e6f 100644 --- a/test/test_rdoc_markup_formatter.rb +++ b/test/test_rdoc_markup_formatter.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupFormatter < RDoc::TestCase diff --git a/test/test_rdoc_markup_hard_break.rb b/test/test_rdoc_markup_hard_break.rb index 5d2d359646..d93d52eeda 100644 --- a/test/test_rdoc_markup_hard_break.rb +++ b/test/test_rdoc_markup_hard_break.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupHardBreak < RDoc::TestCase diff --git a/test/test_rdoc_markup_heading.rb b/test/test_rdoc_markup_heading.rb index 463df7ef43..33e29e90e6 100644 --- a/test/test_rdoc_markup_heading.rb +++ b/test/test_rdoc_markup_heading.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupHeading < RDoc::TestCase diff --git a/test/test_rdoc_markup_include.rb b/test/test_rdoc_markup_include.rb index e72a0ac1bb..28712fa7ed 100644 --- a/test/test_rdoc_markup_include.rb +++ b/test/test_rdoc_markup_include.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupInclude < RDoc::TestCase diff --git a/test/test_rdoc_markup_indented_paragraph.rb b/test/test_rdoc_markup_indented_paragraph.rb index efcd840453..53d44dcec2 100644 --- a/test/test_rdoc_markup_indented_paragraph.rb +++ b/test/test_rdoc_markup_indented_paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupIndentedParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_paragraph.rb b/test/test_rdoc_markup_paragraph.rb index 6da6658c6f..dce3ed8efd 100644 --- a/test/test_rdoc_markup_paragraph.rb +++ b/test/test_rdoc_markup_paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_parser.rb b/test/test_rdoc_markup_parser.rb index 849d19f8c7..fa4730a06f 100644 --- a/test/test_rdoc_markup_parser.rb +++ b/test/test_rdoc_markup_parser.rb @@ -1,5 +1,5 @@ # coding: utf-8 -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_markup_pre_process.rb b/test/test_rdoc_markup_pre_process.rb index be3fdcbef3..13e3ec13c0 100644 --- a/test/test_rdoc_markup_pre_process.rb +++ b/test/test_rdoc_markup_pre_process.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_markup_raw.rb b/test/test_rdoc_markup_raw.rb index 1453333b9e..aaf4e48439 100644 --- a/test/test_rdoc_markup_raw.rb +++ b/test/test_rdoc_markup_raw.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupRaw < RDoc::TestCase diff --git a/test/test_rdoc_markup_to_ansi.rb b/test/test_rdoc_markup_to_ansi.rb index 8bd49271c1..d06ad98fa3 100644 --- a/test/test_rdoc_markup_to_ansi.rb +++ b/test/test_rdoc_markup_to_ansi.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_bs.rb b/test/test_rdoc_markup_to_bs.rb index 153a121d78..9b798c92b3 100644 --- a/test/test_rdoc_markup_to_bs.rb +++ b/test/test_rdoc_markup_to_bs.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index 6fdb0222db..fa5828a007 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_html_crossref.rb b/test/test_rdoc_markup_to_html_crossref.rb index b9b5629554..73b76de4d9 100644 --- a/test/test_rdoc_markup_to_html_crossref.rb +++ b/test/test_rdoc_markup_to_html_crossref.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocMarkupToHtmlCrossref < XrefTestCase diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index 19c534863e..fa59de434f 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_joined_paragraph.rb b/test/test_rdoc_markup_to_joined_paragraph.rb index 414b7d3732..0a6a864bfa 100644 --- a/test/test_rdoc_markup_to_joined_paragraph.rb +++ b/test/test_rdoc_markup_to_joined_paragraph.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToJoinedParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_to_label.rb b/test/test_rdoc_markup_to_label.rb index 35df69c2ac..23ab8cbfab 100644 --- a/test/test_rdoc_markup_to_label.rb +++ b/test/test_rdoc_markup_to_label.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_markdown.rb b/test/test_rdoc_markup_to_markdown.rb index a72f30ee01..f5ea8d05da 100644 --- a/test/test_rdoc_markup_to_markdown.rb +++ b/test/test_rdoc_markup_to_markdown.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_rdoc.rb b/test/test_rdoc_markup_to_rdoc.rb index 0dce0a0d5a..31761eb44d 100644 --- a/test/test_rdoc_markup_to_rdoc.rb +++ b/test/test_rdoc_markup_to_rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_table_of_contents.rb b/test/test_rdoc_markup_to_table_of_contents.rb index acfa807948..f21dbfe748 100644 --- a/test/test_rdoc_markup_to_table_of_contents.rb +++ b/test/test_rdoc_markup_to_table_of_contents.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_tt_only.rb b/test/test_rdoc_markup_to_tt_only.rb index a7918c90ab..b08362cd0b 100644 --- a/test/test_rdoc_markup_to_tt_only.rb +++ b/test/test_rdoc_markup_to_tt_only.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_verbatim.rb b/test/test_rdoc_markup_verbatim.rb index 6fdf8fde28..3b05100a33 100644 --- a/test/test_rdoc_markup_verbatim.rb +++ b/test/test_rdoc_markup_verbatim.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocMarkupVerbatim < RDoc::TestCase diff --git a/test/test_rdoc_method_attr.rb b/test/test_rdoc_method_attr.rb index 70f129ef32..68a9d6cc21 100644 --- a/test/test_rdoc_method_attr.rb +++ b/test/test_rdoc_method_attr.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocMethodAttr < XrefTestCase diff --git a/test/test_rdoc_normal_class.rb b/test/test_rdoc_normal_class.rb index 9153bdc839..874eaaa88c 100644 --- a/test/test_rdoc_normal_class.rb +++ b/test/test_rdoc_normal_class.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocNormalClass < XrefTestCase diff --git a/test/test_rdoc_normal_module.rb b/test/test_rdoc_normal_module.rb index d92a72e7bf..68e776c41f 100644 --- a/test/test_rdoc_normal_module.rb +++ b/test/test_rdoc_normal_module.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocNormalModule < XrefTestCase diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb index eef37b44b4..760cf9db55 100644 --- a/test/test_rdoc_options.rb +++ b/test/test_rdoc_options.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocOptions < RDoc::TestCase diff --git a/test/test_rdoc_parser.rb b/test/test_rdoc_parser.rb index b71d89b064..5d4da7e425 100644 --- a/test/test_rdoc_parser.rb +++ b/test/test_rdoc_parser.rb @@ -1,5 +1,5 @@ # -*- coding: us-ascii -*- -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 3b26e4d51c..2cc8ddf79a 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' =begin diff --git a/test/test_rdoc_parser_changelog.rb b/test/test_rdoc_parser_changelog.rb index 0135d26d87..46cbb0d9a3 100644 --- a/test/test_rdoc_parser_changelog.rb +++ b/test/test_rdoc_parser_changelog.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocParserChangeLog < RDoc::TestCase diff --git a/test/test_rdoc_parser_markdown.rb b/test/test_rdoc_parser_markdown.rb index a8a8402946..50893ecf99 100644 --- a/test/test_rdoc_parser_markdown.rb +++ b/test/test_rdoc_parser_markdown.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocParserMarkdown < RDoc::TestCase diff --git a/test/test_rdoc_parser_rd.rb b/test/test_rdoc_parser_rd.rb index 481d190ffe..e8f4250284 100644 --- a/test/test_rdoc_parser_rd.rb +++ b/test/test_rdoc_parser_rd.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocParserRd < RDoc::TestCase diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index f846dc592a..e28112fbee 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_parser_simple.rb b/test/test_rdoc_parser_simple.rb index 0e2cf0d9a9..cdbcd7929d 100644 --- a/test/test_rdoc_parser_simple.rb +++ b/test/test_rdoc_parser_simple.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocParserSimple < RDoc::TestCase diff --git a/test/test_rdoc_rd.rb b/test/test_rdoc_rd.rb index 938c5569f9..ed67ae2caa 100644 --- a/test/test_rdoc_rd.rb +++ b/test/test_rdoc_rd.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRd < RDoc::TestCase diff --git a/test/test_rdoc_rd_block_parser.rb b/test/test_rdoc_rd_block_parser.rb index 18ec30db0f..a73c206508 100644 --- a/test/test_rdoc_rd_block_parser.rb +++ b/test/test_rdoc_rd_block_parser.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRdBlockParser < RDoc::TestCase diff --git a/test/test_rdoc_rd_inline.rb b/test/test_rdoc_rd_inline.rb index d4448e4397..2869681c6e 100644 --- a/test/test_rdoc_rd_inline.rb +++ b/test/test_rdoc_rd_inline.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRdInline < RDoc::TestCase diff --git a/test/test_rdoc_rd_inline_parser.rb b/test/test_rdoc_rd_inline_parser.rb index eb022b240f..b4394019b3 100644 --- a/test/test_rdoc_rd_inline_parser.rb +++ b/test/test_rdoc_rd_inline_parser.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRdInlineParser < RDoc::TestCase diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index be7a90c236..32c5a44bbe 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRDoc < RDoc::TestCase diff --git a/test/test_rdoc_require.rb b/test/test_rdoc_require.rb index cfbdac7a57..46c225299a 100644 --- a/test/test_rdoc_require.rb +++ b/test/test_rdoc_require.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocRequire < XrefTestCase diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 81c8469e25..687d0968df 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRIDriver < RDoc::TestCase diff --git a/test/test_rdoc_ri_paths.rb b/test/test_rdoc_ri_paths.rb index 06968b5510..b0f368353a 100644 --- a/test/test_rdoc_ri_paths.rb +++ b/test/test_rdoc_ri_paths.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocRIPaths < RDoc::TestCase diff --git a/test/test_rdoc_rubygems_hook.rb b/test/test_rdoc_rubygems_hook.rb index ee16f3d95c..2fb79ff577 100644 --- a/test/test_rdoc_rubygems_hook.rb +++ b/test/test_rdoc_rubygems_hook.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rubygems/test_case' require 'rdoc/rubygems_hook' diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 947d8c896c..4dd1f08ddd 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocServlet < RDoc::TestCase diff --git a/test/test_rdoc_single_class.rb b/test/test_rdoc_single_class.rb index 85a99d2229..5761bfef4d 100644 --- a/test/test_rdoc_single_class.rb +++ b/test/test_rdoc_single_class.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocSingleClass < RDoc::TestCase diff --git a/test/test_rdoc_stats.rb b/test/test_rdoc_stats.rb index 34e1417783..19fc2365b3 100644 --- a/test/test_rdoc_stats.rb +++ b/test/test_rdoc_stats.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocStats < RDoc::TestCase diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index d32eab3ec1..4a4cf3ac0f 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocStore < XrefTestCase diff --git a/test/test_rdoc_task.rb b/test/test_rdoc_task.rb index bb5d2ae134..ac3512f42a 100644 --- a/test/test_rdoc_task.rb +++ b/test/test_rdoc_task.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' begin require 'rake' diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 7a125854b5..8d638bbc38 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' diff --git a/test/test_rdoc_token_stream.rb b/test/test_rdoc_token_stream.rb index 95c3ffd13e..abf1469bbc 100644 --- a/test/test_rdoc_token_stream.rb +++ b/test/test_rdoc_token_stream.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocTokenStream < RDoc::TestCase diff --git a/test/test_rdoc_tom_doc.rb b/test/test_rdoc_tom_doc.rb index 7076edfa72..6e60e67726 100644 --- a/test/test_rdoc_tom_doc.rb +++ b/test/test_rdoc_tom_doc.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'rdoc/test_case' class TestRDocTomDoc < RDoc::TestCase diff --git a/test/test_rdoc_top_level.rb b/test/test_rdoc_top_level.rb index b8145e3f9d..00fc7a1bd5 100644 --- a/test/test_rdoc_top_level.rb +++ b/test/test_rdoc_top_level.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require File.expand_path '../xref_test_case', __FILE__ class TestRDocTopLevel < XrefTestCase diff --git a/test/xref_data.rb b/test/xref_data.rb index c712ab8891..bc20d8ed91 100644 --- a/test/xref_data.rb +++ b/test/xref_data.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true XREF_DATA = <<-XREF_DATA class C1 diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 9b2f876e5a..9f709964c6 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true ENV['RDOC_TEST'] = 'yes' require 'rdoc' From 4592938ce0622523fd811b547ea5525db0ecb251 Mon Sep 17 00:00:00 2001 From: Code Ass Date: Sun, 5 Nov 2017 00:16:05 +0900 Subject: [PATCH 0483/1389] Use normal method instead of ban ver. for String Ruby 2.2 or earlier only has String#force_encoding for changing character encoding set without encode byte sequence, it changes receiver itself. Ruby 2.3 or later has frozen_striing_literal magic comment and String#new can take encoding keyword parameter for character encoding set without encode byte sequence. So implements RDoc::Encoding.change_encoding and RDoc::Comment#encode! to disguise difference between #force_encoding and encoding keyword parameter of #new on String. --- lib/rdoc/any_method.rb | 8 ++-- lib/rdoc/code_object.rb | 2 +- lib/rdoc/comment.rb | 28 +++++++---- lib/rdoc/context.rb | 4 +- lib/rdoc/context/section.rb | 2 +- lib/rdoc/encoding.rb | 56 +++++++++++++++------- lib/rdoc/generator/pot/po.rb | 4 +- lib/rdoc/generator/pot/po_entry.rb | 20 ++++---- lib/rdoc/i18n/text.rb | 8 ++-- lib/rdoc/markup/parser.rb | 4 +- lib/rdoc/markup/pre_process.rb | 10 ++-- lib/rdoc/method_attr.rb | 2 +- lib/rdoc/normal_class.rb | 4 +- lib/rdoc/options.rb | 10 ++-- lib/rdoc/parser/c.rb | 10 ++-- lib/rdoc/parser/changelog.rb | 8 ++-- lib/rdoc/parser/ruby.rb | 42 ++++++++-------- lib/rdoc/parser/simple.rb | 4 +- lib/rdoc/rd/inline.rb | 8 ++-- lib/rdoc/servlet.rb | 2 +- lib/rdoc/stats/normal.rb | 2 +- lib/rdoc/test_case.rb | 5 +- lib/rdoc/text.rb | 12 ++--- lib/rdoc/tom_doc.rb | 2 +- test/test_rdoc_code_object.rb | 4 +- test/test_rdoc_comment.rb | 8 ++-- test/test_rdoc_encoding.rb | 30 ++++++------ test/test_rdoc_generator_json_index.rb | 4 +- test/test_rdoc_markup_attribute_manager.rb | 12 ++--- test/test_rdoc_markup_formatter.rb | 2 +- test/test_rdoc_markup_pre_process.rb | 12 ++--- test/test_rdoc_markup_to_html_snippet.rb | 2 +- test/test_rdoc_parser_changelog.rb | 4 +- test/test_rdoc_text.rb | 12 ++--- test/test_rdoc_tom_doc.rb | 4 +- 35 files changed, 192 insertions(+), 159 deletions(-) diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index e61f263cdc..9b0d309653 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -244,9 +244,9 @@ def param_list if @block_params then # If this method has explicit block parameters, remove any explicit # &block - params.sub!(/,?\s*&\w+/, '') + params = params.sub(/,?\s*&\w+/, '') else - params.sub!(/\&(\w+)/, '\1') + params = params.sub(/\&(\w+)/, '\1') end params = params.gsub(/\s+/, '').split(',').reject(&:empty?) @@ -274,11 +274,11 @@ def param_seq if @block_params then # If this method has explicit block parameters, remove any explicit # &block - params.sub!(/,?\s*&\w+/, '') + params = params.sub(/,?\s*&\w+/, '') block = @block_params.tr_s("\n ", " ") if block[0] == ?( - block.sub!(/^\(/, '').sub!(/\)/, '') + block = block.sub(/^\(/, '').sub(/\)/, '') end params << " { |#{block}| ... }" end diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb index 48a6761b87..aeb4b4762e 100644 --- a/lib/rdoc/code_object.rb +++ b/lib/rdoc/code_object.rb @@ -144,7 +144,7 @@ def comment=(comment) # HACK correct fix is to have #initialize create @comment # with the correct encoding if String === @comment and @comment.empty? then - @comment.force_encoding comment.encoding + @comment = RDoc::Encoding.change_encoding @comment, comment.encoding end @comment end diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb index f8482e2754..134f6440a0 100644 --- a/lib/rdoc/comment.rb +++ b/lib/rdoc/comment.rb @@ -45,7 +45,7 @@ class RDoc::Comment def initialize text = nil, location = nil @location = location - @text = text + @text = text.nil? ? nil : text.dup @document = nil @format = 'rdoc' @@ -114,10 +114,14 @@ def extract_call_seq method method.call_seq = seq.chomp - elsif @text.sub!(/^\s*:?call-seq:(.*?)(^\s*$|\z)/m, '') then - seq = $1 - seq.gsub!(/^\s*/, '') - method.call_seq = seq + else + regexp = /^\s*:?call-seq:(.*?)(^\s*$|\z)/m + if regexp =~ @text then + @text = @text.sub(regexp, '') + seq = $1 + seq.gsub!(/^\s*/, '') + method.call_seq = seq + end end method @@ -133,8 +137,14 @@ def empty? ## # HACK dubious - def force_encoding encoding - @text.force_encoding encoding + def encode! encoding + # TODO: Remove this condition after Ruby 2.2 EOL + if RUBY_VERSION < '2.3.0' + @text = @text.force_encoding encoding + else + @text = String.new @text, encoding: encoding + end + self end ## @@ -200,7 +210,7 @@ def parse def remove_private # Workaround for gsub encoding for Ruby 1.9.2 and earlier empty = '' - empty.force_encoding @text.encoding + empty = RDoc::Encoding.change_encoding empty, @text.encoding @text = @text.gsub(%r%^\s*([#*]?)--.*?^\s*(\1)\+\+\n?%m, empty) @text = @text.sub(%r%^\s*[#*]?--.*%m, '') @@ -216,7 +226,7 @@ def text= text @text.nil? and @document @document = nil - @text = text + @text = text.nil? ? nil : text.dup end ## diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index 52f01be809..58b1c54269 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -239,7 +239,7 @@ def add_attribute attribute if known then known.comment = attribute.comment if known.comment.empty? - elsif registered = @methods_hash[attribute.pretty_name << '='] and + elsif registered = @methods_hash[attribute.pretty_name + '='] and RDoc::Attr === registered then registered.rw = 'RW' else @@ -249,7 +249,7 @@ def add_attribute attribute end if attribute.rw.index 'W' then - key = attribute.pretty_name << '=' + key = attribute.pretty_name + '=' known = @methods_hash[key] if known then diff --git a/lib/rdoc/context/section.rb b/lib/rdoc/context/section.rb index 64877f944c..11f9ceaf87 100644 --- a/lib/rdoc/context/section.rb +++ b/lib/rdoc/context/section.rb @@ -43,7 +43,7 @@ def initialize parent, title, comment @parent = parent @title = title ? title.strip : title - @@sequence.succ! + @@sequence = @@sequence.succ @sequence = @@sequence.dup @comments = [] diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index 150865b623..54ecd89816 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -23,26 +23,26 @@ def self.read_file filename, encoding, force_transcode = false utf8 = content.sub!(/\A\xef\xbb\xbf/, '') - RDoc::Encoding.set_encoding content + content = RDoc::Encoding.set_encoding content begin encoding ||= Encoding.default_external orig_encoding = content.encoding if not orig_encoding.ascii_compatible? then - content.encode! encoding + content = content.encode encoding elsif utf8 then - content.force_encoding Encoding::UTF_8 - content.encode! encoding + content = RDoc::Encoding.change_encoding content, Encoding::UTF_8 + content = content.encode encoding else # assume the content is in our output encoding - content.force_encoding encoding + content = RDoc::Encoding.change_encoding content, encoding end unless content.valid_encoding? then # revert and try to transcode - content.force_encoding orig_encoding - content.encode! encoding + content = RDoc::Encoding.change_encoding content, orig_encoding + content = content.encode encoding end unless content.valid_encoding? then @@ -52,10 +52,11 @@ def self.read_file filename, encoding, force_transcode = false rescue Encoding::InvalidByteSequenceError, Encoding::UndefinedConversionError => e if force_transcode then - content.force_encoding orig_encoding - content.encode!(encoding, - :invalid => :replace, :undef => :replace, - :replace => '?') + content = RDoc::Encoding.change_encoding content, orig_encoding + content = content.encode(encoding, + :invalid => :replace, + :undef => :replace, + :replace => '?') return content else warn "unable to convert #{e.message} for #{filename}, skipping" @@ -77,15 +78,17 @@ def self.remove_frozen_string_literal string first_line = $1 if first_line =~ /\A# +frozen[-_]string[-_]literal[=:].+$/i - string.sub! first_line, '' + string = string.sub first_line, '' end + + string end ## # Sets the encoding of +string+ based on the magic comment def self.set_encoding string - remove_frozen_string_literal string + string = remove_frozen_string_literal string string =~ /\A(?:#!.*\n)?(.*\n)/ @@ -94,15 +97,34 @@ def self.set_encoding string name = case first_line when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2 when /\b(?:en)?coding[=:]\s*([^\s;]+)/i then $1 - else return + else return string end - string.sub! first_line, '' + string = string.sub first_line, '' - remove_frozen_string_literal string + string = remove_frozen_string_literal string enc = Encoding.find name - string.force_encoding enc if enc + string = RDoc::Encoding.change_encoding string, enc if enc + + string + end + + ## + # Changes encoding based on +encoding+ without converting and returns new + # string + + def self.change_encoding text, encoding + if text.kind_of? RDoc::Comment + text.encode! encoding + else + # TODO: Remove this condition after Ruby 2.2 EOL + if RUBY_VERSION < '2.3.0' + text.force_encoding encoding + else + String.new text, encoding: encoding + end + end end end diff --git a/lib/rdoc/generator/pot/po.rb b/lib/rdoc/generator/pot/po.rb index 8cb61b8a1c..37d45e5258 100644 --- a/lib/rdoc/generator/pot/po.rb +++ b/lib/rdoc/generator/pot/po.rb @@ -29,8 +29,8 @@ def add entry def to_s po = '' sort_entries.each do |entry| - po << "\n" unless po.empty? - po << entry.to_s + po += "\n" unless po.empty? + po += entry.to_s end po end diff --git a/lib/rdoc/generator/pot/po_entry.rb b/lib/rdoc/generator/pot/po_entry.rb index d537cb85e3..3c278826f4 100644 --- a/lib/rdoc/generator/pot/po_entry.rb +++ b/lib/rdoc/generator/pot/po_entry.rb @@ -40,11 +40,11 @@ def initialize msgid, options = {} def to_s entry = '' - entry << format_translator_comment - entry << format_extracted_comment - entry << format_references - entry << format_flags - entry << <<-ENTRY + entry += format_translator_comment + entry += format_extracted_comment + entry += format_references + entry += format_flags + entry += <<-ENTRY msgid #{format_message(@msgid)} msgstr #{format_message(@msgstr)} ENTRY @@ -75,9 +75,9 @@ def format_comment mark, comment formatted_comment = '' comment.each_line do |line| - formatted_comment << "#{mark} #{line}" + formatted_comment += "#{mark} #{line}" end - formatted_comment << "\n" unless formatted_comment.end_with?("\n") + formatted_comment += "\n" unless formatted_comment.end_with?("\n") formatted_comment end @@ -94,7 +94,7 @@ def format_references formatted_references = '' @references.sort.each do |file, line| - formatted_references << "\#: #{file}:#{line}\n" + formatted_references += "\#: #{file}:#{line}\n" end formatted_references end @@ -111,8 +111,8 @@ def format_message message formatted_message = '""' message.each_line do |line| - formatted_message << "\n" - formatted_message << "\"#{escape(line)}\"" + formatted_message += "\n" + formatted_message += "\"#{escape(line)}\"" end formatted_message end diff --git a/lib/rdoc/i18n/text.rb b/lib/rdoc/i18n/text.rb index 517abf1540..7ea6664442 100644 --- a/lib/rdoc/i18n/text.rb +++ b/lib/rdoc/i18n/text.rb @@ -46,9 +46,9 @@ def translate(locale) parse do |part| case part[:type] when :paragraph - translated_text << locale.translate(part[:paragraph]) + translated_text += locale.translate(part[:paragraph]) when :empty_line - translated_text << part[:line] + translated_text += part[:line] else raise "should not reach here: unexpected type: #{type}" end @@ -69,14 +69,14 @@ def parse(&block) if paragraph.empty? emit_empty_line_event(line, line_no, &block) else - paragraph << line + paragraph += line emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block) paragraph = '' end else paragraph_start_line = line_no if paragraph.empty? - paragraph << line + paragraph += line end end diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index 9e6505da9d..f08587e676 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -249,7 +249,7 @@ def build_verbatim margin min_indent = nil generate_leading_spaces = true - line = '' + line = ''.dup until @tokens.empty? do type, data, column, = get @@ -257,7 +257,7 @@ def build_verbatim margin if type == :NEWLINE then line << data verbatim << line - line = '' + line = ''.dup generate_leading_spaces = true next end diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb index c3c51b765c..0ac7a41934 100644 --- a/lib/rdoc/markup/pre_process.rb +++ b/lib/rdoc/markup/pre_process.rb @@ -105,7 +105,7 @@ def handle text, code_object = nil, &block # regexp helper (square brackets for optional) # $1 $2 $3 $4 $5 # [prefix][\]:directive:[spaces][param]newline - text.gsub!(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do + text = text.gsub(/^([ \t]*(?:#|\/?\*)?[ \t]*)(\\?):(\w+):([ \t]*)(.+)?(\r?\n|$)/) do # skip something like ':toto::' next $& if $4.empty? and $5 and $5[0, 1] == ':' @@ -123,7 +123,11 @@ def handle text, code_object = nil, &block handle_directive $1, $3, $5, code_object, text.encoding, &block end - comment = text unless comment + if comment then + comment.text = text + else + comment = text + end self.class.post_processors.each do |handler| handler.call comment, code_object @@ -212,7 +216,7 @@ def handle_directive prefix, directive, param, code_object = nil, when 'yield', 'yields' then return blankline unless code_object # remove parameter &block - code_object.params.sub!(/,?\s*&\w+/, '') if code_object.params + code_object.params = code_object.params.sub(/,?\s*&\w+/, '') if code_object.params code_object.block_params = param diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb index a1625a8872..3cef78c4a5 100644 --- a/lib/rdoc/method_attr.rb +++ b/lib/rdoc/method_attr.rb @@ -188,7 +188,7 @@ def find_method_or_attribute name # :nodoc: next if String === ancestor next if parent == ancestor - other = ancestor.find_method_named('#' << name) || + other = ancestor.find_method_named('#' + name) || ancestor.find_attribute_named(name) return other if other diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb index 9278011778..6729b18448 100644 --- a/lib/rdoc/normal_class.rb +++ b/lib/rdoc/normal_class.rb @@ -47,9 +47,9 @@ def inspect # :nodoc: def to_s # :nodoc: display = "#{self.class.name} #{self.full_name}" if superclass - display << ' < ' << (superclass.is_a?(String) ? superclass : superclass.full_name) + display += ' < ' + (superclass.is_a?(String) ? superclass : superclass.full_name) end - display << ' -> ' << is_alias_for.to_s if is_alias_for + display += ' -> ' + is_alias_for.to_s if is_alias_for display end diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index e4fe4f75e9..17bbca81fe 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -624,16 +624,16 @@ def parse argv end parsers.sort.each do |parser, regexp| - opt.banner << " - #{parser}: #{regexp.join ', '}\n" + opt.banner += " - #{parser}: #{regexp.join ', '}\n" end - opt.banner << " - TomDoc: Only in ruby files\n" + opt.banner += " - TomDoc: Only in ruby files\n" - opt.banner << "\n The following options are deprecated:\n\n" + opt.banner += "\n The following options are deprecated:\n\n" name_length = DEPRECATED.keys.sort_by { |k| k.length }.last.length DEPRECATED.sort_by { |k,| k }.each do |name, reason| - opt.banner << " %*1$2$s %3$s\n" % [-name_length, name, reason] + opt.banner += " %*1$2$s %3$s\n" % [-name_length, name, reason] end opt.accept Template do |template| @@ -1087,7 +1087,7 @@ def parse argv unless quiet then deprecated.each do |opt| - $stderr.puts 'option ' << opt << ' is deprecated: ' << DEPRECATED[opt] + $stderr.puts 'option ' + opt + ' is deprecated: ' + DEPRECATED[opt] end end diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 10061bfc7d..183538d54b 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -865,8 +865,8 @@ def find_override_comment class_name, meth_obj def handle_attr(var_name, attr_name, read, write) rw = '' - rw << 'R' if '1' == read - rw << 'W' if '1' == write + rw += 'R' if '1' == read + rw += 'W' if '1' == write class_name = @known_classes[var_name] @@ -982,8 +982,8 @@ def handle_constants(type, var_name, const_name, definition) if new_definition.empty? then # Default to literal C definition new_definition = definition else - new_definition.gsub!("\:", ":") - new_definition.gsub!("\\", '\\') + new_definition = new_definition.gsub("\:", ":") + new_definition = new_definition.gsub("\\", '\\') end new_definition.sub!(/\A(\s+)/, '') @@ -1237,7 +1237,7 @@ def rb_scan_args method_body # when scanning for classes and methods def remove_commented_out_lines - @content.gsub!(%r%//.*rb_define_%, '//') + @content = @content.gsub(%r%//.*rb_define_%, '//') end ## diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index f460321d3a..167892f543 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -29,13 +29,13 @@ def continue_entry_body entry_body, continuation if last =~ /\)\s*\z/ and continuation =~ /\A\(/ then last.sub!(/\)\s*\z/, ',') - continuation.sub!(/\A\(/, '') + continuation = continuation.sub(/\A\(/, '') end if last =~ /\s\z/ then last << continuation else - last << ' ' << continuation + last << ' ' + continuation end end @@ -162,12 +162,12 @@ def parse_entries entry_body = [] when /^(\t| {8})?\*\s*(.*)/ then # "\t* file.c (func): ..." - entry_body << $2 + entry_body << $2.dup when /^(\t| {8})?\s*(\(.*)/ then # "\t(func): ..." entry = $2 if entry_body.last =~ /:/ then - entry_body << entry + entry_body << entry.dup else continue_entry_body entry_body, entry end diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 9d0344283b..f1856acce8 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -239,8 +239,8 @@ def get_visibility_information tk, single # :nodoc: def collect_first_comment skip_tkspace - comment = '' - comment.force_encoding @encoding if @encoding + comment = ''.dup + comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding first_line = true first_comment_tk_kind = nil @@ -341,7 +341,7 @@ def get_bool def get_class_or_module container, ignore_constants = false skip_tkspace name_t = get_tk - given_name = '' + given_name = ''.dup # class ::A -> A is in the top level if :on_op == name_t[:kind] and '::' == name_t[:text] then # bug @@ -378,7 +378,7 @@ def get_class_or_module container, ignore_constants = false if prev_container == container and !ignore_constants given_name = name_t[:text] else - given_name << '::' << name_t[:text] + given_name << '::' + name_t[:text] end end @@ -594,7 +594,7 @@ def look_for_directives_in container, comment # Adds useful info about the parser to +message+ def make_message message - prefix = "#{@file_name}:" + prefix = "#{@file_name}:".dup tk = peek_tk prefix << "#{tk[:line_no]}:#{tk[:char_no]}:" if tk @@ -913,7 +913,7 @@ def parse_constant container, tk, comment, ignore_constants = false return unless body - value.replace body + con.value = body record_location con con.line = line_no read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS @@ -928,7 +928,7 @@ def parse_constant container, tk, comment, ignore_constants = false def parse_constant_body container, constant, is_array_or_hash # :nodoc: nest = 0 - rhs_name = '' + rhs_name = ''.dup get_tkread @@ -990,14 +990,13 @@ def parse_comment container, tk, comment column = tk[:char_no] line_no = tk[:line_no] - text = comment.text - - singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3') + comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3') + singleton = !!$~ co = - if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then - parse_comment_ghost container, text, $1, column, line_no, comment - elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then + if (comment.text = comment.text.sub(/^# +:?method: *(\S*).*?\n/i, '')) && !!$~ then + parse_comment_ghost container, comment.text, $1, column, line_no, comment + elsif (comment.text = comment.text.sub(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '')) && !!$~ then parse_comment_attr container, $1, $3, comment end @@ -1194,7 +1193,9 @@ def parse_meta_attr(context, single, tk, comment) tmp = RDoc::CodeObject.new read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS - if comment.text.sub!(/^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then + regexp = /^# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i + if regexp =~ comment.text then + comment.text = comment.text.sub(regexp, '') rw = case $1 when 'attr_reader' then 'R' when 'attr_writer' then 'W' @@ -1227,7 +1228,8 @@ def parse_meta_method(container, single, tk, comment) skip_tkspace false - singleton = !!comment.text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3') + comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3') + singleton = !!$~ name = parse_meta_method_name comment, tk @@ -1643,7 +1645,7 @@ def parse_rescue def parse_statements(container, single = NORMAL, current_method = nil, comment = new_comment('')) raise 'no' unless RDoc::Comment === comment - comment.force_encoding @encoding if @encoding + comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding nest = 1 save_visibility = container.visibility @@ -1686,12 +1688,12 @@ def parse_statements(container, single = NORMAL, current_method = nil, comment.empty? comment = '' - comment.force_encoding @encoding if @encoding + comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding end while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do - comment << tk[:text] - comment << "\n" unless "\n" == tk[:text].chars.to_a.last + comment += tk[:text] + comment += "\n" unless "\n" == tk[:text].chars.to_a.last if tk[:text].size > 1 && "\n" == tk[:text].chars.to_a.last then skip_tkspace false # leading spaces @@ -1810,7 +1812,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, unless keep_comment then comment = new_comment '' - comment.force_encoding @encoding if @encoding + comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding container.params = nil container.block_params = nil end diff --git a/lib/rdoc/parser/simple.rb b/lib/rdoc/parser/simple.rb index bef6da177f..b1dabad0f8 100644 --- a/lib/rdoc/parser/simple.rb +++ b/lib/rdoc/parser/simple.rb @@ -19,7 +19,7 @@ def initialize(top_level, file_name, content, options, stats) preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include - preprocess.handle @content, @top_level + @content = preprocess.handle @content, @top_level end ## @@ -52,7 +52,7 @@ def remove_coding_comment text def remove_private_comment comment # Workaround for gsub encoding for Ruby 1.9.2 and earlier empty = '' - empty.force_encoding comment.encoding + empty = RDoc::Encoding.change_encoding empty, comment.encoding comment = comment.gsub(%r%^--\n.*?^\+\+\n?%m, empty) comment.sub(%r%^--\n.*%m, empty) diff --git a/lib/rdoc/rd/inline.rb b/lib/rdoc/rd/inline.rb index cf37ed9f05..e5cb545728 100644 --- a/lib/rdoc/rd/inline.rb +++ b/lib/rdoc/rd/inline.rb @@ -50,11 +50,11 @@ def == other # :nodoc: def append more case more when String then - @reference << more - @rdoc << more + @reference += more + @rdoc += more when RDoc::RD::Inline then - @reference << more.reference - @rdoc << more.rdoc + @reference += more.reference + @rdoc += more.rdoc else raise "unknown thingy #{more}" end diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index 89f26553ac..f2d6dd5adc 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -111,7 +111,7 @@ def asset generator_name, req, res # GET request entry point. Fills in +res+ for the path, etc. in +req+. def do_GET req, res - req.path.sub!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path + req.path = req.path.sub(/^#{Regexp.escape @mount_path}/o, '') if @mount_path case req.path when '/' then diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index 9ab878e7e8..a3a6ff377e 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -42,7 +42,7 @@ def print_file files_so_far, filename if $stdout.tty? # Clean the line with whitespaces so that leftover output from the # previous line doesn't show up. - $stdout.print("\r" << (" " * @last_width) << ("\b" * @last_width) << "\r") if @last_width && @last_width > 0 + $stdout.print("\r" + (" " * @last_width) + ("\b" * @last_width) + "\r") if @last_width && @last_width > 0 @last_width = line.size $stdout.print("#{line}\r") else diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb index 501f5c3b8b..22d3f14219 100644 --- a/lib/rdoc/test_case.rb +++ b/lib/rdoc/test_case.rb @@ -139,9 +139,8 @@ def list type = nil, *items # Enables pretty-print output def mu_pp obj # :nodoc: - s = '' - s = PP.pp obj, s - s = s.force_encoding Encoding.default_external + s = obj.pretty_inspect + s = RDoc::Encoding.change_encoding s, Encoding.default_external s.chomp end diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 2890d1901f..7e714be0ad 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -60,7 +60,7 @@ def expand_tabs text text.each_line do |line| nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do r = "#{$1}#{$2}#{' ' * (8 - $2.size)}" - r.force_encoding text.encoding + r = RDoc::Encoding.change_encoding r, text.encoding r end @@ -82,7 +82,7 @@ def flush_left text end empty = '' - empty.force_encoding text.encoding + empty = RDoc::Encoding.change_encoding empty, text.encoding text.gsub(/^ {0,#{indent}}/, empty) end @@ -149,7 +149,7 @@ def strip_hashes text return text if text =~ /^(?>\s*)[^\#]/ empty = '' - empty.force_encoding text.encoding + empty = RDoc::Encoding.change_encoding empty, text.encoding text.gsub(/^\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\s+$/, empty) end @@ -172,14 +172,14 @@ def strip_stars text text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, '' space = ' ' - space.force_encoding encoding if encoding + space = RDoc::Encoding.change_encoding space, encoding if encoding text.sub! %r%/\*+% do space * $&.length end text.sub! %r%\*+/% do space * $&.length end text.gsub! %r%^[ \t]*\*%m do space * $&.length end empty = '' - empty.force_encoding encoding if encoding + empty = RDoc::Encoding.change_encoding empty, encoding if encoding text.gsub(/^\s+$/, empty) end @@ -188,7 +188,7 @@ def strip_stars text # trademark symbols in +text+ to properly encoded characters. def to_html text - html = ''.encode text.encoding + html = (''.encode text.encoding).dup encoded = RDoc::Text::TO_HTML_CHARACTERS[text.encoding] diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb index 66a5ae7a33..2b594b7d84 100644 --- a/lib/rdoc/tom_doc.rb +++ b/lib/rdoc/tom_doc.rb @@ -222,7 +222,7 @@ def parse_text parent, indent # :nodoc: # Returns self. def tokenize text - text.sub!(/\A(Public|Internal|Deprecated):\s+/, '') + text = text.sub(/\A(Public|Internal|Deprecated):\s+/, '') setup_scanner text diff --git a/test/test_rdoc_code_object.rb b/test/test_rdoc_code_object.rb index bdf6d8ae85..d189ac1c4b 100644 --- a/test/test_rdoc_code_object.rb +++ b/test/test_rdoc_code_object.rb @@ -53,7 +53,7 @@ def test_comment_equals_encoding refute_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check' input = 'text' - input.force_encoding Encoding::UTF_8 + input = RDoc::Encoding.change_encoding input, Encoding::UTF_8 @co.comment = input @@ -65,7 +65,7 @@ def test_comment_equals_encoding_blank refute_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check' input = '' - input.force_encoding Encoding::UTF_8 + input = RDoc::Encoding.change_encoding input, Encoding::UTF_8 @co.comment = input diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb index 9eba298017..567daae51c 100644 --- a/test/test_rdoc_comment.rb +++ b/test/test_rdoc_comment.rb @@ -207,7 +207,7 @@ def test_extract_call_seq_c_separator end def test_force_encoding - @comment.force_encoding Encoding::UTF_8 + @comment = RDoc::Encoding.change_encoding @comment, Encoding::UTF_8 assert_equal Encoding::UTF_8, @comment.text.encoding end @@ -347,7 +347,7 @@ def test_remove_private_encoding # this is private EOS - comment.force_encoding Encoding::IBM437 + comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437 comment.remove_private @@ -471,7 +471,7 @@ def test_remove_private_toggle_encoding # This is text again. EOS - comment.force_encoding Encoding::IBM437 + comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437 comment.remove_private @@ -486,7 +486,7 @@ def test_remove_private_toggle_encoding_ruby_bug? # This is text again. EOS - comment.force_encoding Encoding::IBM437 + comment = RDoc::Encoding.change_encoding comment, Encoding::IBM437 comment.remove_private diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index d9298880d7..9d9ded4bbd 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -37,7 +37,7 @@ def test_class_read_file_encoding def test_class_read_file_encoding_convert content = "" - content.encode! 'ISO-8859-1' + content = RDoc::Encoding.change_encoding content, 'ISO-8859-1' content << "# coding: ISO-8859-1\nhi \xE9verybody" @tempfile.write content @@ -65,7 +65,7 @@ def test_class_read_file_encoding_fail def test_class_read_file_encoding_fancy expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody" - expected.encode! Encoding::UTF_8 + exptected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8 @tempfile.write expected @tempfile.flush @@ -125,7 +125,7 @@ def test_class_read_file_encoding_iso_2022_jp contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 expected = ":\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:" - expected.force_encoding Encoding::UTF_8 + expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8 assert_equal expected, contents assert_equal Encoding::UTF_8, contents.encoding @@ -133,24 +133,24 @@ def test_class_read_file_encoding_iso_2022_jp def test_class_set_encoding s = "# coding: UTF-8\n" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s # sanity check for 1.8 assert_equal Encoding::UTF_8, s.encoding s = "#!/bin/ruby\n# coding: UTF-8\n" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal Encoding::UTF_8, s.encoding s = "\n" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal Encoding::UTF_8, s.encoding s = "\n" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal Encoding::UTF_8, s.encoding end @@ -158,13 +158,13 @@ def test_class_set_encoding def test_class_set_encoding_strip s = "# coding: UTF-8\n# more comments" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal "# more comments", s s = "#!/bin/ruby\n# coding: UTF-8\n# more comments" - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal "#!/bin/ruby\n# more comments", s end @@ -172,29 +172,29 @@ def test_class_set_encoding_strip def test_class_set_encoding_bad s = "" expected = s.encoding - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal expected, s.encoding s = "# vim:set fileencoding=utf-8:\n" expected = s.encoding - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal expected, s.encoding s = "# vim:set fileencoding=utf-8:\n" expected = s.encoding - RDoc::Encoding.set_encoding s + s = RDoc::Encoding.set_encoding s assert_equal expected, s.encoding assert_raises ArgumentError do - RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n" + s = RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n" end end def test_skip_frozen_string_literal - expected = "# frozen_string_literal: false\nhi everybody" + expected = "# frozen_string_literal: true\nhi everybody" @tempfile.write expected @tempfile.flush @@ -216,7 +216,7 @@ def test_skip_frozen_string_literal_after_coding end def test_skip_frozen_string_literal_before_coding - expected = "# frozen_string_literal: false\n# coding: utf-8\nhi everybody" + expected = "# frozen_string_literal: true\n# coding: utf-8\nhi everybody" @tempfile.write expected @tempfile.flush diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 154dfe7c4b..6cb5463d29 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -199,7 +199,7 @@ def test_generate_gzipped def test_generate_utf_8 text = "5\xB0" - text.force_encoding Encoding::ISO_8859_1 + text = RDoc::Encoding.change_encoding text, Encoding::ISO_8859_1 @klass.add_comment comment(text), @top_level @g.generate @@ -215,7 +215,7 @@ def test_generate_utf_8 klass_record = @klass.search_record[2..-1] klass_record[-1] = "

5\xc2\xb0\n" - klass_record.last.force_encoding Encoding::UTF_8 + klass_record[-1] = RDoc::Encoding.change_encoding klass_record[-1], Encoding::UTF_8 info = [ klass_record, diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb index 9389e4cf64..a939623e01 100644 --- a/test/test_rdoc_markup_attribute_manager.rb +++ b/test/test_rdoc_markup_attribute_manager.rb @@ -171,21 +171,21 @@ def test_combined end def test_convert_attrs - str = '+foo+' + str = '+foo+'.dup attrs = RDoc::Markup::AttrSpan.new str.length @am.convert_attrs str, attrs assert_equal "\000foo\000", str - str = '+:foo:+' + str = '+:foo:+'.dup attrs = RDoc::Markup::AttrSpan.new str.length @am.convert_attrs str, attrs assert_equal "\000:foo:\000", str - str = '+x-y+' + str = '+x-y+'.dup attrs = RDoc::Markup::AttrSpan.new str.length @am.convert_attrs str, attrs @@ -299,17 +299,17 @@ def test_mask_protected_sequence def @am.str() @str end def @am.str=(str) @str = str end - @am.str = 'foo' + @am.str = 'foo'.dup @am.mask_protected_sequences assert_equal "foo", @am.str - @am.str = 'foo\\' + @am.str = 'foo\\'.dup @am.mask_protected_sequences assert_equal "foo<\x04/code>", @am.str, 'escaped close' - @am.str = 'foo\\\\' + @am.str = 'foo\\\\'.dup @am.mask_protected_sequences assert_equal "foo\\", @am.str, 'escaped backslash' diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb index 1b0a011e6f..0e7f72fb16 100644 --- a/test/test_rdoc_markup_formatter.rb +++ b/test/test_rdoc_markup_formatter.rb @@ -12,7 +12,7 @@ def initialize markup end def accept_paragraph paragraph - @res << attributes(paragraph.text) + @res += attributes(paragraph.text) end def attributes text diff --git a/test/test_rdoc_markup_pre_process.rb b/test/test_rdoc_markup_pre_process.rb index 13e3ec13c0..3e0e505b0b 100644 --- a/test/test_rdoc_markup_pre_process.rb +++ b/test/test_rdoc_markup_pre_process.rb @@ -86,8 +86,7 @@ def test_handle text = "# :main: M\n" out = @pp.handle text - assert_same out, text - assert_equal "#\n", text + assert_equal "#\n", out end def test_handle_comment @@ -96,8 +95,7 @@ def test_handle_comment out = @pp.handle c - assert_same out, text - assert_equal "#\n", text + assert_equal "#\n", out end def test_handle_markup @@ -129,8 +127,7 @@ def test_handle_post_process out = @pp.handle text, cd - assert_same out, text - assert_equal "# a b c\n", text + assert_equal "# a b c\n", out assert_equal "# a b c\n", cd.metadata[:stuff] end @@ -138,8 +135,7 @@ def test_handle_unregistered text = "# :x: y\n" out = @pp.handle text - assert_same out, text - assert_equal "# :x: y\n", text + assert_equal text, out end def test_handle_directive_blankline diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index fa59de434f..d7ce211999 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -604,7 +604,7 @@ def test_convert_limit_over rdoc = "* text\n" * 2 expected = "

text\n" - expected.chomp! + expected = expected.chomp expected << " #{@ellipsis}\n" actual = @to.convert rdoc diff --git a/test/test_rdoc_parser_changelog.rb b/test/test_rdoc_parser_changelog.rb index 46cbb0d9a3..06c3ff206e 100644 --- a/test/test_rdoc_parser_changelog.rb +++ b/test/test_rdoc_parser_changelog.rb @@ -33,7 +33,7 @@ def test_class_can_parse def test_continue_entry_body parser = util_parser - entry_body = ['a'] + entry_body = ['a'.dup] parser.continue_entry_body entry_body, 'b' @@ -53,7 +53,7 @@ def test_continue_entry_body_empty def test_continue_entry_body_function parser = util_parser - entry_body = ['file: (func1)'] + entry_body = ['file: (func1)'.dup] parser.continue_entry_body entry_body, '(func2): blah' diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 8d638bbc38..9f0e9480d3 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -61,7 +61,7 @@ def test_expand_tabs def test_expand_tabs_encoding inn = "hello\ns\tdave" - inn.force_encoding Encoding::BINARY + inn = RDoc::Encoding.change_encoding inn, Encoding::BINARY out = expand_tabs inn @@ -95,7 +95,7 @@ def test_flush_left_encoding The comments associated with TEXT - text.force_encoding Encoding::US_ASCII + text = RDoc::Encoding.change_encoding text, Encoding::US_ASCII expected = <<-EXPECTED @@ -303,7 +303,7 @@ def test_strip_hashes_encoding # The comments associated with TEXT - text.force_encoding Encoding::CP852 + text = RDoc::Encoding.change_encoding text, Encoding::CP852 expected = <<-EXPECTED @@ -332,7 +332,7 @@ def test_strip_newlines_encoding assert_equal Encoding::UTF_8, ''.encoding, 'Encoding sanity check' text = " \n" - text.force_encoding Encoding::US_ASCII + text = RDoc::Encoding.change_encoding text, Encoding::US_ASCII stripped = strip_newlines text @@ -386,7 +386,7 @@ def test_strip_stars_encoding */ TEXT - text.force_encoding Encoding::CP852 + text = RDoc::Encoding.change_encoding text, Encoding::CP852 expected = <<-EXPECTED @@ -410,7 +410,7 @@ def test_strip_stars_encoding2 */ TEXT - text.force_encoding Encoding::BINARY + text = RDoc::Encoding.change_encoding text, Encoding::BINARY expected = <<-EXPECTED diff --git a/test/test_rdoc_tom_doc.rb b/test/test_rdoc_tom_doc.rb index 6e60e67726..15bbd9b32d 100644 --- a/test/test_rdoc_tom_doc.rb +++ b/test/test_rdoc_tom_doc.rb @@ -131,7 +131,7 @@ def test_parse_paragraph def test_parse_multiline_paragraph text = "Public: Do some stuff\n" - text << "On a new line\n" + text += "On a new line\n" expected = doc( @@ -353,7 +353,7 @@ def test_tokenize_paragraph def test_tokenize_multiline_paragraph text = "Public: Do some stuff\n" - text << "On a new line\n" + text += "On a new line\n" @td.tokenize text From 9815e3773856ece435e63f9a588169898ab70779 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 16 Nov 2017 06:58:29 +0900 Subject: [PATCH 0484/1389] Add frozen_string_literal to files by Racc --- Rakefile | 5 +++++ lib/rdoc/rd/block_parser.ry | 4 ++-- lib/rdoc/rd/inline_parser.ry | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 2dd5d21bd5..4375af0b99 100644 --- a/Rakefile +++ b/Rakefile @@ -63,6 +63,11 @@ parsed_files = PARSER_FILES.map do |parser_file| racc = Gem.bin_path 'racc', 'racc' rb_file = parser_file.gsub(/\.ry\z/, ".rb") ruby "#{racc} -l -o #{rb_file} #{parser_file}" + open(rb_file, 'r+') do |f| + newtext = "# frozen_string_literal: true\n#{f.read}" + f.rewind + f.write newtext + end elsif parser_file =~ /\.kpeg\z/ # need kpeg kpeg = Gem.bin_path 'kpeg', 'kpeg' rb_file = parser_file.gsub(/\.kpeg\z/, ".rb") diff --git a/lib/rdoc/rd/block_parser.ry b/lib/rdoc/rd/block_parser.ry index e9b30a6231..675d437208 100644 --- a/lib/rdoc/rd/block_parser.ry +++ b/lib/rdoc/rd/block_parser.ry @@ -420,7 +420,7 @@ def next_token # :nodoc: if @in_verbatim [:STRINGLINE, line] else - @indent_stack.push("\s" << newIndent) + @indent_stack.push("\s" + newIndent) [:ITEMLISTLINE, rest] end end @@ -432,7 +432,7 @@ def next_token # :nodoc: if @in_verbatim [:STRINGLINE, line] else - @indent_stack.push("\s" * mark.size << newIndent) + @indent_stack.push("\s" * mark.size + newIndent) [:ENUMLISTLINE, rest] end end diff --git a/lib/rdoc/rd/inline_parser.ry b/lib/rdoc/rd/inline_parser.ry index 4e9721816f..c7345013bf 100644 --- a/lib/rdoc/rd/inline_parser.ry +++ b/lib/rdoc/rd/inline_parser.ry @@ -436,7 +436,7 @@ end def parse inline @inline = inline @src = StringScanner.new inline - @pre = "" + @pre = "".dup @yydebug = true do_parse.to_s end From 8ffc114b5eb6ee37e7b5fc93558e1f22bbb462b2 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 16 Nov 2017 07:54:30 +0900 Subject: [PATCH 0485/1389] Add frozen_string_literal to files by KPeg --- lib/rdoc/markdown.kpeg | 1 + lib/rdoc/markdown/literals.kpeg | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/rdoc/markdown.kpeg b/lib/rdoc/markdown.kpeg index 4148b06c3e..a81e92fef5 100644 --- a/lib/rdoc/markdown.kpeg +++ b/lib/rdoc/markdown.kpeg @@ -2,6 +2,7 @@ %% header { # coding: UTF-8 +# frozen_string_literal: true # :markup: markdown ## diff --git a/lib/rdoc/markdown/literals.kpeg b/lib/rdoc/markdown/literals.kpeg index 1f807dcf83..952263b4ae 100644 --- a/lib/rdoc/markdown/literals.kpeg +++ b/lib/rdoc/markdown/literals.kpeg @@ -2,6 +2,7 @@ %% header { # coding: UTF-8 +# frozen_string_literal: true # :markup: markdown ## From a78d1a96881dcf9c5fab94b1cfe07deb724c4105 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 12 Nov 2017 05:48:05 +0900 Subject: [PATCH 0486/1389] Fix dry-run --- lib/rdoc/generator/json_index.rb | 2 +- lib/rdoc/rdoc.rb | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb index ea9384e6d3..c63a0e591c 100644 --- a/lib/rdoc/generator/json_index.rb +++ b/lib/rdoc/generator/json_index.rb @@ -161,7 +161,7 @@ def generate # Compress the search_index.js file using gzip def generate_gzipped - return unless defined?(Zlib) + return if @options.dry_run or not defined?(Zlib) debug_msg "Compressing generated JSON index" out_dir = @base_dir + @options.op_dir diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index adcb65b13b..e0e28ddf97 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -521,13 +521,18 @@ def document options # by the RDoc options def generate - Dir.chdir @options.op_dir do - unless @options.quiet then - $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..." - end - + if @options.dry_run then + # do nothing @generator.generate - update_output_dir '.', @start_time, @last_modified + else + Dir.chdir @options.op_dir do + unless @options.quiet then + $stderr.puts "\nGenerating #{@generator.class.name.sub(/^.*::/, '')} format into #{Dir.pwd}..." + end + + @generator.generate + update_output_dir '.', @start_time, @last_modified + end end end From 0cbb8eb3408034f84c33742ea7d80acd7307faf0 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 12 Nov 2017 06:06:26 +0900 Subject: [PATCH 0487/1389] Add test_document_with_dry_run --- test/test_rdoc_rdoc.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index be7a90c236..83ded0bd72 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -40,6 +40,24 @@ def test_document # functional test assert_equal 'title', store.title end + def test_document_with_dry_run # functional test + options = RDoc::Options.new + options.files = [File.expand_path('../xref_data.rb', __FILE__)] + options.setup_generator 'darkfish' + options.main_page = 'MAIN_PAGE.rdoc' + options.root = Pathname File.expand_path('..', __FILE__) + options.title = 'title' + options.dry_run = true + + rdoc = RDoc::RDoc.new + + temp_dir do + capture_io do + rdoc.document options + end + end + end + def test_gather_files a = File.expand_path __FILE__ b = File.expand_path '../test_rdoc_text.rb', __FILE__ From 8bb90fe43643f8ec412a490efa3ebdef712fa7af Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 21 Nov 2017 20:24:17 +0900 Subject: [PATCH 0488/1389] Add assertions to test_document_with_dry_run --- test/test_rdoc_rdoc.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 83ded0bd72..d5ce1639e4 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -51,11 +51,21 @@ def test_document_with_dry_run # functional test rdoc = RDoc::RDoc.new + out = nil temp_dir do - capture_io do + out, = capture_io do rdoc.document options end + + refute File.directory? 'doc' + assert_equal rdoc, rdoc.store.rdoc end + assert_includes out, '100%' + + store = rdoc.store + + assert_equal 'MAIN_PAGE.rdoc', store.main + assert_equal 'title', store.title end def test_gather_files From 2cda99c568d0d3a114cce457c489492a23b81ad1 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 27 Nov 2017 19:17:06 +0900 Subject: [PATCH 0489/1389] bump version to 6.0.0.beta4 --- lib/rdoc.rb | 2 +- rdoc.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index ee448e661d..35f87c4932 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.0.beta3' + VERSION = '6.0.0.beta4' ## # Method visibilities diff --git a/rdoc.gemspec b/rdoc.gemspec index 17d01e1746..1ccfddfc7a 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -8,7 +8,7 @@ end Gem::Specification.new do |s| s.name = "rdoc" s.version = RDoc::VERSION - s.date = "2017-10-10" + s.date = "2017-11-27" s.authors = [ "Eric Hodel", From ba2e6ad933a287a216de1e543bd2b791a294c30c Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 5 Dec 2017 19:54:16 +0900 Subject: [PATCH 0490/1389] bump version to 6.0.0 --- lib/rdoc.rb | 2 +- rdoc.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 35f87c4932..fcdf9be4b1 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.0.beta4' + VERSION = '6.0.0' ## # Method visibilities diff --git a/rdoc.gemspec b/rdoc.gemspec index 1ccfddfc7a..57a66984fd 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -8,7 +8,7 @@ end Gem::Specification.new do |s| s.name = "rdoc" s.version = RDoc::VERSION - s.date = "2017-11-27" + s.date = "2017-12-05" s.authors = [ "Eric Hodel", From 3242f0ae431ca11e57ff8785b4cdd1b461b614da Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 8 Dec 2017 12:04:35 +0900 Subject: [PATCH 0491/1389] Use JRuby 9.1.15.0 on .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b40c3b0d1e..6aa7f2f517 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ rvm: - 2.3.5 - 2.4.2 - ruby-head - - jruby-9.1.14.0 + - jruby-9.1.15.0 env: global: NOBENCHMARK=1 From 2df261bb8a9336438508bba94e22e0f968f88983 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Thu, 14 Dec 2017 10:54:54 +0100 Subject: [PATCH 0492/1389] Do not store current timestamps in gz headers to enable reproducible builds of rdoc Normally, 0 would be the preferred value to indicate "no date" but that value is handled differently in Zlib::GzipWriter to put in the current time --- lib/rdoc/generator/json_index.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb index e4cfe967c6..a059a5d4d0 100644 --- a/lib/rdoc/generator/json_index.rb +++ b/lib/rdoc/generator/json_index.rb @@ -175,7 +175,7 @@ def generate_gzipped debug_msg "Writing gzipped search index to %s" % outfile Zlib::GzipWriter.open(outfile) do |gz| - gz.mtime = File.mtime(search_index_file) + gz.mtime = 1 # make output reproducible gz.orig_name = search_index_file.basename.to_s gz.write search_index gz.close @@ -193,7 +193,7 @@ def generate_gzipped debug_msg "Writing gzipped file to %s" % outfile Zlib::GzipWriter.open(outfile) do |gz| - gz.mtime = File.mtime(dest) + gz.mtime = 1 # make output reproducible gz.orig_name = dest.basename.to_s gz.write data gz.close From 524a8ffc7efbc10b09234f7ac3f81d30a3f9f65c Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" Date: Sun, 30 Apr 2017 22:47:40 +0200 Subject: [PATCH 0493/1389] created.rid: use SOURCE_DATE_EPOCH use SOURCE_DATE_EPOCH instead of current time in created.rid top line to enable reproducible builds of ruby docs See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable. --- lib/rdoc/rdoc.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 68775c8be1..a2711fbbd1 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -232,6 +232,9 @@ def store= store def update_output_dir(op_dir, time, last = {}) return if @options.dry_run or not @options.update_output_dir + unless ENV['SOURCE_DATE_EPOCH'].nil? + time = Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime + end open output_flag_file(op_dir), "w" do |f| f.puts time.rfc2822 From 1ccd1d58b6ef03b79f7f0fe299ed13f88fa617dd Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 23 Dec 2017 21:47:51 +0900 Subject: [PATCH 0494/1389] Bypass ERB's Ruby syntax error The legacy lexical analyzer and parser of RDoc 5 process ERB file with no errors because of complex bug. RDoc 6 what uses Ripper causes errors when processes ERB file. It was just bug fix but RDoc lost compatibility. For example, when installs ActiveRecord 5.1.4 by "gem install activerecord -v 5.1.4", it uses RDoc internal, so the RDoc crashes if it's RDoc 6.0.0. This commit provides compatibility behavior with RDoc 5 or older. When an exception occurs inside Ruby parser, confirms that the source code contains "<%" and "%>" to detect ERB file. Skips it if RDoc guesses that the file is ERB by the logic. --- lib/rdoc/parser/ruby.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index f1856acce8..8599f655ad 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -178,6 +178,7 @@ def initialize(top_level, file_name, content, options, stats) @size = 0 @token_listeners = nil @scanner = RDoc::RipperStateLex.parse(content) + @content = content @scanner_point = 0 @prev_seek = nil @markup = @options.markup @@ -2067,6 +2068,12 @@ def scan parse_top_level_statements @top_level rescue StandardError => e + if @content.include?('<%') and @content.include?('%>') then + # Maybe, this is ERB. + $stderr.puts "\033[2KRDoc detects ERB file. Skips it for compatibility:" + $stderr.puts @file_name + return + end bytes = '' if @scanner_point >= @scanner.size From 40d081b390ef73c88e99b2a8b79b51fda98d1496 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Sun, 24 Dec 2017 08:16:48 +0900 Subject: [PATCH 0495/1389] Bump version to 6.0.1 --- lib/rdoc.rb | 2 +- rdoc.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index fcdf9be4b1..fef3726b33 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.0' + VERSION = '6.0.1' ## # Method visibilities diff --git a/rdoc.gemspec b/rdoc.gemspec index 57a66984fd..8c92908a66 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -8,7 +8,7 @@ end Gem::Specification.new do |s| s.name = "rdoc" s.version = RDoc::VERSION - s.date = "2017-12-05" + s.date = "2017-12-24" s.authors = [ "Eric Hodel", From 55b2b9a343ecab6515122980f2c9442bc71415b8 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 22 Dec 2017 05:15:45 +0000 Subject: [PATCH 0496/1389] fix a test for debugging. * test/rdoc/test_rdoc_markup_pre_process.rb: show `RDoc::Markup::PreProcess.post_processors` as a failure message for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_rdoc_markup_pre_process.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_markup_pre_process.rb b/test/test_rdoc_markup_pre_process.rb index 3e0e505b0b..887ff6de9c 100644 --- a/test/test_rdoc_markup_pre_process.rb +++ b/test/test_rdoc_markup_pre_process.rb @@ -29,7 +29,8 @@ def test_class_register def test_class_post_process RDoc::Markup::PreProcess.post_process do end - assert_equal 1, RDoc::Markup::PreProcess.post_processors.length + assert_equal 1, RDoc::Markup::PreProcess.post_processors.length, + proc{RDoc::Markup::PreProcess.post_processors.inspect} end def test_include_file From c19b2b7457e4ae35e9556ca24571a08980efc171 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Sun, 24 Dec 2017 09:26:36 +0900 Subject: [PATCH 0497/1389] Removed needless json dependency. --- rdoc.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 8c92908a66..9b4a1f2f0f 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -59,5 +59,4 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.add_development_dependency("racc", "> 1.4.10") s.add_development_dependency("kpeg") s.add_development_dependency("minitest", "~> 4") - s.add_development_dependency("json") end From 0ad0d24de5a320cde2eca7260803be1df1e94b44 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 23 Dec 2017 15:25:32 +0900 Subject: [PATCH 0498/1389] Fix showing syntax error line --- lib/rdoc/parser/ruby.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8599f655ad..51fd2d4e3a 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -2074,13 +2074,16 @@ def scan $stderr.puts @file_name return end - bytes = '' if @scanner_point >= @scanner.size now_line_no = @scanner[@scanner.size - 1][:line_no] else now_line_no = peek_tk[:line_no] end + first_tk_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no } + last_tk_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no + 1 } + last_tk_index = last_tk_index ? last_tk_index - 1 : @scanner.size - 1 + code = @scanner[first_tk_index..last_tk_index].map{ |t| t[:text] }.join $stderr.puts <<-EOF @@ -2089,12 +2092,9 @@ def scan EOF - unless bytes.empty? then + unless code.empty? then + $stderr.puts code $stderr.puts - now_line_no = peek_tk[:line_no] - start_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no } - end_index = @scanner.find_index { |tk| tk[:line_no] == now_line_no + 1 } - 1 - $stderr.puts @scanner[start_index..end_index].join end raise e From 1378dc3f204f279cec9b7d56d8dcd498630be145 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 25 Dec 2017 22:01:52 +0900 Subject: [PATCH 0499/1389] Fix typo of test/test_rdoc_encoding.rb --- test/test_rdoc_encoding.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index 9d9ded4bbd..9dc20990a0 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -65,7 +65,7 @@ def test_class_read_file_encoding_fail def test_class_read_file_encoding_fancy expected = "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody" - exptected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8 + expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8 @tempfile.write expected @tempfile.flush From e083c53e690fe515be901f7f68b6425e6a7b4de5 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 26 Dec 2017 18:33:14 +0900 Subject: [PATCH 0500/1389] Use 2.5.0 and more latest Ruby versions --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6aa7f2f517..36616c272a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,10 @@ before_install: - gem install bundler --no-document language: ruby rvm: - - 2.2.8 - - 2.3.5 - - 2.4.2 + - 2.2.9 + - 2.3.6 + - 2.4.3 + - 2.5.0 - ruby-head - jruby-9.1.15.0 env: From ac8875abbcaaed6cab3070083a77dee1de0ca779 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 29 Dec 2017 05:42:35 +0900 Subject: [PATCH 0501/1389] Treat '::' token as EXPR_DOT If on_op takes '::' with EXPR_ARG or EXPR_CMDARG, it should be EXPR_DOT. --- lib/rdoc/parser/ripper_state_lex.rb | 15 ++++++++++++-- test/test_rdoc_parser_ruby.rb | 31 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index b7cec84bfc..2a285b97a4 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -83,6 +83,15 @@ def on_op(tok, data) when '&&', '||', '+=', '-=', '*=', '**=', '&=', '|=', '^=', '<<=', '>>=', '||=', '&&=' @lex_state = EXPR_BEG + when '::' + case @lex_state + when EXPR_ARG, EXPR_CMDARG + @lex_state = EXPR_DOT + when EXPR_FNAME, EXPR_DOT + @lex_state = EXPR_ARG + else + @lex_state = EXPR_BEG + end else case @lex_state when EXPR_FNAME, EXPR_DOT @@ -109,8 +118,10 @@ def on_kw(tok, data) else @lex_state = EXPR_BEG end - when 'begin' + when 'begin', 'case', 'when' @lex_state = EXPR_BEG + when 'return', 'break' + @lex_state = EXPR_MID else if @lex_state == EXPR_FNAME @lex_state = EXPR_END @@ -245,7 +256,7 @@ def on_const(tok, data) case @lex_state when EXPR_FNAME @lex_state = EXPR_ENDFN - when EXPR_CLASS + when EXPR_CLASS, EXPR_CMDARG, EXPR_MID @lex_state = EXPR_ARG else @lex_state = EXPR_CMDARG diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index e28112fbee..833ed2cc74 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -306,6 +306,37 @@ def sum(n) assert_equal @top_level, sum.file end + def test_parse_redefined_op_with_constant + klass = RDoc::NormalClass.new 'Foo' + klass.parent = @top_level + + comment = RDoc::Comment.new '', @top_level + + util_parser < Date: Sun, 31 Dec 2017 00:06:34 +0000 Subject: [PATCH 0502/1389] fix reset order. * lib/rdoc/test_case.rb (setup): call `RDoc::Markup::PreProcess.reset` at the end of `setup` method. `RDoc::RDoc.new` requires `rdoc/generator/darkfish` and requires `rdoc/tom_doc.rb` at last. It add post_proecssor (at `add_post_processor`) and it fails `TestRDocMarkupPreProcess#test_class_post_process`. This issue occured only with sorted tests by alphabetical order. `make test-all TESTS='rdoc/test_rdoc_markup_pre_process.rb --test-order=alpha`) We can observe this failure with parallel test only a few times. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/test_case.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb index 22d3f14219..5f38870324 100644 --- a/lib/rdoc/test_case.rb +++ b/lib/rdoc/test_case.rb @@ -41,8 +41,6 @@ def setup @RM = RDoc::Markup - RDoc::Markup::PreProcess.reset - @pwd = Dir.pwd @store = RDoc::Store.new @@ -55,6 +53,8 @@ def setup def g.class_dir() end def g.file_dir() end @rdoc.generator = g + + RDoc::Markup::PreProcess.reset end ## From 0ce5887aeeb7be04804477e54f0b7bb1af392ee1 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 1 Jan 2018 12:45:41 +0900 Subject: [PATCH 0503/1389] Fix Bundler on Travis CI with workaround ref. https://github.com/travis-ci/travis-ci/issues/8978#issuecomment-354036443 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 36616c272a..ca9c224e6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ --- before_install: - - gem install bundler --no-document + - gem update --system + - gem update bunlder language: ruby rvm: - 2.2.9 From 9f945eb1afcb1be7667441e21414e18e14d826f8 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 1 Jan 2018 11:22:40 +0900 Subject: [PATCH 0504/1389] Fix --width option of ri This closes #450. --- lib/rdoc/ri/driver.rb | 5 ++++- test/test_rdoc_ri_driver.rb | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index fa0e040a42..02f38143eb 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -425,6 +425,7 @@ def initialize initial_options = {} @server = options[:server] @use_stdout = options[:use_stdout] @show_all = options[:show_all] + @width = options[:width] # pager process for jruby @jruby_pager_process = nil @@ -795,7 +796,9 @@ def complete_method name, klass, selector, completions # :nodoc: def display document page do |io| - text = document.accept formatter(io) + f = formatter(io) + f.width = @width if @width and f.respond_to?(:width) + text = document.accept f io.write text end diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 687d0968df..758c867b08 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -348,6 +348,22 @@ def test_add_method_list assert_equal expected, out end + def test_output_width + @options[:width] = 10 + driver = RDoc::RI::Driver.new @options + + doc = @RM::Document.new + doc << @RM::IndentedParagraph.new(0, 'new, parse, foo, bar, baz') + + out, = capture_io do + driver.display doc + end + + expected = "new, parse, foo,\nbar, baz\n" + + assert_equal expected, out + end + def test_add_method_list_interative @options[:interactive] = true driver = RDoc::RI::Driver.new @options From af7aa4c1308a47580bb1faa0198fee9d7c731de9 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 1 Jan 2018 12:29:15 +0900 Subject: [PATCH 0505/1389] Fix method name characters RDoc::Text#strip_stars removes unnecessary Document-method directive. But the regexp uses only [\w:.#=!?], so it fails with some operator methods. This commit adds other operator characters to the regexp. This closes #452. --- lib/rdoc/text.rb | 2 +- test/test_rdoc_text.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 7e714be0ad..def80d98a3 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -169,7 +169,7 @@ def strip_stars text encoding = text.encoding - text = text.gsub %r%Document-method:\s+[\w:.#=!?]+%, '' + text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+-/*\%@`\[\]]+%, '' space = ' ' space = RDoc::Encoding.change_encoding space, encoding if encoding diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 9f0e9480d3..8b137c701f 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -377,6 +377,32 @@ def test_strip_stars_document_method assert_equal expected, strip_stars(text) end + def test_strip_stars_document_method_special + text = <<-TEXT +/* + * Document-method: Zlib::GzipFile#mtime= + * Document-method: [] + * Document-method: ` + * Document-method: | + * Document-method: & + * Document-method: <=> + * Document-method: =~ + * Document-method: + + * Document-method: - + * Document-method: +@ + * + * A comment + */ + TEXT + + expected = <<-EXPECTED + + A comment + EXPECTED + + assert_equal expected, strip_stars(text) + end + def test_strip_stars_encoding text = <<-TEXT /* From 1221715059bc1edbab80b5ec8c82303125b84945 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 5 Jan 2018 15:55:45 +0900 Subject: [PATCH 0506/1389] Fix typo --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ca9c224e6a..f359e5a2c5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ --- before_install: - gem update --system - - gem update bunlder + - gem update bundler language: ruby rvm: - 2.2.9 From 4a8c6ba6c4bd65a96949b994f4e10f2ac3342262 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 5 Jan 2018 16:10:12 +0900 Subject: [PATCH 0507/1389] Use `File.open` instead of `Kernel#open`. We should use safety method. --- lib/rdoc/encoding.rb | 2 +- lib/rdoc/erbio.rb | 2 +- lib/rdoc/options.rb | 2 +- lib/rdoc/parser.rb | 2 +- lib/rdoc/rdoc.rb | 4 ++-- lib/rdoc/ri/driver.rb | 2 +- lib/rdoc/store.rb | 16 ++++++++-------- test/test_rdoc_parser.rb | 18 +++++++++--------- test/test_rdoc_rdoc.rb | 18 +++++++++--------- test/test_rdoc_ri_paths.rb | 2 +- test/test_rdoc_servlet.rb | 2 +- test/test_rdoc_store.rb | 12 ++++++------ 12 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index 54ecd89816..c277efbafa 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -18,7 +18,7 @@ module RDoc::Encoding # unknown character in the target encoding will be replaced with '?' def self.read_file filename, encoding, force_transcode = false - content = open filename, "rb" do |f| f.read end + content = File.open filename, "rb" do |f| f.read end content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/ utf8 = content.sub!(/\A\xef\xbb\xbf/, '') diff --git a/lib/rdoc/erbio.rb b/lib/rdoc/erbio.rb index 42ce895fb3..29a9db510d 100644 --- a/lib/rdoc/erbio.rb +++ b/lib/rdoc/erbio.rb @@ -9,7 +9,7 @@ # # erbio = RDoc::ERBIO.new '<%= "hello world" %>', nil, nil # -# open 'hello.txt', 'w' do |io| +# File.open 'hello.txt', 'w' do |io| # erbio.result binding # end # diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 17bbca81fe..99d7aaaec1 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -1217,7 +1217,7 @@ def warn message def write_options RDoc.load_yaml - open '.rdoc_options', 'w' do |io| + File.open '.rdoc_options', 'w' do |io| io.set_encoding Encoding::UTF_8 YAML.dump self, io diff --git a/lib/rdoc/parser.rb b/lib/rdoc/parser.rb index 2b826d9284..597bcd6b9d 100644 --- a/lib/rdoc/parser.rb +++ b/lib/rdoc/parser.rb @@ -139,7 +139,7 @@ def self.can_parse_by_name file_name # Returns the file type from the modeline in +file_name+ def self.check_modeline file_name - line = open file_name do |io| + line = File.open file_name do |io| io.gets end diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 68775c8be1..7dda66d10f 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -188,7 +188,7 @@ def setup_output_dir(dir, force) error "#{dir} exists and is not a directory" unless File.directory? dir begin - open flag_file do |io| + File.open flag_file do |io| unless force then Time.parse io.gets @@ -233,7 +233,7 @@ def store= store def update_output_dir(op_dir, time, last = {}) return if @options.dry_run or not @options.update_output_dir - open output_flag_file(op_dir), "w" do |f| + File.open output_flag_file(op_dir), "w" do |f| f.puts time.rfc2822 last.each do |n, t| f.puts "#{n}\t#{t.rfc2822}" diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index fa0e040a42..6b44384545 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -110,7 +110,7 @@ def self.default_options def self.dump data_path require 'pp' - open data_path, 'rb' do |io| + File.open data_path, 'rb' do |io| pp Marshal.load(io.read) end end diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index 999aa76f92..c4bc554ad2 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -539,7 +539,7 @@ def load_all def load_cache #orig_enc = @encoding - open cache_path, 'rb' do |io| + File.open cache_path, 'rb' do |io| @cache = Marshal.load io.read end @@ -596,7 +596,7 @@ def load_class klass_name def load_class_data klass_name file = class_file klass_name - open file, 'rb' do |io| + File.open file, 'rb' do |io| Marshal.load io.read end rescue Errno::ENOENT => e @@ -611,7 +611,7 @@ def load_class_data klass_name def load_method klass_name, method_name file = method_file klass_name, method_name - open file, 'rb' do |io| + File.open file, 'rb' do |io| obj = Marshal.load io.read obj.store = self obj.parent = @@ -631,7 +631,7 @@ def load_method klass_name, method_name def load_page page_name file = page_file page_name - open file, 'rb' do |io| + File.open file, 'rb' do |io| obj = Marshal.load io.read obj.store = self obj @@ -778,7 +778,7 @@ def save_cache marshal = Marshal.dump @cache - open cache_path, 'wb' do |io| + File.open cache_path, 'wb' do |io| io.write marshal end end @@ -854,7 +854,7 @@ def save_class klass marshal = Marshal.dump klass - open path, 'wb' do |io| + File.open path, 'wb' do |io| io.write marshal end end @@ -879,7 +879,7 @@ def save_method klass, method marshal = Marshal.dump method - open method_file(full_name, method.full_name), 'wb' do |io| + File.open method_file(full_name, method.full_name), 'wb' do |io| io.write marshal end end @@ -901,7 +901,7 @@ def save_page page marshal = Marshal.dump page - open path, 'wb' do |io| + File.open path, 'wb' do |io| io.write marshal end end diff --git a/test/test_rdoc_parser.rb b/test/test_rdoc_parser.rb index 5d4da7e425..2cd03942fa 100644 --- a/test/test_rdoc_parser.rb +++ b/test/test_rdoc_parser.rb @@ -19,7 +19,7 @@ def setup def test_class_binary_eh_ISO_2022_JP iso_2022_jp = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.rd" - open iso_2022_jp, 'wb' do |io| + File.open iso_2022_jp, 'wb' do |io| io.write "# coding: ISO-2022-JP\n" io.write ":\e$B%3%^%s%I\e(B:\n" end @@ -31,7 +31,7 @@ def test_class_binary_eh_ISO_2022_JP def test_class_binary_eh_marshal marshal = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.marshal" - open marshal, 'wb' do |io| + File.open marshal, 'wb' do |io| io.write Marshal.dump('') io.write 'lots of text ' * 500 end @@ -92,7 +92,7 @@ def test_class_can_parse def test_class_for_executable temp_dir do content = "#!/usr/bin/env ruby -w\n" - open 'app', 'w' do |io| io.write content end + File.open 'app', 'w' do |io| io.write content end app = @store.add_file 'app' parser = @RP.for app, 'app', content, @options, :stats @@ -126,7 +126,7 @@ def test_class_for_modeline temp_dir do content = "# -*- rdoc -*-\n= NEWS\n" - open 'NEWS', 'w' do |io| io.write content end + File.open 'NEWS', 'w' do |io| io.write content end app = @store.add_file 'NEWS' parser = @RP.for app, 'NEWS', content, @options, :stats @@ -140,7 +140,7 @@ def test_class_for_modeline def test_can_parse_modeline readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}" - open readme_ext, 'w' do |io| + File.open readme_ext, 'w' do |io| io.puts "# README.EXT - -*- rdoc -*- created at: Mon Aug 7 16:45:54 JST 1995" io.puts io.puts "This document explains how to make extension libraries for Ruby." @@ -162,7 +162,7 @@ def test_class_can_parse_zip def test_check_modeline readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}" - open readme_ext, 'w' do |io| + File.open readme_ext, 'w' do |io| io.puts "# README.EXT - -*- RDoc -*- created at: Mon Aug 7 16:45:54 JST 1995" io.puts io.puts "This document explains how to make extension libraries for Ruby." @@ -176,7 +176,7 @@ def test_check_modeline def test_check_modeline_coding readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}" - open readme_ext, 'w' do |io| + File.open readme_ext, 'w' do |io| io.puts "# -*- coding: utf-8 -*-" end @@ -188,7 +188,7 @@ def test_check_modeline_coding def test_check_modeline_with_other readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}" - open readme_ext, 'w' do |io| + File.open readme_ext, 'w' do |io| io.puts "# README.EXT - -*- mode: RDoc; indent-tabs-mode: nil -*-" io.puts io.puts "This document explains how to make extension libraries for Ruby." @@ -202,7 +202,7 @@ def test_check_modeline_with_other def test_check_modeline_no_modeline readme_ext = File.join Dir.tmpdir, "README.EXT.#{$$}" - open readme_ext, 'w' do |io| + File.open readme_ext, 'w' do |io| io.puts "This document explains how to make extension libraries for Ruby." end diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 3244238e3c..31bf4480ce 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -115,7 +115,7 @@ def test_load_options def test_load_options_invalid temp_dir do - open '.rdoc_options', 'w' do |io| + File.open '.rdoc_options', 'w' do |io| io.write "a: !ruby.yaml.org,2002:str |\nfoo" end @@ -187,7 +187,7 @@ def test_parse_file temp_dir do |dir| @rdoc.options.root = Pathname(Dir.pwd) - open 'test.txt', 'w' do |io| + File.open 'test.txt', 'w' do |io| io.puts 'hi' end @@ -223,7 +223,7 @@ def test_parse_file_include_root temp_dir do |dir| @rdoc.options.parse %W[--root #{test_path}] - open 'include.txt', 'w' do |io| + File.open 'include.txt', 'w' do |io| io.puts ':include: test.txt' end @@ -244,7 +244,7 @@ def test_parse_file_page_dir @rdoc.options.page_dir = Pathname('pages') @rdoc.options.root = Pathname(Dir.pwd) - open 'pages/test.txt', 'w' do |io| + File.open 'pages/test.txt', 'w' do |io| io.puts 'hi' end @@ -263,7 +263,7 @@ def test_parse_file_relative temp_dir do |dir| @rdoc.options.root = Pathname(dir) - open 'test.txt', 'w' do |io| + File.open 'test.txt', 'w' do |io| io.puts 'hi' end @@ -339,7 +339,7 @@ def test_remove_unparseable def test_remove_unparseable_tags_emacs temp_dir do - open 'TAGS', 'wb' do |io| # emacs + File.open 'TAGS', 'wb' do |io| # emacs io.write "\f\nlib/foo.rb,43\n" end @@ -353,7 +353,7 @@ def test_remove_unparseable_tags_emacs def test_remove_unparseable_tags_vim temp_dir do - open 'TAGS', 'w' do |io| # emacs + File.open 'TAGS', 'w' do |io| # emacs io.write "!_TAG_" end @@ -392,7 +392,7 @@ def test_setup_output_dir_dry_run def test_setup_output_dir_exists Dir.mktmpdir {|path| - open @rdoc.output_flag_file(path), 'w' do |io| + File.open @rdoc.output_flag_file(path), 'w' do |io| io.puts Time.at 0 io.puts "./lib/rdoc.rb\t#{Time.at 86400}" end @@ -406,7 +406,7 @@ def test_setup_output_dir_exists def test_setup_output_dir_exists_empty_created_rid Dir.mktmpdir {|path| - open @rdoc.output_flag_file(path), 'w' do end + File.open @rdoc.output_flag_file(path), 'w' do end e = assert_raises RDoc::Error do @rdoc.setup_output_dir path, false diff --git a/test/test_rdoc_ri_paths.rb b/test/test_rdoc_ri_paths.rb index b0f368353a..0e00fd4a98 100644 --- a/test/test_rdoc_ri_paths.rb +++ b/test/test_rdoc_ri_paths.rb @@ -22,7 +22,7 @@ def setup specs.each do |spec| spec.loaded_from = spec.spec_file - open spec.spec_file, 'w' do |file| + File.open spec.spec_file, 'w' do |file| file.write spec.to_ruby_for_cache end diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 4dd1f08ddd..414f3e9301 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -69,7 +69,7 @@ def test_asset FileUtils.mkdir 'css' now = Time.now - open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end + File.open 'css/rdoc.css', 'w' do |io| io.write 'h1 { color: red }' end File.utime now, now, 'css/rdoc.css' @s.asset_dirs[:darkfish] = '.' diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index 4a4cf3ac0f..0e5bcf6553 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -407,7 +407,7 @@ def test_load_cache Dir.mkdir @tmpdir - open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| + File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| Marshal.dump cache, io end @@ -441,7 +441,7 @@ def test_load_cache_encoding_differs Dir.mkdir @tmpdir - open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| + File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| Marshal.dump cache, io end @@ -490,7 +490,7 @@ def test_load_cache_legacy Dir.mkdir @tmpdir - open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| + File.open File.join(@tmpdir, 'cache.ri'), 'wb' do |io| Marshal.dump cache, io end @@ -538,7 +538,7 @@ def test_load_method_legacy file = @s.method_file @klass.full_name, @meth.full_name - open file, 'wb' do |io| + File.open file, 'wb' do |io| io.write "\x04\bU:\x14RDoc::AnyMethod[\x0Fi\x00I" + "\"\vmethod\x06:\x06EF\"\x11Klass#method0:\vpublic" + "o:\eRDoc::Markup::Document\x06:\v@parts[\x06" + @@ -633,7 +633,7 @@ def test_save expected[:ancestors]['Object'] = %w[BasicObject] - open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| + File.open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| cache = Marshal.load io.read assert_equal expected, cache @@ -701,7 +701,7 @@ def test_save_cache expected[:ancestors]['Object'] = %w[BasicObject] - open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| + File.open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| cache = Marshal.load io.read assert_equal expected, cache From 819461271cf1287096b98834ec8d09da2c872a84 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 5 Jan 2018 23:58:45 +0900 Subject: [PATCH 0508/1389] Add test_update_output_dir_with_reproducible_time --- test/test_rdoc_rdoc.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 31bf4480ce..b73780c498 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -467,6 +467,25 @@ def test_update_output_dir_dry_run end end + def test_update_output_dir_with_reproducible_time + Dir.mktmpdir do |d| + backup_epoch = ENV['SOURCE_DATE_EPOCH'] + ruby_birthday = Time.parse 'Wed, 24 Feb 1993 21:00:00 +0900' + ENV['SOURCE_DATE_EPOCH'] = ruby_birthday.to_i.to_s + + @rdoc.update_output_dir d, Time.now, {} + + assert File.exist? "#{d}/created.rid" + + f = File.open("#{d}/created.rid", 'r') + head_timestamp = Time.parse f.gets.chomp + f.close + assert_equal ruby_birthday, head_timestamp + + ENV['SOURCE_DATE_EPOCH'] = backup_epoch + end + end + def test_normalized_file_list_removes_created_rid_dir temp_dir do |d| FileUtils.mkdir "doc" From 88e5c4a5829f1ae7a04ef8a6124f6d6b3705b657 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 6 Jan 2018 01:32:57 +0900 Subject: [PATCH 0509/1389] Fix separated tests This commit fixes commands below: ruby -Ilib:test test/test_rdoc_generator_darkfish.rb ruby -Ilib:test test/test_rdoc_text.rb --- test/test_rdoc_generator_darkfish.rb | 2 +- test/test_rdoc_text.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb index c004bb271e..3eeb5bf542 100644 --- a/test/test_rdoc_generator_darkfish.rb +++ b/test/test_rdoc_generator_darkfish.rb @@ -135,7 +135,7 @@ def test_generate_static_dry_run end def test_install_rdoc_static_file - src = Pathname(__FILE__) + src = Pathname File.expand_path(__FILE__, @pwd) dst = File.join @tmpdir, File.basename(src) options = {} diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 9f0e9480d3..74214e6c86 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require 'rdoc/test_case' +require 'timeout' class TestRDocText < RDoc::TestCase From 6ba77897abf78a41ecebdde5b0d1e70232e3b819 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 5 Jan 2018 16:36:10 +0900 Subject: [PATCH 0510/1389] Add test_parse_syntax_error_code --- test/test_rdoc_parser_ruby.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index e28112fbee..c1852ce080 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -813,6 +813,31 @@ def test_parse_class_lower_name_warning assert_match(/Expected class name or '<<'\. Got/, err) end + def test_parse_syntax_error_code + @options.verbosity = 2 + stds = capture_io do + begin + util_parser < Date: Mon, 1 Jan 2018 12:15:38 +0900 Subject: [PATCH 0511/1389] Fix method line number RDoc::Encoding.read_file removes magic comments, after that, Ruby parser processes the content. So method line number is reduced by the amount of the magic comment lines. This commit fixes it by that changes the behavior of RDoc::Encoding.read_file to not remove magic comments. This closes #425. --- lib/rdoc/encoding.rb | 43 ++++++++---------- test/test_rdoc_encoding.rb | 92 +++++++++----------------------------- 2 files changed, 40 insertions(+), 95 deletions(-) diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index 54ecd89816..b00eaec539 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -23,7 +23,8 @@ def self.read_file filename, encoding, force_transcode = false utf8 = content.sub!(/\A\xef\xbb\xbf/, '') - content = RDoc::Encoding.set_encoding content + enc = RDoc::Encoding.detect_encoding content + content = RDoc::Encoding.change_encoding content, enc if enc begin encoding ||= Encoding.default_external @@ -85,29 +86,23 @@ def self.remove_frozen_string_literal string end ## - # Sets the encoding of +string+ based on the magic comment - - def self.set_encoding string - string = remove_frozen_string_literal string - - string =~ /\A(?:#!.*\n)?(.*\n)/ - - first_line = $1 - - name = case first_line - when /^<\?xml[^?]*encoding=(["'])(.*?)\1/ then $2 - when /\b(?:en)?coding[=:]\s*([^\s;]+)/i then $1 - else return string - end - - string = string.sub first_line, '' - - string = remove_frozen_string_literal string - - enc = Encoding.find name - string = RDoc::Encoding.change_encoding string, enc if enc - - string + # Detects the encoding of +string+ based on the magic comment + + def self.detect_encoding string + result = / + (?: + \A\#!.*\n + | + ^\#\s+frozen[-_]string[-_]literal[=:].+$ + | + ^\#[^\n]+\b(?:en)?coding[=:]\s*(?[^\s;]+).*$ + | + <\?xml[^?]*encoding=(?["'])(?.*?)\k + )+ + /xi.match(string) + name = result && result[:name] + + name ? Encoding.find(name) : nil end ## diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index 9dc20990a0..572cfcda47 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -31,7 +31,7 @@ def test_class_read_file_encoding @tempfile.flush contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 - assert_equal "hi everybody", contents + assert_equal "# coding: utf-8\nhi everybody", contents assert_equal Encoding::UTF_8, contents.encoding end @@ -45,7 +45,7 @@ def test_class_read_file_encoding_convert contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 assert_equal Encoding::UTF_8, contents.encoding - assert_equal "hi \u00e9verybody", contents.sub("\r", '') + assert_equal "# coding: ISO-8859-1\nhi \u00e9verybody", contents.sub("\r", '') end def test_class_read_file_encoding_fail @@ -71,7 +71,7 @@ def test_class_read_file_encoding_fancy @tempfile.flush contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 - assert_equal "hi everybody", contents + assert_equal "# -*- coding: utf-8; fill-column: 74 -*-\nhi everybody", contents assert_equal Encoding::UTF_8, contents.encoding end @@ -81,7 +81,7 @@ def test_class_read_file_encoding_force_transcode contents = RDoc::Encoding.read_file @tempfile.path, Encoding::US_ASCII, true - assert_equal '?', contents + assert_equal "# coding: utf-8\n?", contents assert_equal Encoding::US_ASCII, contents.encoding end @@ -124,108 +124,58 @@ def test_class_read_file_encoding_iso_2022_jp contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8 - expected = ":\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:" + expected = "# coding: ISO-2022-JP\n:\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:" expected = RDoc::Encoding.change_encoding expected, Encoding::UTF_8 assert_equal expected, contents assert_equal Encoding::UTF_8, contents.encoding end - def test_class_set_encoding + def test_class_detect_encoding s = "# coding: UTF-8\n" - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s # sanity check for 1.8 - assert_equal Encoding::UTF_8, s.encoding + assert_equal Encoding::UTF_8, encoding s = "#!/bin/ruby\n# coding: UTF-8\n" - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal Encoding::UTF_8, s.encoding + assert_equal Encoding::UTF_8, encoding s = "\n" - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal Encoding::UTF_8, s.encoding + assert_equal Encoding::UTF_8, encoding s = "\n" - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal Encoding::UTF_8, s.encoding - end - - def test_class_set_encoding_strip - s = "# coding: UTF-8\n# more comments" - - s = RDoc::Encoding.set_encoding s - - assert_equal "# more comments", s - - s = "#!/bin/ruby\n# coding: UTF-8\n# more comments" - - s = RDoc::Encoding.set_encoding s - - assert_equal "#!/bin/ruby\n# more comments", s + assert_equal Encoding::UTF_8, encoding end def test_class_set_encoding_bad s = "" - expected = s.encoding - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal expected, s.encoding + assert_equal nil, encoding s = "# vim:set fileencoding=utf-8:\n" - expected = s.encoding - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal expected, s.encoding + assert_equal nil, encoding s = "# vim:set fileencoding=utf-8:\n" - expected = s.encoding - s = RDoc::Encoding.set_encoding s + encoding = RDoc::Encoding.detect_encoding s - assert_equal expected, s.encoding + assert_equal nil, encoding assert_raises ArgumentError do - s = RDoc::Encoding.set_encoding "# -*- encoding: undecided -*-\n" + s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n" end end - def test_skip_frozen_string_literal - expected = "# frozen_string_literal: true\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 - 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 - expected = "# frozen_string_literal: true\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 assert_equal Encoding::US_ASCII, ''.encoding, 'If this file is not ASCII tests may incorrectly pass' From 8b3b2567cf8983eac525449c94a7b955d3c1bc7e Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 11 Jan 2018 01:53:18 +0900 Subject: [PATCH 0512/1389] Remove magic comment but leave newline This commit removes magic comments from documents and keeps correct line number. --- lib/rdoc/encoding.rb | 33 ++++++++++++++++++++++----------- lib/rdoc/markup/pre_process.rb | 1 + lib/rdoc/parser/ruby.rb | 1 + 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb index b00eaec539..dac4c36f57 100644 --- a/lib/rdoc/encoding.rb +++ b/lib/rdoc/encoding.rb @@ -7,6 +7,18 @@ module RDoc::Encoding + HEADER_REGEXP = /^ + (?: + \A\#!.*\n + | + ^\#\s+frozen[-_]string[-_]literal[=:].+\n + | + ^\#[^\n]+\b(?:en)?coding[=:]\s*(?[^\s;]+).*\n + | + <\?xml[^?]*encoding=(?["'])(?.*?)\k.*\n + )+ + /xi # :nodoc: + ## # Reads the contents of +filename+ and handles any encoding directives in # the file. @@ -89,22 +101,21 @@ def self.remove_frozen_string_literal string # Detects the encoding of +string+ based on the magic comment def self.detect_encoding string - result = / - (?: - \A\#!.*\n - | - ^\#\s+frozen[-_]string[-_]literal[=:].+$ - | - ^\#[^\n]+\b(?:en)?coding[=:]\s*(?[^\s;]+).*$ - | - <\?xml[^?]*encoding=(?["'])(?.*?)\k - )+ - /xi.match(string) + result = HEADER_REGEXP.match string name = result && result[:name] name ? Encoding.find(name) : nil end + ## + # Removes magic comments and shebang + + def self.remove_magic_comment string + string.sub HEADER_REGEXP do |s| + s.gsub(/[^\n]/, '') + end + end + ## # Changes encoding based on +encoding+ without converting and returns new # string diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb index 0ac7a41934..d9e0dcac14 100644 --- a/lib/rdoc/markup/pre_process.rb +++ b/lib/rdoc/markup/pre_process.rb @@ -266,6 +266,7 @@ def include_file name, indent, encoding end content = RDoc::Encoding.read_file full_name, encoding, true + content = RDoc::Encoding.remove_magic_comment content # strip magic comment content = content.sub(/\A# .*coding[=:].*$/, '').lstrip diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8599f655ad..183156baf4 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -177,6 +177,7 @@ def initialize(top_level, file_name, content, options, stats) @size = 0 @token_listeners = nil + content = RDoc::Encoding.remove_magic_comment content @scanner = RDoc::RipperStateLex.parse(content) @content = content @scanner_point = 0 From 9d98bfe7f1abdeda5aedf9404588104980ee7a86 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 15 Jan 2018 22:32:56 +0900 Subject: [PATCH 0513/1389] Check nil text token Sometimes :on_ignored_nl token has nil text. This commit checks and bypasses the token. --- lib/rdoc/parser/ripper_state_lex.rb | 4 +++- test/test_rdoc_parser_ruby.rb | 30 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 2a285b97a4..c56cef46ee 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -341,8 +341,10 @@ def get_squashed_tk @heredoc_queue << retrieve_heredoc_info(tk) @inner_lex.lex_state = EXPR_END unless RIPPER_HAS_LEX_STATE when :on_nl, :on_ignored_nl, :on_comment, :on_heredoc_end then - unless @heredoc_queue.empty? + if !@heredoc_queue.empty? get_heredoc_tk(*@heredoc_queue.shift) + elsif tk[:text].nil? # :on_ignored_nl sometimes gives nil + tk[:text] = '' end when :on_words_beg then tk = get_words_tk(tk) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 833ed2cc74..c9d57021ce 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -306,6 +306,36 @@ def sum(n) assert_equal @top_level, sum.file end + def test_parse_on_ignored_nl_with_nil_text + util_parser <def meth + variable # comment + .chain +end +EXPECTED + expected = expected.rstrip + + @parser.scan + + foo = @store.find_class_named 'Foo' + meth = foo.method_list.first + + assert_equal 'meth', meth.name + assert_equal @top_level, meth.file + + markup_code = meth.markup_code.sub(/^.*\n/, '') + assert_equal expected, markup_code + end + def test_parse_redefined_op_with_constant klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level From 82d59dd0369155153701d96aa8c86cb77780b5ed Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Jan 2018 21:00:25 +0900 Subject: [PATCH 0514/1389] Fix WEBrick servlet for "gem server" It's a bug at the time of "frozen_string_literal: true" introduction. --- lib/rdoc/servlet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index f2d6dd5adc..89f26553ac 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -111,7 +111,7 @@ def asset generator_name, req, res # GET request entry point. Fills in +res+ for the path, etc. in +req+. def do_GET req, res - req.path = req.path.sub(/^#{Regexp.escape @mount_path}/o, '') if @mount_path + req.path.sub!(/^#{Regexp.escape @mount_path}/o, '') if @mount_path case req.path when '/' then From 7f8582da455a925979da739078d6dd5df2a8956d Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Jan 2018 21:48:01 +0900 Subject: [PATCH 0515/1389] Fix test for mutable String --- test/test_rdoc_servlet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 414f3e9301..48e2ef6517 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -143,7 +143,7 @@ def test_do_GET_mount_path @s.asset_dirs[:darkfish] = '.' - @req.path = '/mount/path/css/rdoc.css' + @req.path = '/mount/path/css/rdoc.css'.dup @s.do_GET @req, @res From c65fa35d0479e9a48135205e1237c8e4f49297b5 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Jan 2018 23:31:36 +0900 Subject: [PATCH 0516/1389] RDoc::Store#load_class supports RDoc::SingleClass RDoc treats C::S below as a RDoc::SingleClass: class C class << self class S end end end But RDoc::Store#load_class didn't support it. --- lib/rdoc/store.rb | 2 ++ test/test_rdoc_store.rb | 13 +++++++++++-- test/xref_data.rb | 7 +++++++ test/xref_test_case.rb | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index c4bc554ad2..21ea1b24e0 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -585,6 +585,8 @@ def load_class klass_name case obj when RDoc::NormalClass then @classes_hash[klass_name] = obj + when RDoc::SingleClass then + @classes_hash[klass_name] = obj when RDoc::NormalModule then @modules_hash[klass_name] = obj end diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index 0e5bcf6553..2062c39f68 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -162,7 +162,7 @@ def test_add_file_relative def test_all_classes_and_modules expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 Child M1 M1::M2 Parent @@ -213,7 +213,7 @@ def test_class_path def test_classes expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 Child Parent ] @@ -524,6 +524,15 @@ def test_load_class assert_includes @s.classes_hash, 'Object' end + def test_load_single_class + @s.save_class @c8_s1 + @s.classes_hash.clear + + assert_equal @c8_s1, @s.load_class('C8::S1') + + assert_includes @s.classes_hash, 'C8::S1' + end + def test_load_method @s.save_method @klass, @meth_bang diff --git a/test/xref_data.rb b/test/xref_data.rb index bc20d8ed91..d002b422f9 100644 --- a/test/xref_data.rb +++ b/test/xref_data.rb @@ -94,6 +94,13 @@ class C7 CONST_NODOC = :const_nodoc # :nodoc: end +class C8 + class << self + class S1 + end + end +end + module M1 def m end diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 9f709964c6..9a87166ad2 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -53,6 +53,8 @@ def generator.file_dir() nil end @c3_h2 = @xref_data.find_module_named 'C3::H2' @c6 = @xref_data.find_module_named 'C6' @c7 = @xref_data.find_module_named 'C7' + @c8 = @xref_data.find_module_named 'C8' + @c8_s1 = @xref_data.find_module_named 'C8::S1' @m1 = @xref_data.find_module_named 'M1' @m1_m = @m1.method_list.first From ba2e10f87a34161bdeca51e79241d22fdf7c5a57 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 22 Jan 2018 21:37:50 +0900 Subject: [PATCH 0517/1389] Fix AnyMethod#is_alias_for for nil singleton Sometimes AnyMethod#marshal_load set nil singleton to @is_alias_for. AnyMethod#is_alias_for didn't suppose it. --- lib/rdoc/context.rb | 8 +++++++- test/test_rdoc_any_method.rb | 13 +++++++++++++ test/test_rdoc_context.rb | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index 58b1c54269..ae76ed79a2 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -863,7 +863,13 @@ def find_local_symbol(symbol) # Finds a method named +name+ with singleton value +singleton+. def find_method(name, singleton) - @method_list.find { |m| m.name == name && m.singleton == singleton } + @method_list.find { |m| + if m.singleton + m.name == name && m.singleton == singleton + else + m.name == name && !m.singleton && !singleton + end + } end ## diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index 55793255ba..db1678d362 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -151,6 +151,19 @@ def test_marshal_load_aliased_method assert aliased_method.display? end + def test_marshal_load_aliased_method_with_nil_singleton + aliased_method = Marshal.load Marshal.dump(@c2_a) + + aliased_method.store = @store + aliased_method.is_alias_for = ["C2", nil, "b"] + + assert_equal 'C2#a', aliased_method.full_name + assert_equal 'C2', aliased_method.parent_name + assert_equal '()', aliased_method.params + assert_equal @c2_b, aliased_method.is_alias_for, 'is_alias_for' + assert aliased_method.display? + end + def test_marshal_load_class_method class_method = Marshal.load Marshal.dump(@c1.method_list.first) diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index a7d6a58716..5e739ef4e8 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -559,6 +559,14 @@ def test_find_local_symbol assert_equal @c2_c3, @c2.find_local_symbol('C3') end + def test_find_method + loaded_c2 = Marshal.load Marshal.dump @c2 + assert_equal @c2_a, loaded_c2.find_method('a', false) + assert_equal @c2_b, loaded_c2.find_method('b', false) + assert_equal @c2_a, loaded_c2.find_method('a', nil) + assert_equal @c2_b, loaded_c2.find_method('b', nil) + end + def test_find_method_named assert_equal true, @c1.find_method_named('m').singleton end From 3fbf39cbc2f47d46e9b33342ec917375db41632f Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 25 Jan 2018 18:49:12 +0900 Subject: [PATCH 0518/1389] Support aliased-method --- lib/rdoc/ri/driver.rb | 28 +++++++++++++++++++++----- test/test_rdoc_ri_driver.rb | 39 ++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index cc36cd3dcb..c4d1dd03df 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1443,7 +1443,13 @@ def render_method out, store, method, name # :nodoc: render_method_arguments out, method.arglists render_method_superclass out, method - render_method_comment out, method + if method.is_alias_for + al = method.is_alias_for + alias_for = store.load_method al.parent_name, "#{al.name_prefix}#{al.name}" + render_method_comment out, method, alias_for + else + render_method_comment out, method + end end def render_method_arguments out, arglists # :nodoc: @@ -1455,10 +1461,22 @@ def render_method_arguments out, arglists # :nodoc: out << RDoc::Markup::Rule.new(1) end - def render_method_comment out, method # :nodoc: - out << RDoc::Markup::BlankLine.new - out << method.comment - out << RDoc::Markup::BlankLine.new + def render_method_comment out, method, alias_for = nil# :nodoc: + if alias_for + unless method.comment.nil? or method.comment.empty? + out << RDoc::Markup::BlankLine.new + out << method.comment + end + out << RDoc::Markup::BlankLine.new + out << RDoc::Markup::Paragraph.new("(this method is alias for #{alias_for.full_name})") + out << RDoc::Markup::BlankLine.new + out << alias_for.comment + out << RDoc::Markup::BlankLine.new + else + out << RDoc::Markup::BlankLine.new + out << method.comment + out << RDoc::Markup::BlankLine.new + end end def render_method_superclass out, method # :nodoc: diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 758c867b08..efbf087c61 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -243,6 +243,32 @@ def test_add_method assert_equal expected, out end + def test_add_method_that_is_alias_for_original + util_store + + out = doc + + @driver.add_method out, 'Qux#aliased' + + expected = + doc( + head(1, 'Qux#aliased'), + blank_line, + para('(from ~/.rdoc)'), + rule(1), + blank_line, + para('alias comment'), + blank_line, + blank_line, + para('(this method is alias for Qux#original)'), + blank_line, + para('original comment'), + blank_line, + blank_line) + + assert_equal expected, out + end + def test_add_method_attribute util_store @@ -406,6 +432,7 @@ def test_classes 'Foo::Bar' => [@store1], 'Foo::Baz' => [@store1, @store2], 'Inc' => [@store1], + 'Qux' => [@store1], } classes = @driver.classes @@ -939,6 +966,7 @@ def test_find_methods_method [@store1, 'Foo::Bar', 'Foo::Bar', :both, 'blah'], [@store1, 'Foo::Baz', 'Foo::Baz', :both, 'blah'], [@store1, 'Inc', 'Inc', :both, 'blah'], + [@store1, 'Qux', 'Qux', :both, 'blah'], ] assert_equal expected, items @@ -1072,7 +1100,7 @@ def test_list_known_classes @driver.list_known_classes end - assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\n", out + assert_equal "Ambiguous\nExt\nFoo\nFoo::Bar\nFoo::Baz\nInc\nQux\n", out end def test_list_known_classes_name @@ -1497,6 +1525,15 @@ def util_store @overridden.comment = 'must not be displayed in Bar#override' @overridden.record_location @top_level + @cQux = @top_level.add_class RDoc::NormalClass, 'Qux' + + @original = @cQux.add_method RDoc::AnyMethod.new(nil, 'original') + @original.comment = 'original comment' + @original.record_location @top_level + + @aliased = @original.add_alias RDoc::Alias.new(nil, 'original', 'aliased', 'alias comment'), @cQux + @aliased.record_location @top_level + @store1.save @driver.stores = [@store1] From f360efee30744b9c0f7e5414c18b2cadbdedb9ff Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Thu, 25 Jan 2018 18:14:01 +0100 Subject: [PATCH 0519/1389] Fix `#tokens_to_s` method for token streams Tiny follow-up to #512. As the token stream isn't represented by an array of token classes but rather with an array of hashes, the token's text is accessible through a key and not a method. --- lib/rdoc/token_stream.rb | 2 +- test/test_rdoc_token_stream.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb index 05fb46e89a..dbe6c5ae85 100644 --- a/lib/rdoc/token_stream.rb +++ b/lib/rdoc/token_stream.rb @@ -107,7 +107,7 @@ def token_stream # Returns a string representation of the token stream def tokens_to_s - token_stream.compact.map { |token| token.text }.join '' + token_stream.compact.map { |token| token[:text] }.join '' end end diff --git a/test/test_rdoc_token_stream.rb b/test/test_rdoc_token_stream.rb index abf1469bbc..8a4d26eab0 100644 --- a/test/test_rdoc_token_stream.rb +++ b/test/test_rdoc_token_stream.rb @@ -39,5 +39,20 @@ def test_class_to_html_empty assert_equal '', RDoc::TokenStream.to_html([]) end + def test_tokens_to_s + foo = Class.new do + include RDoc::TokenStream + + def initialize + @token_stream = [ + { line_no: 0, char_no: 0, kind: :on_ident, text: "foo" }, + { line_no: 0, char_no: 0, kind: :on_sp, text: " " }, + { line_no: 0, char_no: 0, kind: :on_tstring, text: "'bar'" }, + ] + end + end.new + + assert_equal "foo 'bar'", foo.tokens_to_s + end end From 8e1916b89ef1d50930c2c863119ddb6ce6c796ed Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 27 Jan 2018 14:37:42 +0900 Subject: [PATCH 0520/1389] Improve reproducible builds for .js and .js.gz files The mtime for search_index.js.gz should be updated because it's generated dynamically. So uses SOURCE_DATE_EPOCH after RDoc::Generator::JsonIndex#generate creates index file. FileUtils.install in RDoc::Generator::JsonIndex#generate with :preserve option because the mtime value is based on original .js file. --- lib/rdoc/generator/json_index.rb | 9 ++++++--- test/test_rdoc_generator_json_index.rb | 25 ++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/generator/json_index.rb b/lib/rdoc/generator/json_index.rb index a059a5d4d0..3a1000033d 100644 --- a/lib/rdoc/generator/json_index.rb +++ b/lib/rdoc/generator/json_index.rb @@ -147,12 +147,15 @@ def generate JSON.dump data, io, 0 end + unless ENV['SOURCE_DATE_EPOCH'].nil? + index_file.utime index_file.atime, Time.at(ENV['SOURCE_DATE_EPOCH'].to_i).gmtime + end Dir.chdir @template_dir do Dir['**/*.js'].each do |source| dest = File.join out_dir, source - FileUtils.install source, dest, :mode => 0644, :verbose => $DEBUG_RDOC + FileUtils.install source, dest, :mode => 0644, :preserve => true, :verbose => $DEBUG_RDOC end end end @@ -175,7 +178,7 @@ def generate_gzipped debug_msg "Writing gzipped search index to %s" % outfile Zlib::GzipWriter.open(outfile) do |gz| - gz.mtime = 1 # make output reproducible + gz.mtime = File.mtime(search_index_file) gz.orig_name = search_index_file.basename.to_s gz.write search_index gz.close @@ -193,7 +196,7 @@ def generate_gzipped debug_msg "Writing gzipped file to %s" % outfile Zlib::GzipWriter.open(outfile) do |gz| - gz.mtime = 1 # make output reproducible + gz.mtime = File.mtime(dest) gz.orig_name = dest.basename.to_s gz.write data gz.close diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 6cb5463d29..65e7f087cc 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -8,7 +8,7 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase def setup super - @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_darkfish_#{$$}" + @tmpdir = Dir.mktmpdir "test_rdoc_generator_darkfish_#{$$}_" FileUtils.mkdir_p @tmpdir @options = RDoc::Options.new @@ -89,12 +89,21 @@ def test_file_dir end def test_generate + now = Time.now @g.generate assert_file 'js/searcher.js' assert_file 'js/navigation.js' assert_file 'js/search_index.js' + orig_file = Pathname(File.join @pwd, 'lib/rdoc/generator/template/json_index/js/navigation.js') + generated_file = Pathname(File.join @tmpdir, 'js/navigation.js') + assert_equal orig_file.mtime, generated_file.mtime + assert generated_file.mtime < now, '.js files should be the same timestamp' + + generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js') + assert generated_search_index.mtime > (now - 1), 'search_index.js should be generated timestamp' + json = File.read 'js/search_index.js' json =~ /\Avar search_data = / @@ -137,6 +146,20 @@ def test_generate assert_equal expected, index end + def test_generate_search_index_with_reproducible_builds + backup_epoch = ENV['SOURCE_DATE_EPOCH'] + ruby_birthday = Time.parse 'Wed, 24 Feb 1993 21:00:00 +0900' + ENV['SOURCE_DATE_EPOCH'] = ruby_birthday.to_i.to_s + + @g.generate + + assert_file 'js/search_index.js' + generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js') + assert_equal ruby_birthday, generated_search_index.mtime + + ENV['SOURCE_DATE_EPOCH'] = backup_epoch + end + def test_generate_gzipped begin require 'zlib' From 5a8dc7ce883b24539918c75a460a740943c46970 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 27 Jan 2018 17:54:31 +0900 Subject: [PATCH 0521/1389] Use dirty hack on JRuby for MiniTest 4 --- test/test_rdoc_generator_json_index.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 65e7f087cc..714d496195 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -98,7 +98,11 @@ def test_generate orig_file = Pathname(File.join @pwd, 'lib/rdoc/generator/template/json_index/js/navigation.js') generated_file = Pathname(File.join @tmpdir, 'js/navigation.js') - assert_equal orig_file.mtime, generated_file.mtime + + # This is dirty hack on JRuby for MiniTest 4 + assert orig_file.mtime.inspect == generated_file.mtime.inspect, + '.js files should be tha same timestamp of original' + assert generated_file.mtime < now, '.js files should be the same timestamp' generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js') From ecf8c4773312ca0ac31f5ee44749b4c3737b145c Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 30 Jan 2018 16:42:34 +0900 Subject: [PATCH 0522/1389] Add "frozen_string_literal: true" to ripper_state_lex.rb --- lib/rdoc/parser/ripper_state_lex.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index c56cef46ee..43f7dc1e9b 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ripper' class RDoc::RipperStateLex From a7a38356e2067e71632f7cfd20007dc8afae23c1 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 30 Jan 2018 20:36:53 +0900 Subject: [PATCH 0523/1389] removed needless bundle exec --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6aa7f2f517..6c19c1831c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ rvm: env: global: NOBENCHMARK=1 -script: bundle exec rake +script: rake From cad0a7a1d8efac0545c743b67106148101fa6841 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 30 Jan 2018 20:52:51 +0900 Subject: [PATCH 0524/1389] Move jruby to allow_failures. Because it's broken with autoload. We need to replace autoload to require. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6c19c1831c..05fba9b6d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,10 @@ rvm: - 2.3.5 - 2.4.2 - ruby-head - - jruby-9.1.15.0 env: global: NOBENCHMARK=1 script: rake +matrix: + allow_failures: + - rvm: jruby-9.1.15.0 From 763dee933dd84d83e34e254ee3211d879d07adcf Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 2 Feb 2018 20:05:08 +0900 Subject: [PATCH 0525/1389] Removed unused task for ruby core and hoe task --- Rakefile | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/Rakefile b/Rakefile index 4375af0b99..270ab5cfc5 100644 --- a/Rakefile +++ b/Rakefile @@ -79,58 +79,8 @@ parsed_files = PARSER_FILES.map do |parser_file| end task "#{path}.gem" => package_parser_files -task :check_manifest => :generate desc "Genrate all files used racc and kpeg" task :generate => parsed_files -# These tasks expect to have the following directory structure: -# -# git/git.rubini.us/code # Rubinius git HEAD checkout -# svn/ruby/trunk # ruby subversion HEAD checkout -# svn/rdoc/trunk # RDoc subversion HEAD checkout -# -# If you don't have this directory structure, set RUBY_PATH and/or -# RUBINIUS_PATH. - -diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'" -rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig' --exclude '*.kpeg' --exclude '*.ry' --exclude 'literals_1_8.rb' --exclude 'gauntlet_rdoc.rb'" - -rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code' -ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk' - -desc "Updates Ruby HEAD with the currently checked-out copy of RDoc." -task :update_ruby do - sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc" - sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri" - sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib" - sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc" -end - -desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc." -task :diff_ruby do - sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true" - sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true" - sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true" - sh "diff #{diff_options} lib/rdoc #{ruby_dir}/lib/rdoc; true" - sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true" -end - -desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc." -task :update_rubinius do - sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb" - sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb" - sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib" - sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc" -end - -desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc." -task :diff_rubinius do - sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true" - sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true" - sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true" - sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true" - sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true" -end - task :build => [:generate] From e35152f5498aec825eb32e34cf6a1e62a0003265 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 2 Feb 2018 19:57:07 +0900 Subject: [PATCH 0526/1389] Fixed broken test with autoload on JRuby --- .travis.yml | 4 +--- lib/rdoc.rb | 2 +- lib/rdoc/generator/pot.rb | 6 +++--- lib/rdoc/i18n.rb | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index b21e91f936..fe1a937937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,8 @@ rvm: - 2.4.3 - 2.5.0 - ruby-head + - jruby-9.1.15.0 env: global: NOBENCHMARK=1 script: rake -matrix: - allow_failures: - - rvm: jruby-9.1.15.0 diff --git a/lib/rdoc.rb b/lib/rdoc.rb index fef3726b33..d7bed75167 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -153,7 +153,7 @@ def self.load_yaml autoload :Comment, 'rdoc/comment' - autoload :I18n, 'rdoc/i18n' + require 'rdoc/i18n' # code objects # diff --git a/lib/rdoc/generator/pot.rb b/lib/rdoc/generator/pot.rb index 8a1e0b4bd0..a12cba7505 100644 --- a/lib/rdoc/generator/pot.rb +++ b/lib/rdoc/generator/pot.rb @@ -91,8 +91,8 @@ def extract_messages extractor.extract end - autoload :MessageExtractor, 'rdoc/generator/pot/message_extractor' - autoload :PO, 'rdoc/generator/pot/po' - autoload :POEntry, 'rdoc/generator/pot/po_entry' + require 'rdoc/generator/pot/message_extractor' + require 'rdoc/generator/pot/po' + require 'rdoc/generator/pot/po_entry' end diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb index 4cb5986155..af303858b9 100644 --- a/lib/rdoc/i18n.rb +++ b/lib/rdoc/i18n.rb @@ -5,6 +5,6 @@ module RDoc::I18n autoload :Locale, 'rdoc/i18n/locale' - autoload :Text, 'rdoc/i18n/text' + require 'rdoc/i18n/text' end From ed2274ee1f6355b9aa369094fe07e65b15f71374 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 2 Feb 2018 20:34:24 +0900 Subject: [PATCH 0527/1389] Move rdoc/test_case.rb to test/minitest_helper.rb, test_case.rb is no longer valuable for end-users. --- lib/rdoc/test_case.rb => test/minitest_helper.rb | 0 test/test_rdoc_attr.rb | 2 +- test/test_rdoc_comment.rb | 2 +- test/test_rdoc_context_section.rb | 2 +- test/test_rdoc_encoding.rb | 2 +- test/test_rdoc_generator_darkfish.rb | 2 +- test/test_rdoc_generator_json_index.rb | 2 +- test/test_rdoc_generator_markup.rb | 2 +- test/test_rdoc_generator_pot.rb | 2 +- test/test_rdoc_generator_pot_po.rb | 2 +- test/test_rdoc_generator_pot_po_entry.rb | 2 +- test/test_rdoc_generator_ri.rb | 2 +- test/test_rdoc_i18n_locale.rb | 2 +- test/test_rdoc_i18n_text.rb | 2 +- test/test_rdoc_markdown.rb | 2 +- test/test_rdoc_markup.rb | 2 +- test/test_rdoc_markup_attribute_manager.rb | 2 +- test/test_rdoc_markup_attributes.rb | 2 +- test/test_rdoc_markup_document.rb | 2 +- test/test_rdoc_markup_formatter.rb | 2 +- test/test_rdoc_markup_hard_break.rb | 2 +- test/test_rdoc_markup_heading.rb | 2 +- test/test_rdoc_markup_include.rb | 2 +- test/test_rdoc_markup_indented_paragraph.rb | 2 +- test/test_rdoc_markup_paragraph.rb | 2 +- test/test_rdoc_markup_parser.rb | 2 +- test/test_rdoc_markup_pre_process.rb | 2 +- test/test_rdoc_markup_raw.rb | 2 +- test/test_rdoc_markup_to_ansi.rb | 2 +- test/test_rdoc_markup_to_bs.rb | 2 +- test/test_rdoc_markup_to_html.rb | 2 +- test/test_rdoc_markup_to_html_snippet.rb | 2 +- test/test_rdoc_markup_to_joined_paragraph.rb | 2 +- test/test_rdoc_markup_to_label.rb | 2 +- test/test_rdoc_markup_to_markdown.rb | 2 +- test/test_rdoc_markup_to_rdoc.rb | 2 +- test/test_rdoc_markup_to_table_of_contents.rb | 2 +- test/test_rdoc_markup_to_tt_only.rb | 2 +- test/test_rdoc_markup_verbatim.rb | 2 +- test/test_rdoc_options.rb | 2 +- test/test_rdoc_parser.rb | 2 +- test/test_rdoc_parser_c.rb | 2 +- test/test_rdoc_parser_changelog.rb | 2 +- test/test_rdoc_parser_markdown.rb | 2 +- test/test_rdoc_parser_rd.rb | 2 +- test/test_rdoc_parser_ruby.rb | 2 +- test/test_rdoc_parser_simple.rb | 2 +- test/test_rdoc_rd.rb | 2 +- test/test_rdoc_rd_block_parser.rb | 2 +- test/test_rdoc_rd_inline.rb | 2 +- test/test_rdoc_rd_inline_parser.rb | 2 +- test/test_rdoc_rdoc.rb | 2 +- test/test_rdoc_ri_driver.rb | 2 +- test/test_rdoc_ri_paths.rb | 2 +- test/test_rdoc_servlet.rb | 2 +- test/test_rdoc_single_class.rb | 2 +- test/test_rdoc_stats.rb | 2 +- test/test_rdoc_task.rb | 2 +- test/test_rdoc_text.rb | 2 +- test/test_rdoc_token_stream.rb | 2 +- test/test_rdoc_tom_doc.rb | 2 +- 61 files changed, 60 insertions(+), 60 deletions(-) rename lib/rdoc/test_case.rb => test/minitest_helper.rb (100%) diff --git a/lib/rdoc/test_case.rb b/test/minitest_helper.rb similarity index 100% rename from lib/rdoc/test_case.rb rename to test/minitest_helper.rb diff --git a/test/test_rdoc_attr.rb b/test/test_rdoc_attr.rb index ae702ac702..0da5bd54e4 100644 --- a/test/test_rdoc_attr.rb +++ b/test/test_rdoc_attr.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocAttr < RDoc::TestCase diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb index 567daae51c..16214eb707 100644 --- a/test/test_rdoc_comment.rb +++ b/test/test_rdoc_comment.rb @@ -1,7 +1,7 @@ # coding: us-ascii # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocComment < RDoc::TestCase diff --git a/test/test_rdoc_context_section.rb b/test/test_rdoc_context_section.rb index ff88b9b66a..f1cf493d3d 100644 --- a/test/test_rdoc_context_section.rb +++ b/test/test_rdoc_context_section.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocContextSection < RDoc::TestCase diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index 572cfcda47..73a6c7a297 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -1,7 +1,7 @@ # coding: US-ASCII # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocEncoding < RDoc::TestCase diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb index 3eeb5bf542..3f687befed 100644 --- a/test/test_rdoc_generator_darkfish.rb +++ b/test/test_rdoc_generator_darkfish.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorDarkfish < RDoc::TestCase diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 714d496195..975f215c06 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -1,7 +1,7 @@ # coding: US-ASCII # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorJsonIndex < RDoc::TestCase diff --git a/test/test_rdoc_generator_markup.rb b/test/test_rdoc_generator_markup.rb index d13f5119be..5588d9c5f0 100644 --- a/test/test_rdoc_generator_markup.rb +++ b/test/test_rdoc_generator_markup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorMarkup < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot.rb b/test/test_rdoc_generator_pot.rb index 5675f96b75..26641345ef 100644 --- a/test/test_rdoc_generator_pot.rb +++ b/test/test_rdoc_generator_pot.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorPOT < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot_po.rb b/test/test_rdoc_generator_pot_po.rb index 8786f632c0..c50899d446 100644 --- a/test/test_rdoc_generator_pot_po.rb +++ b/test/test_rdoc_generator_pot_po.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorPOTPO < RDoc::TestCase diff --git a/test/test_rdoc_generator_pot_po_entry.rb b/test/test_rdoc_generator_pot_po_entry.rb index 5c24c2d70d..f3bf329348 100644 --- a/test/test_rdoc_generator_pot_po_entry.rb +++ b/test/test_rdoc_generator_pot_po_entry.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorPOTPOEntry < RDoc::TestCase diff --git a/test/test_rdoc_generator_ri.rb b/test/test_rdoc_generator_ri.rb index 02bcee8904..a33f5ca2ac 100644 --- a/test/test_rdoc_generator_ri.rb +++ b/test/test_rdoc_generator_ri.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocGeneratorRI < RDoc::TestCase diff --git a/test/test_rdoc_i18n_locale.rb b/test/test_rdoc_i18n_locale.rb index ff9836f9a6..c936a7219f 100644 --- a/test/test_rdoc_i18n_locale.rb +++ b/test/test_rdoc_i18n_locale.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocI18nLocale < RDoc::TestCase diff --git a/test/test_rdoc_i18n_text.rb b/test/test_rdoc_i18n_text.rb index be5ff581f5..beb9f307a7 100644 --- a/test/test_rdoc_i18n_text.rb +++ b/test/test_rdoc_i18n_text.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocI18nText < RDoc::TestCase diff --git a/test/test_rdoc_markdown.rb b/test/test_rdoc_markdown.rb index 99f8abf5ab..8b58150f8a 100644 --- a/test/test_rdoc_markdown.rb +++ b/test/test_rdoc_markdown.rb @@ -1,7 +1,7 @@ # coding: UTF-8 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' require 'rdoc/markup/block_quote' require 'rdoc/markdown' diff --git a/test/test_rdoc_markup.rb b/test/test_rdoc_markup.rb index 8e4e8b968e..2812a2994f 100644 --- a/test/test_rdoc_markup.rb +++ b/test/test_rdoc_markup.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkup < RDoc::TestCase diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb index a939623e01..93338ecb50 100644 --- a/test/test_rdoc_markup_attribute_manager.rb +++ b/test/test_rdoc_markup_attribute_manager.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupAttributeManager < RDoc::TestCase diff --git a/test/test_rdoc_markup_attributes.rb b/test/test_rdoc_markup_attributes.rb index 1fad62208c..91c253a6b0 100644 --- a/test/test_rdoc_markup_attributes.rb +++ b/test/test_rdoc_markup_attributes.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupAttributes < RDoc::TestCase diff --git a/test/test_rdoc_markup_document.rb b/test/test_rdoc_markup_document.rb index d817f1b9aa..8202916238 100644 --- a/test/test_rdoc_markup_document.rb +++ b/test/test_rdoc_markup_document.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupDocument < RDoc::TestCase diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb index 0e7f72fb16..5296d9263a 100644 --- a/test/test_rdoc_markup_formatter.rb +++ b/test/test_rdoc_markup_formatter.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupFormatter < RDoc::TestCase diff --git a/test/test_rdoc_markup_hard_break.rb b/test/test_rdoc_markup_hard_break.rb index d93d52eeda..1d6c8927b5 100644 --- a/test/test_rdoc_markup_hard_break.rb +++ b/test/test_rdoc_markup_hard_break.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupHardBreak < RDoc::TestCase diff --git a/test/test_rdoc_markup_heading.rb b/test/test_rdoc_markup_heading.rb index 33e29e90e6..4508561a79 100644 --- a/test/test_rdoc_markup_heading.rb +++ b/test/test_rdoc_markup_heading.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupHeading < RDoc::TestCase diff --git a/test/test_rdoc_markup_include.rb b/test/test_rdoc_markup_include.rb index 28712fa7ed..6b2d570286 100644 --- a/test/test_rdoc_markup_include.rb +++ b/test/test_rdoc_markup_include.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupInclude < RDoc::TestCase diff --git a/test/test_rdoc_markup_indented_paragraph.rb b/test/test_rdoc_markup_indented_paragraph.rb index 53d44dcec2..06dcb25357 100644 --- a/test/test_rdoc_markup_indented_paragraph.rb +++ b/test/test_rdoc_markup_indented_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupIndentedParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_paragraph.rb b/test/test_rdoc_markup_paragraph.rb index dce3ed8efd..00e4320119 100644 --- a/test/test_rdoc_markup_paragraph.rb +++ b/test/test_rdoc_markup_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_parser.rb b/test/test_rdoc_markup_parser.rb index fa4730a06f..e1b6330916 100644 --- a/test/test_rdoc_markup_parser.rb +++ b/test/test_rdoc_markup_parser.rb @@ -1,7 +1,7 @@ # coding: utf-8 # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupParser < RDoc::TestCase diff --git a/test/test_rdoc_markup_pre_process.rb b/test/test_rdoc_markup_pre_process.rb index 887ff6de9c..60ec75c19e 100644 --- a/test/test_rdoc_markup_pre_process.rb +++ b/test/test_rdoc_markup_pre_process.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupPreProcess < RDoc::TestCase diff --git a/test/test_rdoc_markup_raw.rb b/test/test_rdoc_markup_raw.rb index aaf4e48439..95de62208a 100644 --- a/test/test_rdoc_markup_raw.rb +++ b/test/test_rdoc_markup_raw.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupRaw < RDoc::TestCase diff --git a/test/test_rdoc_markup_to_ansi.rb b/test/test_rdoc_markup_to_ansi.rb index d06ad98fa3..4c312e7972 100644 --- a/test/test_rdoc_markup_to_ansi.rb +++ b/test/test_rdoc_markup_to_ansi.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToAnsi < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_bs.rb b/test/test_rdoc_markup_to_bs.rb index 9b798c92b3..f269790357 100644 --- a/test/test_rdoc_markup_to_bs.rb +++ b/test/test_rdoc_markup_to_bs.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToBs < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index fa5828a007..59889dcc5a 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index d7ce211999..98102ba553 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToHtmlSnippet < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_joined_paragraph.rb b/test/test_rdoc_markup_to_joined_paragraph.rb index 0a6a864bfa..b4eed5f601 100644 --- a/test/test_rdoc_markup_to_joined_paragraph.rb +++ b/test/test_rdoc_markup_to_joined_paragraph.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToJoinedParagraph < RDoc::TestCase diff --git a/test/test_rdoc_markup_to_label.rb b/test/test_rdoc_markup_to_label.rb index 23ab8cbfab..b869745528 100644 --- a/test/test_rdoc_markup_to_label.rb +++ b/test/test_rdoc_markup_to_label.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToLabel < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_markdown.rb b/test/test_rdoc_markup_to_markdown.rb index f5ea8d05da..9c5b6d3e57 100644 --- a/test/test_rdoc_markup_to_markdown.rb +++ b/test/test_rdoc_markup_to_markdown.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToMarkdown < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_rdoc.rb b/test/test_rdoc_markup_to_rdoc.rb index 31761eb44d..e81bc2f1ad 100644 --- a/test/test_rdoc_markup_to_rdoc.rb +++ b/test/test_rdoc_markup_to_rdoc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToRDoc < RDoc::Markup::TextFormatterTestCase diff --git a/test/test_rdoc_markup_to_table_of_contents.rb b/test/test_rdoc_markup_to_table_of_contents.rb index f21dbfe748..bfeb2d6f58 100644 --- a/test/test_rdoc_markup_to_table_of_contents.rb +++ b/test/test_rdoc_markup_to_table_of_contents.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToTableOfContents < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_to_tt_only.rb b/test/test_rdoc_markup_to_tt_only.rb index b08362cd0b..856eb592c5 100644 --- a/test/test_rdoc_markup_to_tt_only.rb +++ b/test/test_rdoc_markup_to_tt_only.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupToTtOnly < RDoc::Markup::FormatterTestCase diff --git a/test/test_rdoc_markup_verbatim.rb b/test/test_rdoc_markup_verbatim.rb index 3b05100a33..88ca4906bb 100644 --- a/test/test_rdoc_markup_verbatim.rb +++ b/test/test_rdoc_markup_verbatim.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocMarkupVerbatim < RDoc::TestCase diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb index 760cf9db55..394d155241 100644 --- a/test/test_rdoc_options.rb +++ b/test/test_rdoc_options.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocOptions < RDoc::TestCase diff --git a/test/test_rdoc_parser.rb b/test/test_rdoc_parser.rb index 2cd03942fa..2638adcd15 100644 --- a/test/test_rdoc_parser.rb +++ b/test/test_rdoc_parser.rb @@ -1,7 +1,7 @@ # -*- coding: us-ascii -*- # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParser < RDoc::TestCase diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 2cc8ddf79a..a7a68839ae 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' =begin TODO: test call-seq parsing diff --git a/test/test_rdoc_parser_changelog.rb b/test/test_rdoc_parser_changelog.rb index 06c3ff206e..18ea81b34e 100644 --- a/test/test_rdoc_parser_changelog.rb +++ b/test/test_rdoc_parser_changelog.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParserChangeLog < RDoc::TestCase diff --git a/test/test_rdoc_parser_markdown.rb b/test/test_rdoc_parser_markdown.rb index 50893ecf99..30e66e2833 100644 --- a/test/test_rdoc_parser_markdown.rb +++ b/test/test_rdoc_parser_markdown.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParserMarkdown < RDoc::TestCase diff --git a/test/test_rdoc_parser_rd.rb b/test/test_rdoc_parser_rd.rb index e8f4250284..15112fdb0e 100644 --- a/test/test_rdoc_parser_rd.rb +++ b/test/test_rdoc_parser_rd.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParserRd < RDoc::TestCase diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 4ff2dcce00..caa1031a39 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParserRuby < RDoc::TestCase diff --git a/test/test_rdoc_parser_simple.rb b/test/test_rdoc_parser_simple.rb index cdbcd7929d..5bde34b746 100644 --- a/test/test_rdoc_parser_simple.rb +++ b/test/test_rdoc_parser_simple.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocParserSimple < RDoc::TestCase diff --git a/test/test_rdoc_rd.rb b/test/test_rdoc_rd.rb index ed67ae2caa..70bb94d24b 100644 --- a/test/test_rdoc_rd.rb +++ b/test/test_rdoc_rd.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRd < RDoc::TestCase diff --git a/test/test_rdoc_rd_block_parser.rb b/test/test_rdoc_rd_block_parser.rb index a73c206508..0f0bc4f891 100644 --- a/test/test_rdoc_rd_block_parser.rb +++ b/test/test_rdoc_rd_block_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRdBlockParser < RDoc::TestCase diff --git a/test/test_rdoc_rd_inline.rb b/test/test_rdoc_rd_inline.rb index 2869681c6e..dbba164865 100644 --- a/test/test_rdoc_rd_inline.rb +++ b/test/test_rdoc_rd_inline.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRdInline < RDoc::TestCase diff --git a/test/test_rdoc_rd_inline_parser.rb b/test/test_rdoc_rd_inline_parser.rb index b4394019b3..3673de48e1 100644 --- a/test/test_rdoc_rd_inline_parser.rb +++ b/test/test_rdoc_rd_inline_parser.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRdInlineParser < RDoc::TestCase diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index b73780c498..c46d9b4396 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRDoc < RDoc::TestCase diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index efbf087c61..7b1fc180b0 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRIDriver < RDoc::TestCase diff --git a/test/test_rdoc_ri_paths.rb b/test/test_rdoc_ri_paths.rb index 0e00fd4a98..eb9b7fc93c 100644 --- a/test/test_rdoc_ri_paths.rb +++ b/test/test_rdoc_ri_paths.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocRIPaths < RDoc::TestCase diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 48e2ef6517..c0c0869293 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocServlet < RDoc::TestCase diff --git a/test/test_rdoc_single_class.rb b/test/test_rdoc_single_class.rb index 5761bfef4d..e4123cb9bc 100644 --- a/test/test_rdoc_single_class.rb +++ b/test/test_rdoc_single_class.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocSingleClass < RDoc::TestCase diff --git a/test/test_rdoc_stats.rb b/test/test_rdoc_stats.rb index 19fc2365b3..cac30d15aa 100644 --- a/test/test_rdoc_stats.rb +++ b/test/test_rdoc_stats.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocStats < RDoc::TestCase diff --git a/test/test_rdoc_task.rb b/test/test_rdoc_task.rb index ac3512f42a..3ce8529aef 100644 --- a/test/test_rdoc_task.rb +++ b/test/test_rdoc_task.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' begin require 'rake' rescue LoadError diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index e0a52590cb..61f528a5a4 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' require 'timeout' class TestRDocText < RDoc::TestCase diff --git a/test/test_rdoc_token_stream.rb b/test/test_rdoc_token_stream.rb index 8a4d26eab0..c946d0f1ef 100644 --- a/test/test_rdoc_token_stream.rb +++ b/test/test_rdoc_token_stream.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocTokenStream < RDoc::TestCase diff --git a/test/test_rdoc_tom_doc.rb b/test/test_rdoc_tom_doc.rb index 15bbd9b32d..6a6822d50d 100644 --- a/test/test_rdoc_tom_doc.rb +++ b/test/test_rdoc_tom_doc.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'rdoc/test_case' +require 'minitest_helper' class TestRDocTomDoc < RDoc::TestCase From 41a12068156fdd529b75cd0308d7fb16caf3943f Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 2 Feb 2018 20:40:15 +0900 Subject: [PATCH 0528/1389] Try to fix JRuby environment --- rdoc.gemspec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 9b4a1f2f0f..286895af5c 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -1,8 +1,13 @@ begin require_relative "lib/rdoc" rescue LoadError - # for Ruby repository - require_relative "../rdoc" + begin + # for Ruby repository + require_relative "../rdoc" + rescue LoadError + $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) + require "rdoc" + end end Gem::Specification.new do |s| From 5ad50e9a99cec2ca65181dd08f6849af1c550eea Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 2 Feb 2018 20:59:59 +0900 Subject: [PATCH 0529/1389] comment --- rdoc.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/rdoc.gemspec b/rdoc.gemspec index 286895af5c..9852844b46 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -5,6 +5,7 @@ rescue LoadError # for Ruby repository require_relative "../rdoc" rescue LoadError + # for JRuby $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) require "rdoc" end From b54765432792a7543437c50db395a6ebb598a35f Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 20 Feb 2018 01:14:53 +0900 Subject: [PATCH 0530/1389] Add assertions for test_parse_constant_alias --- test/test_rdoc_parser_ruby.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index caa1031a39..c5aa4be708 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1388,6 +1388,9 @@ def test_parse_constant_alias @parser.parse_constant klass, tk, @comment + assert_equal [], klass.modules.map(&:full_name) + assert_equal ['Foo::B', 'Foo::A'], klass.classes.map(&:full_name) + assert_equal ['Foo::A'], klass.constants.map(&:full_name) assert_equal 'Foo::A', klass.find_module_named('A').full_name end From ef958c22d300440bd8d1979378a74aab1facd1f4 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 10 Feb 2018 00:05:41 +0900 Subject: [PATCH 0531/1389] Delay registration constants discovered in passing RDoc::Parser::Ruby#parse_constant registers nested constants automatically. For example, it registers module 'A' and 'B' with A::B::C. Second, constant 'C' is registered if assign token '=' comes. This logic automatically registers 'A' and 'B' if assign token doesn't come. This commit fixes it. --- lib/rdoc/context.rb | 8 ++++++++ lib/rdoc/parser/ruby.rb | 20 ++++++++++++++++---- test/test_rdoc_parser_ruby.rb | 25 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index ae76ed79a2..b45f2700cb 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -407,6 +407,7 @@ def add_class_or_module mod, self_hash, all_hash mod.section = current_section # TODO declaring context? something is # wrong here... mod.parent = self + mod.full_name = nil mod.store = @store unless @done_documenting then @@ -510,6 +511,13 @@ def add_module(class_type, name) add_class_or_module mod, @modules, @store.modules_hash end + ## + # Adds a module by +RDoc::NormalModule+ instance. See also #add_module. + + def add_module_by_normal_module(mod) + add_class_or_module mod, @modules, @store.modules_hash + end + ## # Adds an alias from +from+ (a class or module) to +name+ which was defined # in +file+. diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index dd8a777e75..8af61f6d46 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -356,12 +356,15 @@ def get_class_or_module container, ignore_constants = false given_name << name_t[:text] is_self = name_t[:kind] == :on_op && name_t[:text] == '<<' + new_modules = [] while !is_self && (tk = peek_tk) and :on_op == tk[:kind] and '::' == tk[:text] do prev_container = container container = container.find_module_named name_t[:text] container ||= if ignore_constants then - RDoc::Context.new + c = RDoc::NormalModule.new name_t[:text] + new_modules << [prev_container, c] + c else c = prev_container.add_module RDoc::NormalModule, name_t[:text] c.ignore unless prev_container.document_children @@ -386,7 +389,7 @@ def get_class_or_module container, ignore_constants = false skip_tkspace false - return [container, name_t, given_name] + return [container, name_t, given_name, new_modules] end ## @@ -761,7 +764,7 @@ def parse_class container, single, tk, comment line_no = tk[:line_no] declaration_context = container - container, name_t, given_name = get_class_or_module container + container, name_t, given_name, = get_class_or_module container if name_t[:kind] == :on_const cls = parse_class_regular container, declaration_context, single, @@ -878,10 +881,11 @@ def parse_constant container, tk, comment, ignore_constants = false return unless name =~ /^\w+$/ + new_modules = [] if :on_op == peek_tk[:kind] && '::' == peek_tk[:text] then unget_tk tk - container, name_t, = get_class_or_module container, ignore_constants + container, name_t, _, new_modules = get_class_or_module container, true name = name_t[:text] end @@ -908,6 +912,14 @@ def parse_constant container, tk, comment, ignore_constants = false end get_tk + unless ignore_constants + new_modules.each do |prev_c, new_module| + prev_c.add_module_by_normal_module new_module + new_module.ignore unless prev_c.document_children + @top_level.add_to_classes_or_modules new_module + end + end + value = '' con = RDoc::Constant.new name, value, comment diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index caa1031a39..3e2b0c3e71 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -3928,4 +3928,29 @@ def util_two_parsers(first_file_content, second_file_content) second_file_content, @options, @stats end + def test_parse_const_third_party + util_parser <<-CLASS +class A + true if B + true if B::C + true if B::C::D + + module B + end +end + CLASS + + tk = @parser.get_tk + + @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment + + a = @top_level.classes.first + assert_equal 'A', a.full_name + + visible = @store.all_modules.reject { |mod| mod.suppressed? } + visible = visible.map { |mod| mod.full_name } + + assert_equal ['A::B'], visible + end + end From 0de925c493cc2918eb2ac8794fe64a49aab00c10 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 20 Feb 2018 18:49:20 +0900 Subject: [PATCH 0532/1389] Lazy registration module alias RDoc::Context#add_module_alias registers module alias only when original module found, but the original modules are sometimes registered in other files. This commit fixes it with lazy registration module alias. --- lib/rdoc/context.rb | 35 +++++--- lib/rdoc/parser/ruby.rb | 2 +- lib/rdoc/store.rb | 7 ++ test/test_rdoc_class_module.rb | 12 ++- test/test_rdoc_context.rb | 6 +- test/test_rdoc_generator_darkfish.rb | 2 +- test/test_rdoc_parser_ruby.rb | 121 +++++++++++++++++++++++++++ test/test_rdoc_store.rb | 3 +- 8 files changed, 166 insertions(+), 22 deletions(-) diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb index b45f2700cb..6caf0d6712 100644 --- a/lib/rdoc/context.rb +++ b/lib/rdoc/context.rb @@ -415,6 +415,10 @@ def add_class_or_module mod, self_hash, all_hash # this must be done AFTER adding mod to its parent, so that the full # name is correct: all_hash[mod.full_name] = mod + if @store.unmatched_constant_alias[mod.full_name] then + to, file = @store.unmatched_constant_alias[mod.full_name] + add_module_alias mod, mod.name, to, file + end end mod @@ -522,37 +526,42 @@ def add_module_by_normal_module(mod) # Adds an alias from +from+ (a class or module) to +name+ which was defined # in +file+. - def add_module_alias from, name, file + def add_module_alias from, from_name, to, file return from if @done_documenting - to_name = child_name name + to_full_name = child_name to.name # if we already know this name, don't register an alias: # see the metaprogramming in lib/active_support/basic_object.rb, # where we already know BasicObject is a class when we find # BasicObject = BlankSlate - return from if @store.find_class_or_module to_name + return from if @store.find_class_or_module to_full_name + + unless from + @store.unmatched_constant_alias[child_name(from_name)] = [to, file] + return to + end - to = from.dup - to.name = name - to.full_name = nil + new_to = from.dup + new_to.name = to.name + new_to.full_name = nil - if to.module? then - @store.modules_hash[to_name] = to - @modules[name] = to + if new_to.module? then + @store.modules_hash[to_full_name] = new_to + @modules[to.name] = new_to else - @store.classes_hash[to_name] = to - @classes[name] = to + @store.classes_hash[to_full_name] = new_to + @classes[to.name] = new_to end # Registers a constant for this alias. The constant value and comment # will be updated later, when the Ruby parser adds the constant - const = RDoc::Constant.new name, nil, to.comment + const = RDoc::Constant.new to.name, nil, new_to.comment const.record_location file const.is_alias_for = from add_constant const - to + new_to end ## diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8af61f6d46..6fe4a89e46 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -307,7 +307,7 @@ def create_module_alias container, constant, rhs_name # :nodoc: container.find_module_named rhs_name end - container.add_module_alias mod, constant.name, @top_level if mod + container.add_module_alias mod, rhs_name, constant, @top_level end ## diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index 21ea1b24e0..b7e677abf9 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -116,6 +116,11 @@ def message # :nodoc: attr_accessor :encoding + ## + # The lazy constants alias will be discovered in passing + + attr_reader :unmatched_constant_alias + ## # Creates a new Store of +type+ that will load or save to +path+ @@ -152,6 +157,8 @@ def initialize path = nil, type = nil @unique_classes = nil @unique_modules = nil + + @unmatched_constant_alias = {} end ## diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 273a21120f..3dc2a42cf4 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -1277,7 +1277,8 @@ def test_update_aliases_class n1 = @xref_data.add_module RDoc::NormalClass, 'N1' n1_k2 = n1.add_module RDoc::NormalClass, 'N2' - n1.add_module_alias n1_k2, 'A1', @xref_data + a1 = RDoc::Constant.new 'A1', '', '' + n1.add_module_alias n1_k2, n1_k2.name, a1, @xref_data n1_a1_c = n1.constants.find { |c| c.name == 'A1' } refute_nil n1_a1_c @@ -1301,7 +1302,8 @@ def test_update_aliases_module n1 = @xref_data.add_module RDoc::NormalModule, 'N1' n1_n2 = n1.add_module RDoc::NormalModule, 'N2' - n1.add_module_alias n1_n2, 'A1', @xref_data + a1 = RDoc::Constant.new 'A1', '', '' + n1.add_module_alias n1_n2, n1_n2.name, a1, @xref_data n1_a1_c = n1.constants.find { |c| c.name == 'A1' } refute_nil n1_a1_c @@ -1326,7 +1328,8 @@ def test_update_aliases_reparent l1_l2 = l1.add_module RDoc::NormalModule, 'L2' o1 = @xref_data.add_module RDoc::NormalModule, 'O1' - o1.add_module_alias l1_l2, 'A1', @xref_data + a1 = RDoc::Constant.new 'A1', '', '' + o1.add_module_alias l1_l2, l1_l2.name, a1, @xref_data o1_a1_c = o1.constants.find { |c| c.name == 'A1' } refute_nil o1_a1_c @@ -1358,7 +1361,8 @@ def test_update_aliases_reparent_root const.record_location top_level const.is_alias_for = klass - top_level.add_module_alias klass, 'A', top_level + a = RDoc::Constant.new 'A', '', '' + top_level.add_module_alias klass, klass.name, a, top_level object.add_constant const diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index 5e739ef4e8..cf18d7cc20 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -280,7 +280,8 @@ def test_add_module def test_add_module_alias tl = @store.add_file 'file.rb' - c3_c4 = @c2.add_module_alias @c2_c3, 'C4', tl + c4 = RDoc::Constant.new 'C4', '', '' + c3_c4 = @c2.add_module_alias @c2_c3, @c2_c3.name, c4, tl alias_constant = @c2.constants.first @@ -298,7 +299,8 @@ def test_add_module_alias_top_level object = top_level.add_class RDoc::NormalClass, 'Object' - top_level.add_module_alias klass, 'A', top_level + a = RDoc::Constant.new 'A', '', '' + top_level.add_module_alias klass, klass.name, a, top_level refute_empty object.constants diff --git a/test/test_rdoc_generator_darkfish.rb b/test/test_rdoc_generator_darkfish.rb index 3f687befed..edabe4fad4 100644 --- a/test/test_rdoc_generator_darkfish.rb +++ b/test/test_rdoc_generator_darkfish.rb @@ -39,7 +39,7 @@ def setup @top_level.add_constant @alias_constant - @klass.add_module_alias @klass, 'A', @top_level + @klass.add_module_alias @klass, @klass.name, @alias_constant, @top_level @meth = RDoc::AnyMethod.new nil, 'method' @meth_bang = RDoc::AnyMethod.new nil, 'method!' diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 3e2b0c3e71..d9ec7b0988 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -3953,4 +3953,125 @@ module B assert_equal ['A::B'], visible end + def test_parse_const_alias_defined_elsewhere + util_parser <<-CLASS +module A + Aliased = Defined +end + +module A + class Defined + end +end + CLASS + + @parser.scan + + a = @top_level.modules.first + assert_equal 'A', a.full_name + aliased = a.constants.first + assert_equal 'A::Aliased', aliased.full_name + assert_equal [], a.modules.map(&:full_name) + assert_equal ['A::Defined', 'A::Aliased'], a.classes.map(&:full_name) + assert_equal ['A::Aliased'], a.constants.map(&:full_name) + + visible = @store.all_modules.reject { |mod| mod.suppressed? } + visible = visible.map { |mod| mod.full_name } + + assert_equal ['A'], visible + end + + def test_parse_const_alias_defined_far_away + util_parser <<-CLASS +module A + Aliased = ::B::C::Defined +end + +module B + module C + class Defined + end + end +end + CLASS + + @parser.scan + + a = @top_level.modules.first + assert_equal 'A', a.full_name + assert_empty a.classes + assert_empty a.modules + assert_equal ['A::Aliased'], a.constants.map(&:full_name) + + defined = @store.find_class_named 'B::C::Defined' + assert_equal 'B::C::Defined', defined.full_name + + aliased = @store.find_class_named 'B::C::Aliased' + assert_equal 'B::C::Aliased', aliased.full_name + + visible = @store.all_modules.reject { |mod| mod.suppressed? } + visible = visible.map { |mod| mod.full_name } + + assert_equal ['A', 'B', 'B::C'], visible + end + + def test_parse_const_alias_defined_elsewhere + util_parser <<-CLASS +module A + Aliased = Defined +end + +module A + class Defined + end +end + CLASS + + @parser.scan + + a = @top_level.modules.first + assert_equal 'A', a.full_name + aliased = a.constants.first + assert_equal 'A::Aliased', aliased.full_name + + visible = @store.all_modules.reject { |mod| mod.suppressed? } + visible = visible.map { |mod| mod.full_name } + + assert_equal ['A'], visible + end + + def test_parse_const_alias_defined_far_away + util_parser <<-CLASS +module A + Aliased = ::B::C::Defined +end + +module B + module C + class Defined + end + end +end + CLASS + + @parser.scan + + a = @top_level.modules.first + assert_equal 'A', a.full_name + assert_empty a.classes + assert_empty a.modules + assert_equal ['A::Aliased'], a.constants.map(&:full_name) + + defined = @store.find_class_named 'B::C::Defined' + assert_equal 'B::C::Defined', defined.full_name + + aliased = @store.find_class_named 'B::C::Aliased' + assert_equal 'B::C::Aliased', aliased.full_name + + visible = @store.all_modules.reject { |mod| mod.suppressed? } + visible = visible.map { |mod| mod.full_name } + + assert_equal ['A', 'B', 'B::C'], visible + end + end diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index 2062c39f68..96153a36ec 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -222,7 +222,8 @@ def test_classes end def test_complete - @c2.add_module_alias @c2_c3, 'A1', @top_level + a1 = RDoc::Constant.new 'A1', '', '' + @c2.add_module_alias @c2_c3, @c2_c3.name, a1, @top_level @store.complete :public From 73aed3fba09a52545ef9151fdcabfc1ee240c991 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 22 Feb 2018 15:20:24 +0900 Subject: [PATCH 0533/1389] Remove date field from gemspec. It's automatically assigned when pushing to rubygems.org --- rdoc.gemspec | 1 - 1 file changed, 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 9852844b46..fdd65e6e2b 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -14,7 +14,6 @@ end Gem::Specification.new do |s| s.name = "rdoc" s.version = RDoc::VERSION - s.date = "2017-12-24" s.authors = [ "Eric Hodel", From 30b71090c1076199b0bfdb27f42f61f175c8a71c Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 24 Feb 2018 15:47:41 +0900 Subject: [PATCH 0534/1389] Remove RDoc::RDoc#exclude The property is copied from @options and not used. It's inappropriately complicated for the processing the option. --- lib/rdoc/rdoc.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 875461917c..87016ad520 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -35,11 +35,6 @@ class RDoc::RDoc GENERATORS = {} - ## - # File pattern to exclude - - attr_accessor :exclude - ## # Generator instance used for creating output @@ -93,7 +88,6 @@ def self.current= rdoc def initialize @current = nil - @exclude = nil @generator = nil @last_modified = {} @old_siginfo = nil @@ -116,7 +110,7 @@ def error(msg) def gather_files files files = ["."] if files.empty? - file_list = normalized_file_list files, true, @exclude + file_list = normalized_file_list files, true, @options.exclude file_list = file_list.uniq @@ -472,8 +466,6 @@ def document options exit end - @exclude = @options.exclude - unless @options.coverage_report then @last_modified = setup_output_dir @options.op_dir, @options.force_update end From b9265b550a2ce3cf4ff06d337dfd0b99817a1d49 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 24 Feb 2018 15:54:53 +0900 Subject: [PATCH 0535/1389] Override .document setting by --exclude option --- lib/rdoc/rdoc.rb | 2 +- test/test_rdoc_rdoc.rb | 54 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 87016ad520..31a92b3bec 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -258,7 +258,7 @@ def parse_dot_doc_file in_dir, filename patterns.split.each do |patt| candidates = Dir.glob(File.join(in_dir, patt)) - result.concat normalized_file_list(candidates) + result.concat normalized_file_list(candidates, false, @options.exclude) end result diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index c46d9b4396..7c54e543f9 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -181,6 +181,60 @@ def test_normalized_file_list_non_file_directory assert_match %r"#{dev}$", err end + def test_normalized_file_list_with_dot_doc + expected_files = [] + files = temp_dir do |dir| + a = File.expand_path('a.rb') + b = File.expand_path('b.rb') + c = File.expand_path('c.rb') + FileUtils.touch a + FileUtils.touch b + FileUtils.touch c + + dot_doc = File.expand_path('.document') + FileUtils.touch dot_doc + open(dot_doc, 'w') do |f| + f.puts 'a.rb' + f.puts 'b.rb' + end + expected_files << a + expected_files << b + + @rdoc.normalized_file_list [dir] + end + + files = files.map { |file| File.expand_path file } + + assert_equal expected_files, files + end + + def test_normalized_file_list_with_dot_doc_overridden_by_exclude_option + expected_files = [] + files = temp_dir do |dir| + a = File.expand_path('a.rb') + b = File.expand_path('b.rb') + c = File.expand_path('c.rb') + FileUtils.touch a + FileUtils.touch b + FileUtils.touch c + + dot_doc = File.expand_path('.document') + FileUtils.touch dot_doc + open(dot_doc, 'w') do |f| + f.puts 'a.rb' + f.puts 'b.rb' + end + expected_files << a + + @rdoc.options.exclude = Regexp.new(['b.rb'].join('|')) + @rdoc.normalized_file_list [dir] + end + + files = files.map { |file| File.expand_path file } + + assert_equal expected_files, files + end + def test_parse_file @rdoc.store = RDoc::Store.new From 31aad57079bf9380eeccd9fc1732acd5e528a034 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 27 Feb 2018 17:33:40 +0900 Subject: [PATCH 0536/1389] Use JRuby 9.1.16.0 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fe1a937937..d873eaa44b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.4.3 - 2.5.0 - ruby-head - - jruby-9.1.15.0 + - jruby-9.1.16.0 env: global: NOBENCHMARK=1 From 32d9a92d4662404c6237f55bc02f25f3872cde2f Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 6 Mar 2018 21:43:06 +0900 Subject: [PATCH 0537/1389] Escape source_name parameter on RDoc::Servlet. Patch by @claudijd --- lib/rdoc/servlet.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index 89f26553ac..79550fe63b 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true require 'rdoc' +require 'erb' require 'time' require 'json' require 'webrick' @@ -427,14 +428,14 @@ def store_for source_name end raise WEBrick::HTTPStatus::NotFound, - "Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir + "Could not find gem \"#{ERB::Util.html_escape(source_name)}\". Are you sure you installed it?" unless ri_dir store = RDoc::Store.new ri_dir, type return store if File.exist? store.cache_path raise WEBrick::HTTPStatus::NotFound, - "Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`" + "Could not find documentation for \"#{ERB::Util.html_escape(source_name)}\". Please run `gem rdoc --ri gem_name`" end end From 54bb5c5977025339b92540d5c5c394faad84a277 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 8 Mar 2018 18:36:02 +0900 Subject: [PATCH 0538/1389] Removed needless load_path as lib and added verbose option for debug. --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 270ab5cfc5..63aab4ffd5 100644 --- a/Rakefile +++ b/Rakefile @@ -35,7 +35,7 @@ end Rake::TestTask.new(:test) do |t| t.libs << "test" - t.libs << "lib" + t.verbose = true t.test_files = FileList['test/**/test_*.rb'] end From 8617f237718f5f8c5908d66ae6a8120d594dd015 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 8 Mar 2018 18:36:45 +0900 Subject: [PATCH 0539/1389] Support to minitest 5 --- test/minitest_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index 5f38870324..1814669bf9 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true begin - gem 'minitest', '~> 4.0' unless defined?(Test::Unit) + gem 'minitest', '~> 5.0' rescue NoMethodError, Gem::LoadError # for ruby tests end @@ -29,7 +29,7 @@ # * @pwd containing the current working directory # * FileUtils, pp, Tempfile, Dir.tmpdir and StringIO -class RDoc::TestCase < MiniTest::Unit::TestCase +class RDoc::TestCase < (defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase) ## # Abstract test-case setup From cbce629847bfc645e46df178e589edb00753e03b Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 8 Mar 2018 18:37:34 +0900 Subject: [PATCH 0540/1389] Fixed load target with installed rdoc. I enforce to use minitest_helper on repository. --- lib/rdoc.rb | 2 -- test/xref_test_case.rb | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index d7bed75167..e50c3bcdba 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -125,8 +125,6 @@ def self.load_yaml autoload :RDoc, 'rdoc/rdoc' - autoload :TestCase, 'rdoc/test_case' - autoload :CrossReference, 'rdoc/cross_reference' autoload :ERBIO, 'rdoc/erbio' autoload :ERBPartial, 'rdoc/erb_partial' diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 9a87166ad2..70b7df4222 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true ENV['RDOC_TEST'] = 'yes' -require 'rdoc' +require 'minitest_helper' require File.expand_path '../xref_data', __FILE__ class XrefTestCase < RDoc::TestCase From 05c8efebe94dc6b547583df187a4c0dd2661970e Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 8 Mar 2018 18:38:31 +0900 Subject: [PATCH 0541/1389] bump minitest version to 5 --- rdoc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index fdd65e6e2b..bb3af71671 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -63,5 +63,5 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.add_development_dependency("rake") s.add_development_dependency("racc", "> 1.4.10") s.add_development_dependency("kpeg") - s.add_development_dependency("minitest", "~> 4") + s.add_development_dependency("minitest", "~> 5") end From 22cbdbc6e1085c4803d825712e708ac005e09683 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 17 Mar 2018 14:20:25 +0900 Subject: [PATCH 0542/1389] Remove lib/rdoc/test_case.rb from s.files --- rdoc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index fdd65e6e2b..058871d323 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -38,7 +38,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "rdoc.gemspec"] # files from .gitignore s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb" From 67b3959cbe0e3b81978f589a143f4d69317a068f Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 17 Mar 2018 14:21:20 +0900 Subject: [PATCH 0543/1389] Bump version to 6.0.2 --- lib/rdoc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index d7bed75167..b0e51b3e50 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.1' + VERSION = '6.0.2' ## # Method visibilities From 1f810c48f7fbedbea57779d49380d2531cb02483 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 20 Mar 2018 12:04:55 +0900 Subject: [PATCH 0544/1389] Added workaround for Ruby core repository. Ruby core repository was different directory structure. --- test/test_rdoc_generator_json_index.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 975f215c06..ca7260c820 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -96,7 +96,13 @@ def test_generate assert_file 'js/navigation.js' assert_file 'js/search_index.js' - orig_file = Pathname(File.join @pwd, 'lib/rdoc/generator/template/json_index/js/navigation.js') + srcdir = File.expand_path("../../lib/rdoc", __FILE__) + if !File.directory? srcdir + # for Ruby core repository + srcdir = File.expand_path("../../../lib/rdoc", __FILE__) + end + + orig_file = Pathname(File.join srcdir, 'generator/template/json_index/js/navigation.js') generated_file = Pathname(File.join @tmpdir, 'js/navigation.js') # This is dirty hack on JRuby for MiniTest 4 From ab753aaa8dbdb3b86a287666697e75c541466f78 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 20 Mar 2018 14:54:07 +0900 Subject: [PATCH 0545/1389] Ignore JRuby matrix on Travis --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index d873eaa44b..c94abb13c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,6 @@ env: global: NOBENCHMARK=1 script: rake +matrix: + allow_failures: + - rvm: jruby-9.1.16.0 From 3f75886bcc1c48f5edde97058547aaf9dde86b1f Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 20 Mar 2018 15:55:34 +0900 Subject: [PATCH 0546/1389] expand temp dir used by File.realpath. It was failed on macOS. --- test/test_rdoc_rdoc.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 7c54e543f9..4014ecfa54 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -200,7 +200,7 @@ def test_normalized_file_list_with_dot_doc expected_files << a expected_files << b - @rdoc.normalized_file_list [dir] + @rdoc.normalized_file_list [File.realpath(dir)] end files = files.map { |file| File.expand_path file } @@ -227,7 +227,7 @@ def test_normalized_file_list_with_dot_doc_overridden_by_exclude_option expected_files << a @rdoc.options.exclude = Regexp.new(['b.rb'].join('|')) - @rdoc.normalized_file_list [dir] + @rdoc.normalized_file_list [File.realpath(dir)] end files = files.map { |file| File.expand_path file } From 37e0d9fdc3d5fc9840976894f4de975f9fa03ac9 Mon Sep 17 00:00:00 2001 From: Nathan Beyer Date: Thu, 22 Mar 2018 23:12:28 -0500 Subject: [PATCH 0547/1389] Cleanup minitest deprecation warnings about assert_nil --- test/test_rdoc_any_method.rb | 9 ++-- test/test_rdoc_attr.rb | 3 +- test/test_rdoc_code_object.rb | 2 +- test/test_rdoc_comment.rb | 2 +- test/test_rdoc_constant.rb | 2 +- test/test_rdoc_context.rb | 16 +++---- test/test_rdoc_encoding.rb | 6 +-- test/test_rdoc_markup_formatter.rb | 17 ++++---- test/test_rdoc_markup_parser.rb | 2 +- test/test_rdoc_parser_c.rb | 4 +- test/test_rdoc_parser_ruby.rb | 68 +++++++++++++++--------------- test/test_rdoc_ri_driver.rb | 20 ++++----- test/test_rdoc_store.rb | 4 +- test/test_rdoc_top_level.rb | 2 +- 14 files changed, 77 insertions(+), 80 deletions(-) diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index db1678d362..b5281f611d 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -133,7 +133,7 @@ def test_marshal_dump assert_equal 'Klass#method', loaded.full_name assert_equal 'method', loaded.name assert_equal 'param', loaded.params - assert_equal nil, loaded.singleton # defaults to nil + assert_nil loaded.singleton # defaults to nil assert_equal :public, loaded.visibility assert_equal cm, loaded.parent assert_equal section, loaded.section @@ -220,9 +220,9 @@ def test_marshal_load_version_0 assert_equal 'Klass#method', loaded.full_name assert_equal 'method', loaded.name assert_equal 'param', loaded.params - assert_equal nil, loaded.singleton # defaults to nil + assert_nil loaded.singleton # defaults to nil assert_equal :public, loaded.visibility - assert_equal nil, loaded.file + assert_nil loaded.file assert_equal cm, loaded.parent assert_equal section, loaded.section assert_nil loaded.is_alias_for @@ -277,7 +277,7 @@ def test_marshal_dump_version_2 assert_equal 'Klass#method', loaded.full_name assert_equal 'method', loaded.name assert_equal 'param', loaded.params - assert_equal nil, loaded.singleton # defaults to nil + assert_nil loaded.singleton # defaults to nil assert_equal :public, loaded.visibility assert_equal cm, loaded.parent assert_equal section, loaded.section @@ -480,4 +480,3 @@ def test_superclass_method_multilevel end end - diff --git a/test/test_rdoc_attr.rb b/test/test_rdoc_attr.rb index 0da5bd54e4..5910c0fad3 100644 --- a/test/test_rdoc_attr.rb +++ b/test/test_rdoc_attr.rb @@ -139,7 +139,7 @@ def test_marshal_load_version_1 assert_equal cm, loaded.parent assert_equal section, loaded.section - assert loaded.display? + assert loaded.display? end def test_marshal_load_version_2 @@ -188,4 +188,3 @@ def test_type end end - diff --git a/test/test_rdoc_code_object.rb b/test/test_rdoc_code_object.rb index d189ac1c4b..fad182722a 100644 --- a/test/test_rdoc_code_object.rb +++ b/test/test_rdoc_code_object.rb @@ -213,7 +213,7 @@ def test_each_parent end def test_file_name - assert_equal nil, @co.file_name + assert_nil @co.file_name @co.record_location @store.add_file 'lib/file.rb' diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb index 16214eb707..9b3c105bb0 100644 --- a/test/test_rdoc_comment.rb +++ b/test/test_rdoc_comment.rb @@ -77,7 +77,7 @@ def test_extract_call_seq_commented comment.extract_call_seq m - assert_equal nil, m.call_seq + assert_nil m.call_seq end def test_extract_call_seq_no_blank diff --git a/test/test_rdoc_constant.rb b/test/test_rdoc_constant.rb index e715131579..79dcdad57e 100644 --- a/test/test_rdoc_constant.rb +++ b/test/test_rdoc_constant.rb @@ -118,7 +118,7 @@ def test_marshal_load assert_equal cm, loaded.parent assert_equal section, loaded.section - assert loaded.display? + assert loaded.display? end def test_marshal_load_version_0 diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index cf18d7cc20..5a9c5db39e 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -14,10 +14,10 @@ def test_initialize assert_empty @context.in_files assert_equal 'unknown', @context.name assert_equal '', @context.comment - assert_equal nil, @context.parent + assert_nil @context.parent assert_equal :public, @context.visibility assert_equal 1, @context.sections.length - assert_equal nil, @context.temporary_section + assert_nil @context.temporary_section assert_empty @context.classes_hash assert_empty @context.modules_hash @@ -514,7 +514,7 @@ def test_each_section_enumerator end def test_find_attribute_named - assert_equal nil, @c1.find_attribute_named('none') + assert_nil @c1.find_attribute_named('none') assert_equal 'R', @c1.find_attribute_named('attr').rw assert_equal 'R', @c1.find_attribute_named('attr_reader').rw assert_equal 'W', @c1.find_attribute_named('attr_writer').rw @@ -522,7 +522,7 @@ def test_find_attribute_named end def test_find_class_method_named - assert_equal nil, @c1.find_class_method_named('none') + assert_nil @c1.find_class_method_named('none') m = @c1.find_class_method_named('m') assert_instance_of RDoc::AnyMethod, m @@ -530,23 +530,23 @@ def test_find_class_method_named end def test_find_constant_named - assert_equal nil, @c1.find_constant_named('NONE') + assert_nil @c1.find_constant_named('NONE') assert_equal ':const', @c1.find_constant_named('CONST').value end def test_find_enclosing_module_named - assert_equal nil, @c2_c3.find_enclosing_module_named('NONE') + assert_nil @c2_c3.find_enclosing_module_named('NONE') assert_equal @c1, @c2_c3.find_enclosing_module_named('C1') assert_equal @c2, @c2_c3.find_enclosing_module_named('C2') end def test_find_file_named - assert_equal nil, @c1.find_file_named('nonexistent.rb') + assert_nil @c1.find_file_named('nonexistent.rb') assert_equal @xref_data, @c1.find_file_named(@file_name) end def test_find_instance_method_named - assert_equal nil, @c1.find_instance_method_named('none') + assert_nil @c1.find_instance_method_named('none') m = @c1.find_instance_method_named('m') assert_instance_of RDoc::AnyMethod, m diff --git a/test/test_rdoc_encoding.rb b/test/test_rdoc_encoding.rb index 73a6c7a297..5b2de47aa2 100644 --- a/test/test_rdoc_encoding.rb +++ b/test/test_rdoc_encoding.rb @@ -159,17 +159,17 @@ def test_class_set_encoding_bad s = "" encoding = RDoc::Encoding.detect_encoding s - assert_equal nil, encoding + assert_nil encoding s = "# vim:set fileencoding=utf-8:\n" encoding = RDoc::Encoding.detect_encoding s - assert_equal nil, encoding + assert_nil encoding s = "# vim:set fileencoding=utf-8:\n" encoding = RDoc::Encoding.detect_encoding s - assert_equal nil, encoding + assert_nil encoding assert_raises ArgumentError do s = RDoc::Encoding.detect_encoding "# -*- encoding: undecided -*-\n" diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb index 5296d9263a..b1f0855de3 100644 --- a/test/test_rdoc_markup_formatter.rb +++ b/test/test_rdoc_markup_formatter.rb @@ -111,15 +111,15 @@ def test_parse_url assert_equal 'http', scheme assert_equal 'example/foo', url - assert_equal nil, id + assert_nil id end def test_parse_url_anchor scheme, url, id = @to.parse_url '#foottext-1' - assert_equal nil, scheme + assert_nil scheme assert_equal '#foottext-1', url - assert_equal nil, id + assert_nil id end def test_parse_url_link @@ -127,7 +127,7 @@ def test_parse_url_link assert_equal 'link', scheme assert_equal 'README.txt', url - assert_equal nil, id + assert_nil id end def test_parse_url_link_id @@ -135,7 +135,7 @@ def test_parse_url_link_id assert_equal 'link', scheme assert_equal 'README.txt#label-foo', url - assert_equal nil, id + assert_nil id end def test_parse_url_rdoc_label @@ -143,7 +143,7 @@ def test_parse_url_rdoc_label assert_equal 'link', scheme assert_equal '#foo', url - assert_equal nil, id + assert_nil id scheme, url, id = @to.parse_url 'rdoc-label:foo:bar' @@ -157,13 +157,13 @@ def test_parse_url_scheme assert_equal 'http', scheme assert_equal 'http://example/foo', url - assert_equal nil, id + assert_nil id scheme, url, id = @to.parse_url 'https://example/foo' assert_equal 'https', scheme assert_equal 'https://example/foo', url - assert_equal nil, id + assert_nil id end def test_convert_tt_special @@ -173,4 +173,3 @@ def test_convert_tt_special end end - diff --git a/test/test_rdoc_markup_parser.rb b/test/test_rdoc_markup_parser.rb index e1b6330916..6d4953bc06 100644 --- a/test/test_rdoc_markup_parser.rb +++ b/test/test_rdoc_markup_parser.rb @@ -1068,7 +1068,7 @@ def test_skip assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token - assert_equal nil, parser.skip(:NONE, false) + assert_nil parser.skip(:NONE, false) assert_equal [:NEWLINE, "\n", 9, 0], parser.peek_token end diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index a7a68839ae..b8bdbca7fd 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -327,7 +327,7 @@ def test_do_classes_boot_class_nil klass = util_get_class content, 'cFoo' assert_equal "this is the Foo boot class", klass.comment.text - assert_equal nil, klass.superclass + assert_nil klass.superclass end def test_do_aliases_missing_class @@ -1377,7 +1377,7 @@ def test_find_modifiers_nodoc parser.find_modifiers comment, method_obj - assert_equal nil, method_obj.document_self + assert_nil method_obj.document_self end def test_find_modifiers_yields diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index faa06ff23d..ce2aaae981 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -231,8 +231,8 @@ def test_look_for_directives_in_commented @parser.look_for_directives_in @top_level, comment section = @top_level.current_section - assert_equal nil, section.title - assert_equal nil, section.comment + assert_nil section.title + assert_nil section.comment assert_equal "# how to make a section:\n# # :section: new section\n", comment.text @@ -1225,7 +1225,7 @@ def test_parse_comment_attr assert_equal @top_level, foo.file assert_equal 1, foo.line - assert_equal nil, foo.viewer + assert_nil foo.viewer assert_equal true, foo.document_children assert_equal true, foo.document_self assert_equal false, foo.done_documenting @@ -1288,21 +1288,21 @@ def test_parse_comment_method assert_equal @top_level, foo.file assert_equal 1, foo.line - assert_equal [], foo.aliases - assert_equal nil, foo.block_params - assert_equal nil, foo.call_seq - assert_equal nil, foo.is_alias_for - assert_equal nil, foo.viewer - assert_equal true, foo.document_children - assert_equal true, foo.document_self - assert_equal '', foo.params - assert_equal false, foo.done_documenting - assert_equal false, foo.dont_rename_initialize - assert_equal false, foo.force_documentation - assert_equal klass, foo.parent - assert_equal false, foo.singleton - assert_equal :public, foo.visibility - assert_equal "\n", foo.text + assert_equal [], foo.aliases + assert_nil foo.block_params + assert_nil foo.call_seq + assert_nil foo.is_alias_for + assert_nil foo.viewer + assert_equal true, foo.document_children + assert_equal true, foo.document_self + assert_equal '', foo.params + assert_equal false, foo.done_documenting + assert_equal false, foo.dont_rename_initialize + assert_equal false, foo.force_documentation + assert_equal klass, foo.parent + assert_equal false, foo.singleton + assert_equal :public, foo.visibility + assert_equal "\n", foo.text assert_equal klass.current_section, foo.section stream = [ @@ -1605,19 +1605,19 @@ def test_parse_meta_method assert_equal 1, foo.line assert_equal [], foo.aliases - assert_equal nil, foo.block_params - assert_equal nil, foo.call_seq + assert_nil foo.block_params + assert_nil foo.call_seq assert_equal true, foo.document_children assert_equal true, foo.document_self assert_equal false, foo.done_documenting assert_equal false, foo.dont_rename_initialize assert_equal false, foo.force_documentation - assert_equal nil, foo.is_alias_for + assert_nil foo.is_alias_for assert_equal '', foo.params assert_equal klass, foo.parent assert_equal false, foo.singleton assert_equal 'add_my_method :foo', foo.text - assert_equal nil, foo.viewer + assert_nil foo.viewer assert_equal :public, foo.visibility assert_equal klass.current_section, foo.section @@ -1815,10 +1815,10 @@ def test_parse_method assert_equal 1, foo.line assert_equal [], foo.aliases - assert_equal nil, foo.block_params - assert_equal nil, foo.call_seq - assert_equal nil, foo.is_alias_for - assert_equal nil, foo.viewer + assert_nil foo.block_params + assert_nil foo.call_seq + assert_nil foo.is_alias_for + assert_nil foo.viewer assert_equal true, foo.document_children assert_equal true, foo.document_self assert_equal '()', foo.params @@ -3070,12 +3070,12 @@ def test_parse_symbol_in_arg @parser.skip_tkspace - assert_equal nil, @parser.parse_symbol_in_arg + assert_nil @parser.parse_symbol_in_arg @parser.get_tk # skip ',' @parser.skip_tkspace - assert_equal nil, @parser.parse_symbol_in_arg + assert_nil @parser.parse_symbol_in_arg end def test_parse_statements_alias_method @@ -3179,7 +3179,7 @@ def test_read_directive assert_equal 'category', directive assert_equal 'test', value - assert_equal nil, parser.get_tk + assert_nil parser.get_tk end def test_read_directive_allow @@ -3189,7 +3189,7 @@ def test_read_directive_allow assert_nil directive - assert_equal nil, parser.get_tk + assert_nil parser.get_tk end def test_read_directive_empty @@ -3199,7 +3199,7 @@ def test_read_directive_empty assert_nil directive - assert_equal nil, parser.get_tk + assert_nil parser.get_tk end def test_read_directive_no_comment @@ -3209,7 +3209,7 @@ def test_read_directive_no_comment assert_nil directive - assert_equal nil, parser.get_tk + assert_nil parser.get_tk end def test_read_directive_one_liner @@ -3286,14 +3286,14 @@ def test_sanity_interpolation_crazy util_parser '"#{"#{"a")}" if b}"' assert_equal '"#{"#{"a")}" if b}"', @parser.get_tk[:text] - assert_equal nil, @parser.get_tk + assert_nil @parser.get_tk end def test_sanity_interpolation_curly util_parser '%{ #{} }' assert_equal '%{ #{} }', @parser.get_tk[:text] - assert_equal nil, @parser.get_tk + assert_nil @parser.get_tk end def test_sanity_interpolation_format diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 7b1fc180b0..590c10906d 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -1171,7 +1171,7 @@ def test_load_method_inherited method = @driver.load_method(@store2, :instance_methods, 'Bar', '#', 'inherit') - assert_equal nil, method + assert_nil method end def test_load_methods_matching @@ -1276,7 +1276,7 @@ def test_parse_name_page assert_equal 'ruby', klass, 'ruby project' assert_equal ':', type, 'ruby type' - assert_equal nil, meth, 'ruby page' + assert_nil meth, 'ruby page' end def test_parse_name_page_extenson @@ -1291,26 +1291,26 @@ def test_parse_name_single_class klass, type, meth = @driver.parse_name 'Foo' assert_equal 'Foo', klass, 'Foo class' - assert_equal nil, type, 'Foo type' - assert_equal nil, meth, 'Foo method' + assert_nil type, 'Foo type' + assert_nil meth, 'Foo method' klass, type, meth = @driver.parse_name 'Foo#' assert_equal 'Foo', klass, 'Foo# class' assert_equal '#', type, 'Foo# type' - assert_equal nil, meth, 'Foo# method' + assert_nil meth, 'Foo# method' klass, type, meth = @driver.parse_name 'Foo::' assert_equal 'Foo', klass, 'Foo:: class' assert_equal '::', type, 'Foo:: type' - assert_equal nil, meth, 'Foo:: method' + assert_nil meth, 'Foo:: method' klass, type, meth = @driver.parse_name 'Foo.' assert_equal 'Foo', klass, 'Foo. class' assert_equal '.', type, 'Foo. type' - assert_equal nil, meth, 'Foo. method' + assert_nil meth, 'Foo. method' klass, type, meth = @driver.parse_name 'Foo#Bar' @@ -1335,14 +1335,14 @@ def test_parse_name_namespace klass, type, meth = @driver.parse_name 'Foo::Bar' assert_equal 'Foo::Bar', klass, 'Foo::Bar class' - assert_equal nil, type, 'Foo::Bar type' - assert_equal nil, meth, 'Foo::Bar method' + assert_nil type, 'Foo::Bar type' + assert_nil meth, 'Foo::Bar method' klass, type, meth = @driver.parse_name 'Foo::Bar#' assert_equal 'Foo::Bar', klass, 'Foo::Bar# class' assert_equal '#', type, 'Foo::Bar# type' - assert_equal nil, meth, 'Foo::Bar# method' + assert_nil meth, 'Foo::Bar# method' klass, type, meth = @driver.parse_name 'Foo::Bar#baz' diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index 96153a36ec..4246b4cbbf 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -573,7 +573,7 @@ def test_load_page end def test_main - assert_equal nil, @s.main + assert_nil @s.main @s.main = 'README.txt' @@ -991,7 +991,7 @@ def test_source end def test_title - assert_equal nil, @s.title + assert_nil @s.title @s.title = 'rdoc' diff --git a/test/test_rdoc_top_level.rb b/test/test_rdoc_top_level.rb index 00fc7a1bd5..e396791ab8 100644 --- a/test/test_rdoc_top_level.rb +++ b/test/test_rdoc_top_level.rb @@ -160,7 +160,7 @@ def test_http_url end def test_last_modified - assert_equal nil, @top_level.last_modified + assert_nil @top_level.last_modified stat = Object.new def stat.mtime() 0 end @top_level.file_stat = stat From 866bf0d72ec1f1cb3d4b6573a98d9ba899d53083 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 26 Mar 2018 14:09:33 +0900 Subject: [PATCH 0548/1389] bump version to 6.0.3 --- lib/rdoc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 4f811861d3..21b037adee 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.2' + VERSION = '6.0.3' ## # Method visibilities From 4ff1c1562bd7b38c57ce612211abf970518db4a2 Mon Sep 17 00:00:00 2001 From: k0kubun Date: Thu, 22 Feb 2018 13:28:25 +0000 Subject: [PATCH 0549/1389] erb.rb: deprecate safe_level of ERB.new Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments (trim_mode, eoutvar) are changed to keyword arguments. Old ways to specify arguments are deprecated and warned now. bin/erb: deprecate -S option. We'll remove all of deprecated ones at Ruby 2.7+. enc/make_encmake.rb: stopped using deprecated interface ext/etc/mkconstants.rb: ditto ext/socket/mkconstants.rb: ditto sample/ripper/ruby2html.rb: ditto spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto spec/ruby/library/erb/new_spec.rb: ditto test/erb/test_erb.rb: ditto test/erb/test_erb_command.rb: ditto tool/generic_erb.rb: ditto tool/ruby_vm/helpers/dumper.rb: ditto tool/transcode-tblgen.rb: ditto lib/rdoc/erbio.rb: ditto lib/rdoc/generator/darkfish.rb: ditto [Feature #14256] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/erbio.rb | 6 +++++- lib/rdoc/generator/darkfish.rb | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/erbio.rb b/lib/rdoc/erbio.rb index 29a9db510d..820a25ae01 100644 --- a/lib/rdoc/erbio.rb +++ b/lib/rdoc/erbio.rb @@ -21,7 +21,11 @@ class RDoc::ERBIO < ERB # Defaults +eoutvar+ to 'io', otherwise is identical to ERB's initialize def initialize str, safe_level = nil, trim_mode = nil, eoutvar = 'io' - super + if RUBY_VERSION >= '2.6' + super(str, trim_mode: trim_mode, eoutvar: eoutvar) + else + super + end end ## diff --git a/lib/rdoc/generator/darkfish.rb b/lib/rdoc/generator/darkfish.rb index bf4eb1f530..a07f74e716 100644 --- a/lib/rdoc/generator/darkfish.rb +++ b/lib/rdoc/generator/darkfish.rb @@ -778,7 +778,11 @@ def template_for file, page = true, klass = ERB erbout = "_erbout_#{file_var}" end - template = klass.new template, nil, '<>', erbout + if RUBY_VERSION >= '2.6' + template = klass.new template, trim_mode: '<>', eoutvar: erbout + else + template = klass.new template, nil, '<>', erbout + end @template_cache[file] = template template end From 4b15460e49fa7985b66f9f8e591f0e33f686530a Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Mon, 26 Mar 2018 11:10:45 +0200 Subject: [PATCH 0550/1389] Set the store attribute for newly created modules A regression has been introduced between RDoc 6.0.1 and 6.0.2 with ef958c22 where a new `RDoc::NormalModule` instance is created without a store associated to it. This produces an error on generation through SDoc (see zzak/sdoc#124). --- lib/rdoc/parser/ruby.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 6fe4a89e46..a90622f0f3 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -363,6 +363,7 @@ def get_class_or_module container, ignore_constants = false container ||= if ignore_constants then c = RDoc::NormalModule.new name_t[:text] + c.store = @store new_modules << [prev_container, c] c else From e0ae843f032a6ea38f15eda2199c488bd0cb1ede Mon Sep 17 00:00:00 2001 From: kazu Date: Mon, 26 Mar 2018 10:18:46 +0000 Subject: [PATCH 0551/1389] Fix test error git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_rdoc_markdown_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_markdown_test.rb b/test/test_rdoc_markdown_test.rb index 8664ac45a0..6445fb5e65 100644 --- a/test/test_rdoc_markdown_test.rb +++ b/test/test_rdoc_markdown_test.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -require 'minitest/autorun' +require 'minitest_helper' require 'pp' require 'rdoc' From 12e4e75684c84552558547a196918aeea3da8add Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 28 Mar 2018 03:18:00 +0000 Subject: [PATCH 0552/1389] fix regexp introduced at recent RDoc update (r62924). * lib/rdoc/text.rb: should escape `-` character. Sometimes test fails if `$VERBOSE = 1` with the following warning: > text.rb:172: warning: character class has duplicated range: ... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/text.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index def80d98a3..22c3777ff9 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -169,7 +169,7 @@ def strip_stars text encoding = text.encoding - text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+-/*\%@`\[\]]+%, '' + text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+\-/*\%@`\[\]]+%, '' space = ' ' space = RDoc::Encoding.change_encoding space, encoding if encoding From 718dba5060e0220cef84cbfa2eea2596f1849e7b Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 29 Apr 2018 10:19:51 +0900 Subject: [PATCH 0553/1389] Remove duplicated tests --- test/test_rdoc_parser_ruby.rb | 59 ----------------------------------- 1 file changed, 59 deletions(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index ce2aaae981..eb9c6b2455 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -3990,65 +3990,6 @@ module A Aliased = ::B::C::Defined end -module B - module C - class Defined - end - end -end - CLASS - - @parser.scan - - a = @top_level.modules.first - assert_equal 'A', a.full_name - assert_empty a.classes - assert_empty a.modules - assert_equal ['A::Aliased'], a.constants.map(&:full_name) - - defined = @store.find_class_named 'B::C::Defined' - assert_equal 'B::C::Defined', defined.full_name - - aliased = @store.find_class_named 'B::C::Aliased' - assert_equal 'B::C::Aliased', aliased.full_name - - visible = @store.all_modules.reject { |mod| mod.suppressed? } - visible = visible.map { |mod| mod.full_name } - - assert_equal ['A', 'B', 'B::C'], visible - end - - def test_parse_const_alias_defined_elsewhere - util_parser <<-CLASS -module A - Aliased = Defined -end - -module A - class Defined - end -end - CLASS - - @parser.scan - - a = @top_level.modules.first - assert_equal 'A', a.full_name - aliased = a.constants.first - assert_equal 'A::Aliased', aliased.full_name - - visible = @store.all_modules.reject { |mod| mod.suppressed? } - visible = visible.map { |mod| mod.full_name } - - assert_equal ['A'], visible - end - - def test_parse_const_alias_defined_far_away - util_parser <<-CLASS -module A - Aliased = ::B::C::Defined -end - module B module C class Defined From f50557ac1dbe7b3a9e6769987b5bebfaaf132edb Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 4 May 2018 19:01:05 +0900 Subject: [PATCH 0554/1389] v6.0.4 --- lib/rdoc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 21b037adee..a4288679c0 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -65,7 +65,7 @@ class Error < RuntimeError; end ## # RDoc version you are using - VERSION = '6.0.3' + VERSION = '6.0.4' ## # Method visibilities From 5454248e00abb2cb5a4bc70e7b82dec7e0d5869b Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 6 May 2018 20:08:28 +0900 Subject: [PATCH 0555/1389] Fix typo of comment of test_scan_block_comment_notflush --- test/test_rdoc_parser_ruby.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index eb9c6b2455..dbe05be704 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -3386,9 +3386,10 @@ class Bar def test_scan_block_comment_notflush ## # - # The previous test assumes that between the =begin/=end blocs that there is - # only one line, or minima formatting directives. This test tests for those - # who use the =begin bloc with longer / more advanced formatting within. + # The previous test assumes that between the =begin/=end blocks that there + # is only one line, or minima formatting directives. This test tests for + # those who use the =begin bloc with longer / more advanced formatting + # within. # ## content = <<-CONTENT From fa0dfc3117f1c7a03b114d8bc817c415bf057f2c Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 7 May 2018 04:07:24 +0900 Subject: [PATCH 0556/1389] Retrieve embdoc body I thought that RDoc should keep =begin/=end for quoted source code. # document # # =begin # test embdoc # =end # def blah end A commit, ced2fa3d, it fixed embdoc to keep delimiter. But it changes the behavior of documents by embdoc. =begin document =end class Foo end The class Foo has a document with =begin/=end. It's just bug. This commit fixes it. --- lib/rdoc/parser/ruby.rb | 25 +++++++++++++++++++------ test/test_rdoc_parser_ruby.rb | 12 ++++++------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index a90622f0f3..97bb5c279f 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -249,10 +249,11 @@ def collect_first_comment tk = get_tk while tk && (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) - if first_line and tk[:text] =~ /\A#!/ then + comment_body = retrieve_comment_body(tk) + if first_line and comment_body =~ /\A#!/ then skip_tkspace tk = get_tk - elsif first_line and tk[:text] =~ /\A#\s*-\*-/ then + elsif first_line and comment_body =~ /\A#\s*-\*-/ then first_line = false skip_tkspace tk = get_tk @@ -261,7 +262,7 @@ def collect_first_comment first_comment_tk_kind = tk[:kind] first_line = false - comment << tk[:text] + comment << comment_body tk = get_tk if :on_nl === tk then @@ -1654,6 +1655,17 @@ def parse_rescue end end + ## + # Retrieve comment body without =begin/=end + + def retrieve_comment_body(tk) + if :on_embdoc == tk[:kind] + tk[:text].gsub(/\A=begin.*\n/, '').gsub(/=end\n?\z/, '') + else + tk[:text] + end + end + ## # The core of the Ruby parser. @@ -1707,10 +1719,11 @@ def parse_statements(container, single = NORMAL, current_method = nil, end while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do - comment += tk[:text] - comment += "\n" unless "\n" == tk[:text].chars.to_a.last + comment_body = retrieve_comment_body(tk) + comment += comment_body + comment += "\n" unless "\n" == comment_body.chars.to_a.last - if tk[:text].size > 1 && "\n" == tk[:text].chars.to_a.last then + if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then skip_tkspace false # leading spaces end tk = get_tk diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index dbe05be704..76bdcf546a 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -73,7 +73,7 @@ class C; end comment = parser.collect_first_comment - assert_equal RDoc::Comment.new("=begin\nfirst\n=end\n", @top_level), comment + assert_equal RDoc::Comment.new("first\n", @top_level), comment end def test_get_class_or_module @@ -3349,11 +3349,11 @@ def m() end foo = @top_level.classes.first - assert_equal "=begin rdoc\nFoo comment\n=end", foo.comment.text + assert_equal 'Foo comment', foo.comment.text m = foo.method_list.first - assert_equal "=begin\nm comment\n=end", m.comment.text + assert_equal 'm comment', m.comment.text end def test_scan_block_comment_nested # Issue #41 @@ -3375,7 +3375,7 @@ class Bar foo = @top_level.modules.first assert_equal 'Foo', foo.full_name - assert_equal "=begin rdoc\nfindmeindoc\n=end", foo.comment.text + assert_equal 'findmeindoc', foo.comment.text bar = foo.classes.first @@ -3423,12 +3423,12 @@ def lauren foo = @top_level.classes.first - assert_equal "=begin rdoc\n\n= DESCRIPTION\n\nThis is a simple test class\n\n= RUMPUS\n\nIs a silly word\n\n=end", + assert_equal "= DESCRIPTION\n\nThis is a simple test class\n\n= RUMPUS\n\nIs a silly word", foo.comment.text m = foo.method_list.first - assert_equal "=begin rdoc\nA nice girl\n=end", m.comment.text + assert_equal 'A nice girl', m.comment.text end def test_scan_class_nested_nodoc From bccb9374239edf5ccebe3c99bd149c3ca322a15f Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 7 May 2018 05:56:54 +0900 Subject: [PATCH 0557/1389] Remove autoload for RipperStateLex --- lib/rdoc.rb | 1 - lib/rdoc/parser/ruby.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc.rb b/lib/rdoc.rb index a4288679c0..027772838e 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -146,7 +146,6 @@ def self.load_yaml autoload :KNOWN_CLASSES, 'rdoc/known_classes' - autoload :RipperStateLex, 'rdoc/parser/ripper_state_lex' autoload :TokenStream, 'rdoc/token_stream' autoload :Comment, 'rdoc/comment' diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 97bb5c279f..febdee3cb8 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -141,6 +141,7 @@ # standard rdocable item following it. require 'ripper' +require_relative 'ripper_state_lex' class RDoc::Parser::Ruby < RDoc::Parser From 586e19e42276ac60caf3c2447beb12c3f2a53e9f Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 8 May 2018 02:07:35 +0900 Subject: [PATCH 0558/1389] Use JRuby 9.1.17.0 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index c94abb13c0..0c56f83790 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,11 @@ rvm: - 2.4.3 - 2.5.0 - ruby-head - - jruby-9.1.16.0 + - jruby-9.1.17.0 env: global: NOBENCHMARK=1 script: rake matrix: allow_failures: - - rvm: jruby-9.1.16.0 + - rvm: jruby-9.1.17.0 From 75b096bee2b846c897c7c4503f56779cb7869554 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 8 May 2018 02:07:51 +0900 Subject: [PATCH 0559/1389] Test JRuby --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c56f83790..a87a4577bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,3 @@ env: global: NOBENCHMARK=1 script: rake -matrix: - allow_failures: - - rvm: jruby-9.1.17.0 From 54f6e5bd5dd4e1d0687880d369ad54891be5b1ab Mon Sep 17 00:00:00 2001 From: Nathan Beyer Date: Thu, 22 Mar 2018 21:50:52 -0500 Subject: [PATCH 0560/1389] Add support for 'Raises' lines in TomDoc parser * For the special case of 'initialize', handle 'Raises' as the indicator of the Returns section. * Stop treating Raises lines as multine text and let them be their own paragraphs --- lib/rdoc/tom_doc.rb | 12 ++++++-- test/test_rdoc_tom_doc.rb | 60 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb index 2b594b7d84..625a6b5cfa 100644 --- a/lib/rdoc/tom_doc.rb +++ b/lib/rdoc/tom_doc.rb @@ -180,12 +180,19 @@ def build_paragraph margin case type when :TEXT then - @section = 'Returns' if data =~ /\AReturns/ + @section = 'Returns' if data =~ /\A(Returns|Raises)/ paragraph << data when :NEWLINE then if :TEXT == peek_token[0] then - paragraph << ' ' + # Lines beginning with 'Raises' in the Returns section should not be + # treated as multiline text + if 'Returns' == @section and + peek_token[1].start_with?('Raises') then + break + else + paragraph << ' ' + end else break end @@ -255,4 +262,3 @@ def tokenize text end end - diff --git a/test/test_rdoc_tom_doc.rb b/test/test_rdoc_tom_doc.rb index 6a6822d50d..27a3e6f178 100644 --- a/test/test_rdoc_tom_doc.rb +++ b/test/test_rdoc_tom_doc.rb @@ -301,6 +301,44 @@ def test_parse_returns assert_equal expected, @TD.parse(text) end + def test_parse_returns_with_raises + text = <<-TEXT +Do some stuff + +Returns a thing +Raises ArgumentError when stuff +Raises StandardError when stuff + TEXT + expected = + doc( + para('Do some stuff'), + blank_line, + head(3, 'Returns'), + blank_line, + para('Returns a thing'), + para('Raises ArgumentError when stuff'), + para('Raises StandardError when stuff')) + + assert_equal expected, @TD.parse(text) + end + + def test_parse_raises_without_returns + text = <<-TEXT +Do some stuff + +Raises ArgumentError when stuff + TEXT + expected = + doc( + para('Do some stuff'), + blank_line, + head(3, 'Returns'), + blank_line, + para('Raises ArgumentError when stuff')) + + assert_equal expected, @TD.parse(text) + end + def test_parse_returns_multiline text = <<-TEXT Do some stuff @@ -320,6 +358,27 @@ def test_parse_returns_multiline assert_equal expected, @TD.parse(text) end + def test_parse_returns_multiline_and_raises + text = <<-TEXT +Do some stuff + +Returns a thing + that is multiline +Raises ArgumentError + TEXT + + expected = + doc( + para('Do some stuff'), + blank_line, + head(3, 'Returns'), + blank_line, + para('Returns a thing', ' ', 'that is multiline'), + para('Raises ArgumentError')) + + assert_equal expected, @TD.parse(text) + end + def test_parse_signature text = <<-TEXT Do some stuff @@ -518,4 +577,3 @@ def test_tokenize_returns_multiline end end - From 31b2a7501d6594891fc94573995f70072e7b73d2 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 21 Jun 2018 04:51:43 +0900 Subject: [PATCH 0561/1389] Remove JRuby from tests JRuby sometimes invokes inexplicable errors. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index a87a4577bb..0c56f83790 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,6 @@ env: global: NOBENCHMARK=1 script: rake +matrix: + allow_failures: + - rvm: jruby-9.1.17.0 From 62e181a53a60ed2a7546c247d1665e0b1635c19d Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 21 Jun 2018 03:47:02 +0900 Subject: [PATCH 0562/1389] Link to a class method when using dot Some classes of standard library have the same name in class method and instance method. For example, Random::bytes and Random#bytes. In most cases of using dot in documents, it intends class method. --- lib/rdoc/cross_reference.rb | 34 +++++++++++++++++++++++-------- test/test_rdoc_cross_reference.rb | 9 ++++++++ test/test_rdoc_store.rb | 4 ++-- test/xref_data.rb | 12 +++++++++++ test/xref_test_case.rb | 8 ++++++++ 5 files changed, 57 insertions(+), 10 deletions(-) diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index d76ebaf2d0..c7b7f798b1 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -127,23 +127,41 @@ def resolve name, text if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then type = $2 - type = '' if type == '.' # will find either #method or ::method - method = "#{type}#{$3}" + if '.' == type # will find either #method or ::method + method = $3 + else + method = "#{type}#{$3}" + end container = @context.find_symbol_module($1) elsif /^([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then type = $1 - type = '' if type == '.' - method = "#{type}#{$2}" + if '.' == type + method = $2 + else + method = "#{type}#{$2}" + end container = @context else + type = nil container = nil end if container then - ref = container.find_local_symbol method - - unless ref || RDoc::TopLevel === container then - ref = container.find_ancestor_local_symbol method + unless RDoc::TopLevel === container then + if '.' == type then + if 'new' == method then # AnyClassName.new will be class method + ref = container.find_local_symbol method + ref = container.find_ancestor_local_symbol method unless ref + else + ref = container.find_local_symbol "::#{method}" + ref = container.find_ancestor_local_symbol "::#{method}" unless ref + ref = container.find_local_symbol "##{method}" unless ref + ref = container.find_ancestor_local_symbol "##{method}" unless ref + end + else + ref = container.find_local_symbol method + ref = container.find_ancestor_local_symbol method unless ref + end end end diff --git a/test/test_rdoc_cross_reference.rb b/test/test_rdoc_cross_reference.rb index a294553704..7a7035a605 100644 --- a/test/test_rdoc_cross_reference.rb +++ b/test/test_rdoc_cross_reference.rb @@ -139,6 +139,15 @@ def test_resolve_method assert_ref @c2_c3_m, '::C2::C3#m(*)' end + def test_resolve_the_same_name_in_instance_and_class_method + assert_ref @c9_a_i_foo, 'C9::A#foo' + assert_ref @c9_a_c_bar, 'C9::A::bar' + assert_ref @c9_b_c_foo, 'C9::B::foo' + assert_ref @c9_b_i_bar, 'C9::B#bar' + assert_ref @c9_b_c_foo, 'C9::B.foo' + assert_ref @c9_a_c_bar, 'C9::B.bar' + end + def test_resolve_method_equals3 m = RDoc::AnyMethod.new '', '===' @c1.add_method m diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index 4246b4cbbf..e5cf75203f 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -162,7 +162,7 @@ def test_add_file_relative def test_all_classes_and_modules expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B Child M1 M1::M2 Parent @@ -213,7 +213,7 @@ def test_class_path def test_classes expected = %w[ - C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 + C1 C2 C2::C3 C2::C3::H1 C3 C3::H1 C3::H2 C4 C4::C4 C5 C5::C1 C6 C7 C8 C8::S1 C9 C9::A C9::B Child Parent ] diff --git a/test/xref_data.rb b/test/xref_data.rb index d002b422f9..77380aa868 100644 --- a/test/xref_data.rb +++ b/test/xref_data.rb @@ -101,6 +101,18 @@ class S1 end end +class C9 + class A + def foo() end + def self.bar() end + end + + class B < A + def self.foo() end + def bar() end + end +end + module M1 def m end diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 70b7df4222..28b03e89cd 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -56,6 +56,14 @@ def generator.file_dir() nil end @c8 = @xref_data.find_module_named 'C8' @c8_s1 = @xref_data.find_module_named 'C8::S1' + @c9 = @xref_data.find_module_named 'C9' + @c9_a = @xref_data.find_module_named 'C9::A' + @c9_a_i_foo = @c9_a.method_list.first + @c9_a_c_bar = @c9_a.method_list.last + @c9_b = @xref_data.find_module_named 'C9::B' + @c9_b_c_foo = @c9_b.method_list.first + @c9_b_i_bar = @c9_b.method_list.last + @m1 = @xref_data.find_module_named 'M1' @m1_m = @m1.method_list.first From 802f5b2c226deefb083a5cf48cb18dc781787475 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 23 Jun 2018 14:31:33 +0900 Subject: [PATCH 0563/1389] Enable --line-numbers option The showing line numbers feature is implemented, but an ignition of the feature is not implemented. In this commit, RDoc::MethodAttr#markup_code uses options.line_numbers for the ignition. --- lib/rdoc/generator/markup.rb | 14 ++------------ test/test_rdoc_any_method.rb | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/lib/rdoc/generator/markup.rb b/lib/rdoc/generator/markup.rb index fef982d378..41e132450d 100644 --- a/lib/rdoc/generator/markup.rb +++ b/lib/rdoc/generator/markup.rb @@ -65,16 +65,6 @@ class RDoc::CodeObject class RDoc::MethodAttr - @add_line_numbers = false - - class << self - ## - # Allows controlling whether #markup_code adds line numbers to - # the source code. - - attr_accessor :add_line_numbers - end - ## # Prepend +src+ with line numbers. Relies on the first line of a source # code listing having: @@ -106,7 +96,7 @@ def add_line_numbers(src) ## # Turns the method's token stream into HTML. # - # Prepends line numbers if +add_line_numbers+ is true. + # Prepends line numbers if +options.line_numbers+ is true. def markup_code return '' unless @token_stream @@ -126,7 +116,7 @@ def markup_code end src.gsub!(/^#{' ' * indent}/, '') if indent > 0 - add_line_numbers(src) if RDoc::MethodAttr.add_line_numbers + add_line_numbers(src) if options.line_numbers src end diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index b5281f611d..b238bf3e4f 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -85,6 +85,33 @@ def test_markup_code assert_equal expected, @c2_a.markup_code end + def test_markup_code_with_line_numbers + position_comment = "# File #{@file_name}, line 1" + tokens = [ + { :line_no => 1, :char_no => 0, :kind => :on_comment, :text => position_comment }, + { :line_no => 1, :char_no => position_comment.size, :kind => :on_nl, :text => "\n" }, + { :line_no => 2, :char_no => 0, :kind => :on_const, :text => 'A' }, + { :line_no => 2, :char_no => 1, :kind => :on_nl, :text => "\n" }, + { :line_no => 3, :char_no => 0, :kind => :on_const, :text => 'B' } + ] + + @c2_a.collect_tokens + @c2_a.add_tokens(*tokens) + + assert_equal <<-EXPECTED.chomp, @c2_a.markup_code +# File xref_data.rb, line 1 +A +B + EXPECTED + + @options.line_numbers = true + assert_equal <<-EXPECTED.chomp, @c2_a.markup_code + # File xref_data.rb +1 A +2 B + EXPECTED + end + def test_markup_code_empty assert_equal '', @c2_a.markup_code end From ff2073f4ade75bea4f5ec3330bdbdbc5b37e30db Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 24 Jun 2018 00:34:00 +0900 Subject: [PATCH 0564/1389] Fix random NameError of RipperStateLex Because RDoc::RipperStatelex is loaded by RDoc::Parser, some tests that need RDoc::RipperStateLex fail when RDoc::Parser isn't autoloaded. That whether RDoc::RipperStateLex is loaded or not depends on RDoc::Parser is autoloaded. Therefore NameError of RDoc::RipperStateLex is occurred at random. This patch fixes it with that RDoc::RipperStateLex is moved to RDoc::Parser::RipperStateLex. --- lib/rdoc/markup/to_html.rb | 2 +- lib/rdoc/parser/ripper_state_lex.rb | 2 +- lib/rdoc/parser/ruby.rb | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index c5e1f073f8..79b13e1819 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -200,7 +200,7 @@ def accept_verbatim verbatim content = if verbatim.ruby? or parseable? text then begin - tokens = RDoc::RipperStateLex.parse text + tokens = RDoc::Parser::RipperStateLex.parse text klass = ' class="ruby"' result = RDoc::TokenStream.to_html tokens diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 43f7dc1e9b..e272d2f50f 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'ripper' -class RDoc::RipperStateLex +class RDoc::Parser::RipperStateLex # TODO: Remove this constants after Ruby 2.4 EOL RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index febdee3cb8..918e091210 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -179,7 +179,7 @@ def initialize(top_level, file_name, content, options, stats) @size = 0 @token_listeners = nil content = RDoc::Encoding.remove_magic_comment content - @scanner = RDoc::RipperStateLex.parse(content) + @scanner = RDoc::Parser::RipperStateLex.parse(content) @content = content @scanner_point = 0 @prev_seek = nil @@ -741,9 +741,9 @@ def parse_call_parameters(tk) when end_token if end_token == :on_rparen nest -= 1 - break if RDoc::RipperStateLex.end?(tk) and nest <= 0 + break if RDoc::Parser::RipperStateLex.end?(tk) and nest <= 0 else - break if RDoc::RipperStateLex.end?(tk) + break if RDoc::Parser::RipperStateLex.end?(tk) end when :on_comment, :on_embdoc unget_tk(tk) @@ -961,7 +961,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc: elsif (:on_kw == tk[:kind] && 'def' == tk[:text]) then nest += 1 elsif (:on_kw == tk[:kind] && %w{do if unless case begin}.include?(tk[:text])) then - if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 + if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0 nest += 1 end elsif [:on_rparen, :on_rbrace, :on_rbracket].include?(tk[:kind]) || @@ -969,7 +969,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc: nest -= 1 elsif (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) then unget_tk tk - if nest <= 0 and RDoc::RipperStateLex.end?(tk) then + if nest <= 0 and RDoc::Parser::RipperStateLex.end?(tk) then body = get_tkread_clean(/^[ \t]+/, '') read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS break @@ -985,7 +985,7 @@ def parse_constant_body container, constant, is_array_or_hash # :nodoc: break end elsif :on_nl == tk[:kind] then - if nest <= 0 and RDoc::RipperStateLex.end?(tk) then + if nest <= 0 and RDoc::Parser::RipperStateLex.end?(tk) then unget_tk tk break end @@ -1555,7 +1555,7 @@ def parse_method_or_yield_parameters(method = nil, when :on_comment, :on_embdoc then @read.pop if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and - (!continue or (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) != 0) then + (!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then if method && method.block_params.nil? then unget_tk tk read_documentation_modifiers method, modifiers @@ -1772,7 +1772,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, end when 'until', 'while' then - if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 + if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0 nest += 1 skip_optional_do_after_expression end @@ -1788,7 +1788,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, skip_optional_do_after_expression when 'case', 'do', 'if', 'unless', 'begin' then - if (tk[:state] & RDoc::RipperStateLex::EXPR_LABEL) == 0 + if (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) == 0 nest += 1 end From 9171f63bcb48aab34bdb72c980b60e1f05cf533f Mon Sep 17 00:00:00 2001 From: Nikita Misharin Date: Sat, 23 Jun 2018 19:21:53 +0300 Subject: [PATCH 0565/1389] Allow `#+` `#-` `#*` to be cross referenced --- lib/rdoc/cross_reference.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index c7b7f798b1..3f5f33ba42 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -19,7 +19,7 @@ class RDoc::CrossReference # # See CLASS_REGEXP_STR - METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?' + METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>|-|\+|\*)(?:\([\w.+*/=<>-]*\))?' ## # Regular expressions matching text that should potentially have From 0e655546b4d3f9d00982f12f87f968dd5b96103a Mon Sep 17 00:00:00 2001 From: Nikita Misharin Date: Sat, 23 Jun 2018 22:28:44 +0300 Subject: [PATCH 0566/1389] Add tests to cover + methods --- test/test_rdoc_any_method.rb | 4 ++-- test/test_rdoc_class_module.rb | 1 + test/test_rdoc_context.rb | 2 +- test/test_rdoc_cross_reference.rb | 20 +++++++++++++------- test/xref_data.rb | 2 ++ test/xref_test_case.rb | 7 ++++--- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/test/test_rdoc_any_method.rb b/test/test_rdoc_any_method.rb index b5281f611d..adac915aab 100644 --- a/test/test_rdoc_any_method.rb +++ b/test/test_rdoc_any_method.rb @@ -165,7 +165,7 @@ def test_marshal_load_aliased_method_with_nil_singleton end def test_marshal_load_class_method - class_method = Marshal.load Marshal.dump(@c1.method_list.first) + class_method = Marshal.load Marshal.dump(@c1.find_class_method_named 'm') assert_equal 'C1::m', class_method.full_name assert_equal 'C1', class_method.parent_name @@ -174,7 +174,7 @@ def test_marshal_load_class_method end def test_marshal_load_instance_method - instance_method = Marshal.load Marshal.dump(@c1.method_list.last) + instance_method = Marshal.load Marshal.dump(@c1.find_instance_method_named 'm') assert_equal 'C1#m', instance_method.full_name assert_equal 'C1', instance_method.parent_name diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 3dc2a42cf4..cc53a13528 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -91,6 +91,7 @@ def test_docuent_self_or_methods assert @c1.document_self_or_methods + @c1_plus.document_self = false @c1_m.document_self = false assert @c1.document_self_or_methods diff --git a/test/test_rdoc_context.rb b/test/test_rdoc_context.rb index 5a9c5db39e..be17496f40 100644 --- a/test/test_rdoc_context.rb +++ b/test/test_rdoc_context.rb @@ -660,7 +660,7 @@ def test_methods_by_type 'instance' => { :private => [], :protected => [], - :public => [@c1_m], + :public => [@c1_plus, @c1_m], }, 'class' => { :private => [], diff --git a/test/test_rdoc_cross_reference.rb b/test/test_rdoc_cross_reference.rb index 7a7035a605..8233fe3f61 100644 --- a/test/test_rdoc_cross_reference.rb +++ b/test/test_rdoc_cross_reference.rb @@ -107,18 +107,24 @@ def test_resolve_file end def test_resolve_method - assert_ref @c1__m, 'm' - assert_ref @c1_m, '#m' - assert_ref @c1__m, '::m' - - assert_ref @c1_m, 'C1#m' - assert_ref @c1__m, 'C1.m' - assert_ref @c1__m, 'C1::m' + assert_ref @c1__m, 'm' + assert_ref @c1__m, '::m' + assert_ref @c1_m, '#m' + assert_ref @c1_plus, '#+' + + assert_ref @c1_m, 'C1#m' + assert_ref @c1_plus, 'C1#+' + assert_ref @c1__m, 'C1.m' + assert_ref @c1__m, 'C1::m' assert_ref @c1_m, 'C1#m' assert_ref @c1_m, 'C1#m()' assert_ref @c1_m, 'C1#m(*)' + assert_ref @c1_plus, 'C1#+' + assert_ref @c1_plus, 'C1#+()' + assert_ref @c1_plus, 'C1#+(*)' + assert_ref @c1__m, 'C1.m' assert_ref @c1__m, 'C1.m()' assert_ref @c1__m, 'C1.m(*)' diff --git a/test/xref_data.rb b/test/xref_data.rb index 77380aa868..aa9faaecd9 100644 --- a/test/xref_data.rb +++ b/test/xref_data.rb @@ -20,6 +20,8 @@ def self.m def m foo end + def + + end end class C2 diff --git a/test/xref_test_case.rb b/test/xref_test_case.rb index 28b03e89cd..d42cf398e7 100644 --- a/test/xref_test_case.rb +++ b/test/xref_test_case.rb @@ -31,9 +31,10 @@ def generator.file_dir() nil end @rdoc.options = @options @rdoc.generator = generator - @c1 = @xref_data.find_module_named 'C1' - @c1_m = @c1.method_list.last # C1#m - @c1__m = @c1.method_list.first # C1::m + @c1 = @xref_data.find_module_named 'C1' + @c1__m = @c1.find_class_method_named 'm' # C1::m + @c1_m = @c1.find_instance_method_named 'm' # C1#m + @c1_plus = @c1.find_instance_method_named '+' @c2 = @xref_data.find_module_named 'C2' @c2_a = @c2.method_list.last From 7bc46d4505c8f1068c3d04dc1cf24a05958e14a4 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 24 Jun 2018 05:23:36 +0900 Subject: [PATCH 0567/1389] Use original method notation At 297cd5a2, method names are replaced with normalized text. But the feature has critical problems: 1) Some methods are replaced with parents class receiver For example, the document of BasicSocket describes #read_nonblock for inheritance, but it's replaced with IO#read_nonblock. This behavior confuses users. 2) Arguments are removed For example, the document of Time describes like below: Time.utc(99) means the year 99 AD, not 1999 AD. But it's replaced with: Time.utc means the year 99 AD, not 1999 AD. This behavior clearly is a bug. This patch removes the normalization logic. --- lib/rdoc/markup/to_html_crossref.rb | 3 --- test/test_rdoc_markup_to_html_crossref.rb | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 2911aee954..cc93021540 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -135,9 +135,6 @@ def link name, text ref = @cross_reference.resolve name, text - text = ref.output_name @context if - RDoc::MethodAttr === ref and text == original_name - case ref when String then ref diff --git a/test/test_rdoc_markup_to_html_crossref.rb b/test/test_rdoc_markup_to_html_crossref.rb index 73b76de4d9..63fc95ff51 100644 --- a/test/test_rdoc_markup_to_html_crossref.rb +++ b/test/test_rdoc_markup_to_html_crossref.rb @@ -59,7 +59,7 @@ def test_convert_RDOCLINK_rdoc_ref def test_convert_RDOCLINK_rdoc_ref_method result = @to.convert 'rdoc-ref:C1#m' - assert_equal para("#m"), result + assert_equal para("C1#m"), result end def test_convert_RDOCLINK_rdoc_ref_method_label @@ -75,13 +75,13 @@ def test_convert_RDOCLINK_rdoc_ref_method_percent result = @to.convert 'rdoc-ref:C1#%' - assert_equal para("#%"), result + assert_equal para("C1#%"), result m.singleton = true result = @to.convert 'rdoc-ref:C1::%' - assert_equal para("::%"), result + assert_equal para("C1::%"), result end def test_convert_RDOCLINK_rdoc_ref_method_percent_label @@ -200,11 +200,16 @@ def test_to_html_CROSSREF_email_hyperlink_all def test_link assert_equal 'n', @to.link('n', 'n') - assert_equal '::m', @to.link('m', 'm') + assert_equal 'm', @to.link('m', 'm') + end + + def test_link_for_method_traverse + @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c9 + assert_equal 'C9::B#foo', @to.link('C9::B#foo', 'C9::B#foo') end def test_link_class_method_full - assert_equal 'Parent.m', + assert_equal 'Parent::m', @to.link('Parent::m', 'Parent::m') end From d34c43be7e0fdba95a63e02299571ab6ef42ce92 Mon Sep 17 00:00:00 2001 From: masakazutakewaka Date: Wed, 27 Jun 2018 00:28:32 +0900 Subject: [PATCH 0568/1389] add test to display_name --- test/test_rdoc_ri_driver.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 590c10906d..ddd0904021 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -699,6 +699,12 @@ def test_display_method_overridden refute_match %r%must not be displayed%, out end + def test_display_name + util_store + + assert_equal true, @driver.display_name('home:README.rdoc') + end + def test_display_name_not_found_class util_store From 53cb21ff1bf978da09ca1e3ad66d130827d37394 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 29 Jun 2018 06:16:28 +0900 Subject: [PATCH 0569/1389] Treat "if" with EXPR_MID as postfix "if" The "return" without argument comes with EXPR_MID. So the "if" below should be treated as postfix "if": return if true --- lib/rdoc/parser/ripper_state_lex.rb | 2 +- test/test_rdoc_parser_ruby.rb | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index e272d2f50f..b8cfeeaf03 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -114,7 +114,7 @@ def on_kw(tok, data) @continue = true @in_fname = true when 'if', 'unless', 'while', 'until' - if ((EXPR_END | EXPR_ENDARG | EXPR_ENDFN | EXPR_ARG | EXPR_CMDARG) & @lex_state) != 0 # postfix if + if ((EXPR_MID | EXPR_END | EXPR_ENDARG | EXPR_ENDFN | EXPR_ARG | EXPR_CMDARG) & @lex_state) != 0 # postfix if @lex_state = EXPR_BEG | EXPR_LABEL else @lex_state = EXPR_BEG diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 76bdcf546a..fb147c16cb 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2310,6 +2310,31 @@ def bar assert_equal 'C#bar', methods[1].full_name end + def test_parse_statements_postfix_if_unless_with_expr_mid + util_parser <<-CODE +class A + class B + def foo + return if nil + end + end + + class C + end +end + CODE + + @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil + + a = @top_level.classes.first + assert_equal 'A', a.full_name, 'class A' + assert_equal 2, a.classes.length + b = a.classes[0] + assert_equal 'A::B', b.full_name, 'class A::B' + c = a.classes[1] + assert_equal 'A::C', c.full_name, 'class A::C' + end + def test_parse_statements_class_nested comment = RDoc::Comment.new "##\n# my method\n", @top_level From 7655e653e99647bbd50a3530061315ba22f94615 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 10 Jul 2018 21:34:47 +0900 Subject: [PATCH 0570/1389] Behavior of "include" or "extend" as a method In RDoc, "include" or "extend" can receive only constant. But those sometimes receive dynamic value through complex statements. This commit fixes it. --- lib/rdoc/parser/ruby.rb | 85 +++++++++++++++---- test/test_rdoc_parser_ruby.rb | 151 ++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+), 15 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 918e091210..dae5c24adf 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -446,28 +446,83 @@ def get_constant end ## - # Get a constant that may be surrounded by parens + # Get an included module that may be surrounded by parens - def get_constant_with_optional_parens + def get_included_module_with_optional_parens skip_tkspace false + get_tkread + tk = get_tk + end_token = get_end_token tk + return '' unless end_token nest = 0 + continue = false + only_constant = true - while :on_lparen == (tk = peek_tk)[:kind] do - get_tk - skip_tkspace - nest += 1 - end - - name = get_constant - - while nest > 0 - skip_tkspace + while tk != nil do + is_element_of_constant = false + case tk[:kind] + when :on_semicolon then + break if nest == 0 + when :on_lbracket then + nest += 1 + when :on_rbracket then + nest -= 1 + when :on_lbrace then + nest += 1 + when :on_rbrace then + nest -= 1 + if nest <= 0 + # we might have a.each { |i| yield i } + unget_tk(tk) if nest < 0 + break + end + when :on_lparen then + nest += 1 + when end_token[:kind] then + if end_token[:kind] == :on_rparen + nest -= 1 + break if nest <= 0 + else + break if nest <= 0 + end + when :on_rparen then + nest -= 1 + when :on_comment, :on_embdoc then + @read.pop + if :on_nl == end_token[:kind] and "\n" == tk[:text][-1] and + (!continue or (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0) then + break if !continue and nest <= 0 + end + when :on_comma then + continue = true + when :on_ident then + continue = false if continue + when :on_kw then + case tk[:text] + when 'def', 'do', 'case', 'for', 'begin', 'class', 'module' + nest += 1 + when 'if', 'unless', 'while', 'until', 'rescue' + # postfix if/unless/while/until/rescue must be EXPR_LABEL + nest += 1 unless (tk[:state] & RDoc::Parser::RipperStateLex::EXPR_LABEL) != 0 + when 'end' + nest -= 1 + break if nest == 0 + end + when :on_const then + is_element_of_constant = true + when :on_op then + is_element_of_constant = true if '::' == tk[:text] + end + only_constant = false unless is_element_of_constant tk = get_tk - nest -= 1 if :on_rparen == tk[:kind] end - name + if only_constant + get_tkread_clean(/\s+/, ' ') + else + '' + end end ## @@ -1119,7 +1174,7 @@ def parse_extend_or_include klass, container, comment # :nodoc: loop do skip_tkspace_comment - name = get_constant_with_optional_parens + name = get_included_module_with_optional_parens unless name.empty? then obj = container.add klass, name, comment diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index fb147c16cb..562b4a7092 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -4044,4 +4044,155 @@ class Defined assert_equal ['A', 'B', 'B::C'], visible end + def test_parse_include_by_dynamic_definition + util_parser <<-CLASS +module A + class B + include(Module.new do + def e(m) + end + end) + end + + class C + end + + class D + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_class_named 'B' + assert_equal 'A::B', a_b.full_name + a_c = a.find_class_named 'C' + assert_equal 'A::C', a_c.full_name + a_d = a.find_class_named 'D' + assert_equal 'A::D', a_d.full_name + end + + def test_parse_include_by_dynamic_definition_without_paren + util_parser <<-CLASS +module A + class B + include(Module.new do + def e m + end + end) + end + + class C + end + + class D + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_class_named 'B' + assert_equal 'A::B', a_b.full_name + a_c = a.find_class_named 'C' + assert_equal 'A::C', a_c.full_name + a_d = a.find_class_named 'D' + assert_equal 'A::D', a_d.full_name + end + + def test_parse_include_by_dynamic_definition_via_variable + util_parser <<-CLASS +module A + class B + m = Module.new do + def e(m) + end + end + include m + end + + class C + end + + class D + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_class_named 'B' + assert_equal 'A::B', a_b.full_name + a_c = a.find_class_named 'C' + assert_equal 'A::C', a_c.full_name + a_d = a.find_class_named 'D' + assert_equal 'A::D', a_d.full_name + end + + def test_parse_include_by_dynamic_definition_with_brace + util_parser <<-CLASS +module A + class B + extend(e { + def f(g) + end + }) + end + + class C + end + + class D + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_class_named 'B' + assert_equal 'A::B', a_b.full_name + a_c = a.find_class_named 'C' + assert_equal 'A::C', a_c.full_name + a_d = a.find_class_named 'D' + assert_equal 'A::D', a_d.full_name + end + + def test_parse_include_by_dynamic_definition_directly + util_parser <<-CLASS +module A + class B + include Module.new do + def e m + end + end + end + + class C + end + + class D + end +end + CLASS + + @parser.scan + + a = @store.find_module_named 'A' + assert_equal 'A', a.full_name + a_b = a.find_class_named 'B' + assert_equal 'A::B', a_b.full_name + a_c = a.find_class_named 'C' + assert_equal 'A::C', a_c.full_name + a_d = a.find_class_named 'D' + assert_equal 'A::D', a_d.full_name + end + end From ba1ed9e8ca35aede2cacf6fee9ca1cc264c90df9 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 12 Jul 2018 09:38:50 +0900 Subject: [PATCH 0571/1389] Coordinate test_parse_comment_method with other test methods --- test/test_rdoc_parser_ruby.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 562b4a7092..8e31141f59 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -1313,8 +1313,16 @@ def test_parse_comment_method { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" }, { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => '' } ] + parsed_stream = foo.token_stream.map { |t| + { + :line_no => t[:line_no], + :char_no => t[:char_no], + :kind => t[:kind], + :text => t[:text] + } + } - assert_equal stream, foo.token_stream + assert_equal stream, parsed_stream end def test_parse_comment_method_args From 1ee1954d1a61c1fc22e465abf2f5b08c19bbb93d Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 12 Jul 2018 13:11:57 +0900 Subject: [PATCH 0572/1389] Use Struct for each token This replaces Hash with Struct for each token. For your information, Struct#[] and Struct#[]= provides the same behavior of Hash. --- lib/rdoc/parser/ripper_state_lex.rb | 100 ++++++++++------------------ lib/rdoc/parser/ruby.rb | 40 +++++------ 2 files changed, 56 insertions(+), 84 deletions(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index b8cfeeaf03..773a830450 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -5,6 +5,8 @@ class RDoc::Parser::RipperStateLex # TODO: Remove this constants after Ruby 2.4 EOL RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state) + Token = Struct.new(:line_no, :char_no, :kind, :text, :state) + EXPR_NONE = 0 EXPR_BEG = 1 EXPR_END = 2 @@ -48,7 +50,7 @@ def on_nl(tok, data) @continue = false @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 end - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_ignored_nl(tok, data) @@ -59,7 +61,7 @@ def on_ignored_nl(tok, data) @continue = false @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 end - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_op(tok, data) @@ -101,7 +103,7 @@ def on_op(tok, data) @lex_state = EXPR_BEG end end - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_kw(tok, data) @@ -130,54 +132,54 @@ def on_kw(tok, data) @lex_state = EXPR_END end end - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_tstring_beg(tok, data) @lex_state = EXPR_BEG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_tstring_end(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_CHAR(tok, data) @lex_state = EXPR_END - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_period(tok, data) @lex_state = EXPR_DOT - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_int(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_float(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_rational(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_imaginary(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_symbeg(tok, data) @lex_state = EXPR_FNAME @continue = true @in_fname = true - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end private def on_variables(event, tok, data) @@ -196,7 +198,7 @@ def on_symbeg(tok, data) else @lex_state = EXPR_CMDARG end - @callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, event, tok, @lex_state)) end def on_ident(tok, data) @@ -225,32 +227,32 @@ def on_backref(tok, data) def on_lparen(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_rparen(tok, data) @lex_state = EXPR_ENDFN - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_lbrace(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_rbrace(tok, data) @lex_state = EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_lbracket(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_rbracket(tok, data) @lex_state = EXPR_ENDARG - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_const(tok, data) @@ -262,36 +264,36 @@ def on_const(tok, data) else @lex_state = EXPR_CMDARG end - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_sp(tok, data) - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_comma(tok, data) @lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0 - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_comment(tok, data) @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_ignored_sp(tok, data) @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) end def on_heredoc_end(tok, data) - @callback.call({ :line_no => lineno, :char_no => column, :kind => __method__, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) @lex_state = EXPR_BEG end def on_default(event, tok, data) reset - @callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => @lex_state}) + @callback.call(Token.new(lineno, column, event, tok, @lex_state)) end def each(&block) @@ -306,7 +308,7 @@ def initialize(code) end def on_default(event, tok, data) - @callback.call({ :line_no => lineno, :char_no => column, :kind => event, :text => tok, :state => state}) + @callback.call(Token.new(lineno, column, event, tok, state)) end def each(&block) @@ -367,7 +369,7 @@ def get_squashed_tk private def get_symbol_tk(tk) is_symbol = true - symbol_tk = { :line_no => tk[:line_no], :char_no => tk[:char_no], :kind => :on_symbol } + symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol) if ":'" == tk[:text] or ':"' == tk[:text] tk1 = get_string_tk(tk) symbol_tk[:text] = tk1[:text] @@ -436,13 +438,7 @@ def get_squashed_tk end end end - { - :line_no => tk[:line_no], - :char_no => tk[:char_no], - :kind => kind, - :text => string, - :state => state - } + Token.new(tk.line_no, tk.char_no, kind, string, state) end private def get_regexp_tk(tk) @@ -460,13 +456,7 @@ def get_squashed_tk string = string + inner_str_tk[:text] end end - { - :line_no => tk[:line_no], - :char_no => tk[:char_no], - :kind => :on_regexp, - :text => string, - :state => state - } + Token.new(tk.line_no, tk.char_no, :on_regexp, string, state) end private def get_embdoc_tk(tk) @@ -475,13 +465,7 @@ def get_squashed_tk string = string + embdoc_tk[:text] end string = string + embdoc_tk[:text] - { - :line_no => tk[:line_no], - :char_no => tk[:char_no], - :kind => :on_embdoc, - :text => string, - :state => embdoc_tk[:state] - } + Token.new(tk.line_no, tk.char_no, :on_embdoc, string, embdoc_tk.state) end private def get_heredoc_tk(heredoc_name, indent) @@ -499,13 +483,7 @@ def get_squashed_tk start_tk = tk unless start_tk prev_tk = tk unless prev_tk @buf.unshift tk # closing heredoc - heredoc_tk = { - :line_no => start_tk[:line_no], - :char_no => start_tk[:char_no], - :kind => :on_heredoc, - :text => string, - :state => prev_tk[:state] - } + heredoc_tk = Token.new(start_tk.line_no, start_tk.char_no, :on_heredoc, string, prev_tk.state) @buf.unshift heredoc_tk end @@ -561,13 +539,7 @@ def get_squashed_tk end end text = "#{start_token}#{string}#{end_token}" - { - :line_no => line_no, - :char_no => char_no, - :kind => :on_dstring, - :text => text, - :state => state - } + Token.new(line_no, char_no, :on_dstring, text, state) end private def get_op_tk(tk) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index dae5c24adf..3fc14fa519 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -536,17 +536,17 @@ def get_included_module_with_optional_parens def get_end_token tk # :nodoc: case tk[:kind] when :on_lparen - { - :kind => :on_rparen, - :text => ')' - } + token = RDoc::Parser::RipperStateLex::Token.new + token[:kind] = :on_rparen + token[:text] = ')' + token when :on_rparen nil else - { - :kind => :on_nl, - :text => "\n" - } + token = RDoc::Parser::RipperStateLex::Token.new + token[:kind] = :on_nl + token[:text] = "\n" + token end end @@ -1104,10 +1104,10 @@ def parse_comment_ghost container, text, name, column, line_no, # :nodoc: record_location meth meth.start_collecting_tokens - indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column } - position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment } + indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column) + position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment) position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}" - newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" } + newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n") meth.add_tokens [position_comment, newline, indent] meth.params = @@ -1147,10 +1147,10 @@ def parse_comment_tomdoc container, tk, comment meth.line = line_no meth.start_collecting_tokens - indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column } - position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment } + indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column) + position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment) position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}" - newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" } + newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n") meth.add_tokens [position_comment, newline, indent] meth.call_seq = signature @@ -1315,10 +1315,10 @@ def parse_meta_method(container, single, tk, comment) remove_token_listener self meth.start_collecting_tokens - indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column } - position_comment = { :line_no => line_no, :char_no => 1, :kind => :on_comment } + indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column) + position_comment = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment) position_comment[:text] = "# File #{@top_level.relative_name}, line #{line_no}" - newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" } + newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n") meth.add_tokens [position_comment, newline, indent] meth.add_tokens @token_stream @@ -1418,10 +1418,10 @@ def parse_method(container, single, tk, comment) meth.line = line_no meth.start_collecting_tokens - indent = { :line_no => 1, :char_no => 1, :kind => :on_sp, :text => ' ' * column } - token = { :line_no => line_no, :char_no => 1, :kind => :on_comment } + indent = RDoc::Parser::RipperStateLex::Token.new(1, 1, :on_sp, ' ' * column) + token = RDoc::Parser::RipperStateLex::Token.new(line_no, 1, :on_comment) token[:text] = "# File #{@top_level.relative_name}, line #{line_no}" - newline = { :line_no => 0, :char_no => 0, :kind => :on_nl, :text => "\n" } + newline = RDoc::Parser::RipperStateLex::Token.new(0, 0, :on_nl, "\n") meth.add_tokens [token, newline, indent] meth.add_tokens @token_stream From 82ca1d1d8e70cd52de999cb96884b31da186989c Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 15 Jul 2018 09:26:43 +0900 Subject: [PATCH 0573/1389] Add bracket correspondence for nesting to parse_method_or_yield_parameters --- lib/rdoc/parser/ruby.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index dae5c24adf..0d31fca4e4 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1587,6 +1587,10 @@ def parse_method_or_yield_parameters(method = nil, case tk[:kind] when :on_semicolon then break if nest == 0 + when :on_lbracket then + nest += 1 + when :on_rbracket then + nest -= 1 when :on_lbrace then nest += 1 when :on_rbrace then From 0b39ccac5b9a76f92cf0f387e45aa80e50be7ea3 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 18 Jul 2018 20:15:10 +0900 Subject: [PATCH 0574/1389] Remove ancestors from a method chain of checking include module I used Stackprof for this optimization of CRuby documents generation with a patch below. --- a/exe/rdoc +++ b/exe/rdoc @@ -16,8 +16,11 @@ end require 'rdoc/rdoc' begin - r = RDoc::RDoc.new - r.document ARGV + require 'stackprof' + StackProf.run(mode: :cpu, out: 'stackprof.dump') do + r = RDoc::RDoc.new + r.document ARGV + end rescue Errno::ENOSPC $stderr.puts 'Ran out of space creating documentation' $stderr.puts Before this commit, RDoc::TopLevel#text? uses processing time about 19.3%. ~/rdoc$ stackprof stackprof.dump --text --limit 5 ================================== Mode: cpu(1000) Samples: 54814 (0.47% miss rate) GC: 9022 (16.46%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 10579 (19.3%) 10579 (19.3%) RDoc::TopLevel#text? 9022 (16.5%) 9022 (16.5%) (garbage collection) 21611 (39.4%) 2503 (4.6%) RDoc::Generator::Darkfish#generate_class 3151 (5.7%) 1482 (2.7%) Ripper::Lexer#lex 1271 (2.3%) 1271 (2.3%) Ripper::Lexer::State#initialize After this commit, processing time of RDoc::TopLevel#text? is reduced to 6.8%. ~/rdoc$ stackprof stackprof.dump --text --limit 5 ================================== Mode: cpu(1000) Samples: 42712 (0.47% miss rate) GC: 6066 (14.20%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 6066 (14.2%) 6066 (14.2%) (garbage collection) 2892 (6.8%) 2892 (6.8%) RDoc::TopLevel#text? 14059 (32.9%) 2379 (5.6%) RDoc::Generator::Darkfish#generate_class 3015 (7.1%) 1389 (3.3%) Ripper::Lexer#lex 1265 (3.0%) 1265 (3.0%) Ripper::Lexer::State#initialize Therefore, this commit speeds up RDoc by 9.9%. --- lib/rdoc/top_level.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb index 6186722772..b8d4506ec8 100644 --- a/lib/rdoc/top_level.rb +++ b/lib/rdoc/top_level.rb @@ -272,7 +272,7 @@ def search_record # Is this TopLevel from a text file instead of a source code file? def text? - @parser and @parser.ancestors.include? RDoc::Parser::Text + @parser and @parser.include? RDoc::Parser::Text end def to_s # :nodoc: From 818ee979e02151885b4ae769b9f87b8f6b5f1802 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 18 Jul 2018 21:03:03 +0900 Subject: [PATCH 0575/1389] Generate text file only table I'm using Stackprof for a performance check of CRuby documents generation. Before this commit, RDoc::TopLevel#text? uses processing time about 6.8%. ~/rdoc$ stackprof stackprof.dump --text --limit 5 ================================== Mode: cpu(1000) Samples: 42712 (0.47% miss rate) GC: 6066 (14.20%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 6066 (14.2%) 6066 (14.2%) (garbage collection) 2892 (6.8%) 2892 (6.8%) RDoc::TopLevel#text? 14059 (32.9%) 2379 (5.6%) RDoc::Generator::Darkfish#generate_class 3015 (7.1%) 1389 (3.3%) Ripper::Lexer#lex 1265 (3.0%) 1265 (3.0%) Ripper::Lexer::State#initialize After this commit, processing time of RDoc::TopLevel#text? is reduced to 0.1%. ~/rdoc$ stackprof stackprof.dump --method 'RDoc::TopLevel#text?' RDoc::TopLevel#text? (/home/aycabta/rdoc/lib/rdoc/top_level.rb:274) samples: 20 self (0.1%) / 20 total (0.1%) callers: 17 ( 85.0%) RDoc::Generator::Darkfish#generate_page 2 ( 10.0%) RDoc::Store#add_file 1 ( 5.0%) RDoc::Store#complete --- lib/rdoc/rdoc.rb | 2 +- lib/rdoc/store.rb | 20 +++++++++++++++----- lib/rdoc/top_level.rb | 8 +++++++- test/test_rdoc_cross_reference.rb | 3 +-- test/test_rdoc_servlet.rb | 3 +-- test/test_rdoc_store.rb | 11 ++++------- 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index 31a92b3bec..ca2c1abefd 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -355,7 +355,7 @@ def parse_file filename relative_path.relative_path_from @options.page_dir end - top_level = @store.add_file filename, relative_path.to_s + top_level = @store.add_file filename, relative_name: relative_path.to_s parser = RDoc::Parser.for top_level, filename, content, @options, @stats diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index b7e677abf9..f420fc2bd2 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -148,6 +148,7 @@ def initialize path = nil, type = nil @classes_hash = {} @modules_hash = {} @files_hash = {} + @text_files_hash = {} @c_enclosure_classes = {} @c_enclosure_names = {} @@ -184,16 +185,24 @@ def add_c_variables c_parser # Adds the file with +name+ as an RDoc::TopLevel to the store. Returns the # created RDoc::TopLevel. - def add_file absolute_name, relative_name = absolute_name + def add_file absolute_name, relative_name: absolute_name, parser: nil unless top_level = @files_hash[relative_name] then top_level = RDoc::TopLevel.new absolute_name, relative_name + top_level.parser = parser if parser top_level.store = self @files_hash[relative_name] = top_level + @text_files_hash[relative_name] = top_level if top_level.text? end top_level end + def update_parser_of_file(absolute_name, parser) + if top_level = @files_hash[absolute_name] then + @text_files_hash[absolute_name] = top_level if top_level.text? + end + end + ## # Returns all classes discovered by RDoc @@ -428,8 +437,8 @@ def find_module_named name # +file_name+ def find_text_page file_name - @files_hash.each_value.find do |file| - file.text? and file.full_name == file_name + @text_files_hash.each_value.find do |file| + file.full_name == file_name end end @@ -537,6 +546,7 @@ def load_all @cache[:pages].each do |page_name| page = load_page page_name @files_hash[page_name] = page + @text_files_hash[page_name] = page if page.text? end end @@ -712,8 +722,8 @@ def modules_hash # Returns the RDoc::TopLevel that is a text file and has the given +name+ def page name - @files_hash.each_value.find do |file| - file.text? and file.page_name == name + @text_files_hash.each_value.find do |file| + file.page_name == name end end diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb index b8d4506ec8..b8b6110bb2 100644 --- a/lib/rdoc/top_level.rb +++ b/lib/rdoc/top_level.rb @@ -33,7 +33,7 @@ class RDoc::TopLevel < RDoc::Context ## # The parser class that processed this file - attr_accessor :parser + attr_reader :parser ## # Creates a new TopLevel for the file at +absolute_name+. If documentation @@ -52,6 +52,12 @@ def initialize absolute_name, relative_name = absolute_name @classes_or_modules = [] end + def parser=(val) + @parser = val + @store.update_parser_of_file(absolute_name, val) if @store + @parser + end + ## # An RDoc::TopLevel is equal to another with the same relative_name diff --git a/test/test_rdoc_cross_reference.rb b/test/test_rdoc_cross_reference.rb index 8233fe3f61..183de0930d 100644 --- a/test/test_rdoc_cross_reference.rb +++ b/test/test_rdoc_cross_reference.rb @@ -162,8 +162,7 @@ def test_resolve_method_equals3 end def test_resolve_page - page = @store.add_file 'README.txt' - page.parser = RDoc::Parser::Simple + page = @store.add_file 'README.txt', parser: RDoc::Parser::Simple assert_ref page, 'README' end diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index c0c0869293..0a197a31b6 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -224,8 +224,7 @@ def test_documentation_page_page generator = @s.generator_for store - readme = store.add_file 'README.rdoc' - readme.parser = RDoc::Parser::Simple + readme = store.add_file 'README.rdoc', parser: RDoc::Parser::Simple @s.documentation_page store, generator, 'README_rdoc.html', @req, @res diff --git a/test/test_rdoc_store.rb b/test/test_rdoc_store.rb index e5cf75203f..5a884c0b5f 100644 --- a/test/test_rdoc_store.rb +++ b/test/test_rdoc_store.rb @@ -14,8 +14,7 @@ def setup @top_level = @s.add_file 'file.rb' - @page = @s.add_file 'README.txt' - @page.parser = RDoc::Parser::Simple + @page = @s.add_file 'README.txt', parser: RDoc::Parser::Simple @page.comment = RDoc::Comment.new 'This is a page', @page @klass = @top_level.add_class RDoc::NormalClass, 'Object' @@ -146,7 +145,7 @@ def test_add_file end def test_add_file_relative - top_level = @store.add_file 'path/file.rb', 'file.rb' + top_level = @store.add_file 'path/file.rb', relative_name: 'file.rb' assert_kind_of RDoc::TopLevel, top_level assert_equal @store, top_level.store @@ -310,8 +309,7 @@ def test_find_module_named end def test_find_text_page - page = @store.add_file 'PAGE.txt' - page.parser = RDoc::Parser::Simple + page = @store.add_file 'PAGE.txt', parser: RDoc::Parser::Simple assert_nil @store.find_text_page 'no such page' @@ -601,8 +599,7 @@ def test_module_names end def test_page - page = @store.add_file 'PAGE.txt' - page.parser = RDoc::Parser::Simple + page = @store.add_file 'PAGE.txt', parser: RDoc::Parser::Simple assert_nil @store.page 'no such page' From 0c146114c9935d0fe14b7dbc7bbf1542d2b90174 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 20 Jul 2018 23:06:48 +0900 Subject: [PATCH 0576/1389] Disable wrap processing in paragraph I'm using Stackprof for a performance check of Rails documents generation. Before this commit, RDoc::Text#wrap uses processing time about 12.7%. ~/rdoc$ stackprof stackprof-rails.dump --text --limit 3: ================================== Mode: cpu(1000) Samples: 94637 (1.54% miss rate) GC: 18742 (19.80%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 18742 (19.8%) 18742 (19.8%) (garbage collection) 12022 (12.7%) 12022 (12.7%) RDoc::Text#wrap 17468 (18.5%) 6836 (7.2%) RDoc::Generator::Darkfish#generate_class After this commit, processing time of RDoc::Text#wrap is reduced to 0.0%. $ stackprof stackprof-rails.dump --method 'RDoc::Text#wrap' RDoc::Text#wrap (/home/aycabta/rdoc/lib/rdoc/text.rb:269) samples: 9 self (0.0%) / 9 total (0.0%) callers: The wrap processing is just for readability of HTML, but it's too heavy and unnecessary in the present day. --- lib/rdoc/markup/to_html.rb | 2 +- lib/rdoc/markup/to_html_snippet.rb | 2 +- test/test_rdoc_markup_to_html.rb | 2 +- test/test_rdoc_markup_to_html_snippet.rb | 6 ++---- test/test_rdoc_text.rb | 3 +-- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 79b13e1819..63cca98de7 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -186,7 +186,7 @@ def accept_paragraph paragraph @res << "\n

" text = paragraph.text @hard_break text = text.gsub(/\r?\n/, ' ') - @res << wrap(to_html(text)) + @res << to_html(text) @res << "

\n" end diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb index 24aa1d32d9..0cb4ffe4a4 100644 --- a/lib/rdoc/markup/to_html_snippet.rb +++ b/lib/rdoc/markup/to_html_snippet.rb @@ -71,7 +71,7 @@ def accept_paragraph paragraph text = paragraph.text @hard_break - @res << "#{para}#{wrap to_html text}\n" + @res << "#{para}#{to_html text}\n" add_paragraph end diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index 59889dcc5a..421c5edbc3 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -395,7 +395,7 @@ def test_accept_paragraph_newline @to.accept_paragraph para("hello\n", "world\n") - assert_equal "\n

hello world

\n", @to.res.join + assert_equal "\n

hello world

\n", @to.res.join end def test_accept_heading_output_decoration diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index 98102ba553..ad03747c89 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -458,8 +458,7 @@ def test_convert_limit expected = <<-EXPECTED

Hello -

This is some text, it will be cut off after 100 characters -and an ellipsis must follow +

This is some text, it will be cut off after 100 characters and an ellipsis must follow

So there you #{@ellipsis} EXPECTED @@ -563,8 +562,7 @@ def test_convert_limit_verbatim_2 RDOC expected = <<-EXPECTED -

Extracts the class, selector and method name parts from name -like Foo::Bar#baz. +

Extracts the class, selector and method name parts from name like Foo::Bar#baz.

NOTE: Given Foo::Bar, #{@ellipsis} EXPECTED diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 61f528a5a4..2669766e71 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -259,8 +259,7 @@ def test_snippet TEXT expected = <<-EXPECTED -

This is one-hundred characters or more of text in a single paragraph. This -paragraph will be cut off … +

This is one-hundred characters or more of text in a single paragraph. This paragraph will be cut off … EXPECTED assert_equal expected, snippet(text) From 769cfce9fc0fcaae6bbddc6a9f37034c51492583 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 20 Jul 2018 23:15:56 +0900 Subject: [PATCH 0577/1389] Remove debugging variable derived from IRB --- lib/rdoc/parser/ruby.rb | 2 -- lib/rdoc/parser/ruby_tools.rb | 2 -- 2 files changed, 4 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8b9ecc1141..ac40136f33 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -8,8 +8,6 @@ # by Keiju ISHITSUKA (Nippon Rational Inc.) # -$TOKEN_DEBUG ||= nil - ## # Extracts code elements from a source file returning a TopLevel object # containing the constituent file elements. diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb index 1f621cd32e..6797d0ef3c 100644 --- a/lib/rdoc/parser/ruby_tools.rb +++ b/lib/rdoc/parser/ruby_tools.rb @@ -25,12 +25,10 @@ def get_tk tk = @scanner[@scanner_point] @scanner_point += 1 @read.push tk[:text] - puts "get_tk1 => #{tk.inspect}" if $TOKEN_DEBUG end else @read.push @unget_read.shift tk = @tokens.shift - puts "get_tk2 => #{tk.inspect}" if $TOKEN_DEBUG end if tk == nil || :on___end__ == tk[:kind] From c64c71e288e1fc8efafe893220a6a81e615e5173 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 21 Jul 2018 03:58:58 +0900 Subject: [PATCH 0578/1389] Split skip_tkspace I'm using Stackprof for a performance check of Rails documents generation. Before this commit, RDoc::Text#wrap uses processing time about 0.8%. ~/rdoc$ stackprof stackprof-rails.dump ================================== Mode: cpu(1000) Samples: 68079 (0.92% miss rate) GC: 15749 (23.13%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 15749 (23.1%) 15749 (23.1%) (garbage collection) 14045 (20.6%) 6002 (8.8%) RDoc::Generator::Darkfish#generate_class 6107 (9.0%) 5962 (8.8%) RDoc::Markup::AttributeManager#convert_specials (snip) 2955 (4.3%) 541 (0.8%) RDoc::Parser::RubyTools#skip_tkspace After this commit, processing time of RDoc::Text#wrap is reduced to 0.5%. ~/rdoc$ stackprof stackprof-rails.dump ================================== Mode: cpu(1000) Samples: 66262 (0.79% miss rate) GC: 15673 (23.65%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 15673 (23.7%) 15673 (23.7%) (garbage collection) 13878 (20.9%) 5836 (8.8%) RDoc::Generator::Darkfish#generate_class 5624 (8.5%) 5489 (8.3%) RDoc::Markup::AttributeManager#convert_specials (snip) 2178 (3.3%) 316 (0.5%) RDoc::Parser::RubyTools#skip_tkspace_without_nl --- lib/rdoc/parser/ruby.rb | 52 +++++++++++++++++------------------ lib/rdoc/parser/ruby_tools.rb | 20 ++++++++++---- test/test_rdoc_parser_ruby.rb | 37 +++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 31 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index ac40136f33..97399f87ff 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -265,7 +265,7 @@ def collect_first_comment tk = get_tk if :on_nl === tk then - skip_tkspace false + skip_tkspace_without_nl tk = get_tk end end @@ -280,7 +280,7 @@ def collect_first_comment # Consumes trailing whitespace from the token stream def consume_trailing_spaces # :nodoc: - skip_tkspace false + skip_tkspace_without_nl end ## @@ -352,7 +352,7 @@ def get_class_or_module container, ignore_constants = false given_name << '::' end - skip_tkspace false + skip_tkspace_without_nl given_name << name_t[:text] is_self = name_t[:kind] == :on_op && name_t[:text] == '<<' @@ -376,7 +376,7 @@ def get_class_or_module container, ignore_constants = false record_location container get_tk - skip_tkspace false + skip_tkspace_without_nl name_t = get_tk unless :on_const == name_t[:kind] || :on_ident == name_t[:kind] raise RDoc::Error, "Invalid class or module definition: #{given_name}" @@ -388,7 +388,7 @@ def get_class_or_module container, ignore_constants = false end end - skip_tkspace false + skip_tkspace_without_nl return [container, name_t, given_name, new_modules] end @@ -408,7 +408,7 @@ def get_class_specification res = get_constant - skip_tkspace false + skip_tkspace_without_nl get_tkread # empty out read buffer @@ -431,7 +431,7 @@ def get_class_specification def get_constant res = "" - skip_tkspace false + skip_tkspace_without_nl tk = get_tk while tk && ((:on_op == tk[:kind] && '::' == tk[:text]) || :on_const == tk[:kind]) do @@ -447,7 +447,7 @@ def get_constant # Get an included module that may be surrounded by parens def get_included_module_with_optional_parens - skip_tkspace false + skip_tkspace_without_nl get_tkread tk = get_tk end_token = get_end_token tk @@ -683,7 +683,7 @@ def parse_attr(context, single, tk, comment) if args.size > 0 then name = args[0] rw = "R" - skip_tkspace false + skip_tkspace_without_nl tk = get_tk if :on_comma == tk[:kind] then @@ -933,7 +933,7 @@ def parse_constant container, tk, comment, ignore_constants = false line_no = tk[:line_no] name = tk[:text] - skip_tkspace false + skip_tkspace_without_nl return unless name =~ /^\w+$/ @@ -959,7 +959,7 @@ def parse_constant container, tk, comment, ignore_constants = false break if nest == 0 end end - skip_tkspace false + skip_tkspace_without_nl is_array_or_hash = true end @@ -1296,7 +1296,7 @@ def parse_meta_method(container, single, tk, comment) add_token tk add_token_listener self - skip_tkspace false + skip_tkspace_without_nl comment.text = comment.text.sub(/(^# +:?)(singleton-)(method:)/, '\1\3') singleton = !!$~ @@ -1485,7 +1485,7 @@ def parse_method_dummy container def parse_method_name container # :nodoc: skip_tkspace name_t = get_tk - back_tk = skip_tkspace(false) + back_tk = skip_tkspace_without_nl singleton = false dot = get_tk @@ -1573,7 +1573,7 @@ def parse_method_name_singleton container, name_t # :nodoc: def parse_method_or_yield_parameters(method = nil, modifiers = RDoc::METHOD_MODIFIERS) - skip_tkspace false + skip_tkspace_without_nl tk = get_tk end_token = get_end_token tk return '' unless end_token @@ -1646,7 +1646,7 @@ def parse_method_parameters method return if method.block_params - skip_tkspace false + skip_tkspace_without_nl read_documentation_modifiers method, RDoc::METHOD_MODIFIERS end @@ -1697,19 +1697,19 @@ def parse_require(context, comment) # Parses a rescue def parse_rescue - skip_tkspace false + skip_tkspace_without_nl while tk = get_tk case tk[:kind] when :on_nl, :on_semicolon, :on_comment then break when :on_comma then - skip_tkspace false + skip_tkspace_without_nl get_tk if :on_nl == peek_tk[:kind] end - skip_tkspace false + skip_tkspace_without_nl end end @@ -1782,7 +1782,7 @@ def parse_statements(container, single = NORMAL, current_method = nil, comment += "\n" unless "\n" == comment_body.chars.to_a.last if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then - skip_tkspace false # leading spaces + skip_tkspace_without_nl # leading spaces end tk = get_tk end @@ -1966,7 +1966,7 @@ def parse_symbol_arg_space no, tk # :nodoc: end loop do - skip_tkspace false + skip_tkspace_without_nl tk1 = get_tk if tk1.nil? || :on_comma != tk1[:kind] then @@ -2115,7 +2115,7 @@ def read_directive allowed # See also RDoc::Markup::PreProcess#handle_directive def read_documentation_modifiers context, allowed - skip_tkspace(false) + skip_tkspace_without_nl directive, value = read_directive allowed return unless directive @@ -2193,7 +2193,7 @@ def scan # while, until, and for have an optional do def skip_optional_do_after_expression - skip_tkspace false + skip_tkspace_without_nl tk = get_tk b_nest = 0 @@ -2225,7 +2225,7 @@ def skip_optional_do_after_expression tk = get_tk end - skip_tkspace false + skip_tkspace_without_nl get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text] end @@ -2234,9 +2234,9 @@ def skip_optional_do_after_expression # skip the var [in] part of a 'for' statement def skip_for_variable - skip_tkspace false + skip_tkspace_without_nl get_tk - skip_tkspace false + skip_tkspace_without_nl tk = get_tk unget_tk(tk) unless :on_kw == tk[:kind] and 'in' == tk[:text] end @@ -2255,7 +2255,7 @@ def skip_method container def skip_tkspace_comment(skip_nl = true) loop do - skip_tkspace skip_nl + skip_nl ? skip_tkspace : skip_tkspace_without_nl next_tk = peek_tk return if next_tk.nil? || (:on_comment != next_tk[:kind] and :on_embdoc != next_tk[:kind]) get_tk diff --git a/lib/rdoc/parser/ruby_tools.rb b/lib/rdoc/parser/ruby_tools.rb index 6797d0ef3c..681d7166ce 100644 --- a/lib/rdoc/parser/ruby_tools.rb +++ b/lib/rdoc/parser/ruby_tools.rb @@ -109,17 +109,27 @@ def reset @scanner_point = 0 end - def tk_nl?(tk) - :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind] + ## + # Skips whitespace tokens including newlines + + def skip_tkspace + tokens = [] + + while (tk = get_tk) and (:on_sp == tk[:kind] or :on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]) do + tokens.push(tk) + end + + unget_tk(tk) + tokens end ## - # Skips whitespace tokens including newlines if +skip_nl+ is true + # Skips whitespace tokens excluding newlines - def skip_tkspace(skip_nl = true) + def skip_tkspace_without_nl tokens = [] - while (tk = get_tk) and (:on_sp == tk[:kind] or (skip_nl and tk_nl?(tk))) do + while (tk = get_tk) and :on_sp == tk[:kind] do tokens.push(tk) end diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 8e31141f59..69dfcf1196 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -495,6 +495,43 @@ def test_parse_attr_accessor assert_equal 'my attr', bar.comment.text end + def test_parse_attr_accessor_with_newline + klass = RDoc::NormalClass.new 'Foo' + klass.parent = @top_level + + comment = RDoc::Comment.new "##\n# my attr\n", @top_level + + util_parser "attr_accessor :foo, :bar,\n :baz,\n :qux" + + tk = @parser.get_tk + + @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment + + assert_equal 4, klass.attributes.length + + foo = klass.attributes[0] + assert_equal 'foo', foo.name + assert_equal 'RW', foo.rw + assert_equal 'my attr', foo.comment.text + assert_equal @top_level, foo.file + assert_equal 1, foo.line + + bar = klass.attributes[1] + assert_equal 'bar', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + + bar = klass.attributes[2] + assert_equal 'baz', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + + bar = klass.attributes[3] + assert_equal 'qux', bar.name + assert_equal 'RW', bar.rw + assert_equal 'my attr', bar.comment.text + end + def test_parse_attr_accessor_nodoc klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level From 2b96a8b617c8d3438ccf9bdb302353c66142afca Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 21 Jul 2018 09:30:31 +0900 Subject: [PATCH 0579/1389] Refactor RipperStateLex I'm using Stackprof for a performance check of Rails documents generation. I checked methods below: - RDoc::Parser::RipperStateLex#get_squashed_tk - RDoc::Parser::RipperStateLex#initialize - RDoc::Parser::RipperStateLex::InnerStateLex#on_default Before this commit, these use processing time about 19.6%. aycabta@x270:~/rdoc$ stackprof stackprof-rails-before.dump --limit 1 ================================== Mode: cpu(1000) Samples: 66894 (0.83% miss rate) GC: 15700 (23.47%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 15700 (23.5%) 15700 (23.5%) (garbage collection) aycabta@x270:~/rdoc$ stackprof stackprof-rails-before.dump | \ grep 'RipperStateLex' 1727 (2.6%) 1472 (2.2%) (snip)RipperStateLex#get_squashed_tk 9352 (14.0%) 1281 (1.9%) (snip)RipperStateLex#initialize 2018 (3.0%) 475 (0.7%) (snip)RipperStateLex::InnerStateLex#on_default After this commit, processing time is reduced to 15.0%. aycabta@x270:~/rdoc$ stackprof stackprof-rails-after.dump --limit 1 ================================== Mode: cpu(1000) Samples: 61020 (1.01% miss rate) GC: 13824 (22.65%) ================================== TOTAL (pct) SAMPLES (pct) FRAME 13824 (22.7%) 13824 (22.7%) (garbage collection) aycabta@x270:~/rdoc$ stackprof stackprof-rails-after.dump --limit 0 | \ grep '#get_squashed_tk\|RipperStateLex#initialize\|#on_default' 735 (1.2%) 533 (0.9%) (snip)RipperStateLex::InnerStateLex#on_default 760 (1.2%) 517 (0.8%) (snip)RipperStateLex#get_squashed_tk 7663 (12.6%) 1 (0.0%) (snip)RipperStateLex#initialize --- lib/rdoc/parser/ripper_state_lex.rb | 84 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 773a830450..9704adb785 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -50,7 +50,7 @@ def on_nl(tok, data) @continue = false @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 end - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_ignored_nl(tok, data) @@ -61,7 +61,7 @@ def on_ignored_nl(tok, data) @continue = false @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 end - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_op(tok, data) @@ -103,7 +103,7 @@ def on_op(tok, data) @lex_state = EXPR_BEG end end - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_kw(tok, data) @@ -132,54 +132,54 @@ def on_kw(tok, data) @lex_state = EXPR_END end end - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_tstring_beg(tok, data) @lex_state = EXPR_BEG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_tstring_end(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_CHAR(tok, data) @lex_state = EXPR_END - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_period(tok, data) @lex_state = EXPR_DOT - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_int(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_float(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_rational(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_imaginary(tok, data) @lex_state = EXPR_END | EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_symbeg(tok, data) @lex_state = EXPR_FNAME @continue = true @in_fname = true - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end private def on_variables(event, tok, data) @@ -198,7 +198,7 @@ def on_symbeg(tok, data) else @lex_state = EXPR_CMDARG end - @callback.call(Token.new(lineno, column, event, tok, @lex_state)) + data << Token.new(lineno, column, event, tok, @lex_state) end def on_ident(tok, data) @@ -227,32 +227,32 @@ def on_backref(tok, data) def on_lparen(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_rparen(tok, data) @lex_state = EXPR_ENDFN - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_lbrace(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_rbrace(tok, data) @lex_state = EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_lbracket(tok, data) @lex_state = EXPR_LABEL | EXPR_BEG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_rbracket(tok, data) @lex_state = EXPR_ENDARG - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_const(tok, data) @@ -264,41 +264,43 @@ def on_const(tok, data) else @lex_state = EXPR_CMDARG end - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_sp(tok, data) - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_comma(tok, data) @lex_state = EXPR_BEG | EXPR_LABEL if (EXPR_ARG_ANY & @lex_state) != 0 - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_comment(tok, data) @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) end def on_ignored_sp(tok, data) @lex_state = EXPR_BEG unless (EXPR_LABEL & @lex_state) != 0 - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) + end + + def on_heredoc_beg(tok, data) + data << Token.new(lineno, column, __method__, tok, @lex_state) + @lex_state = EXPR_END + data end def on_heredoc_end(tok, data) - @callback.call(Token.new(lineno, column, __method__, tok, @lex_state)) + data << Token.new(lineno, column, __method__, tok, @lex_state) @lex_state = EXPR_BEG + data end def on_default(event, tok, data) reset - @callback.call(Token.new(lineno, column, event, tok, @lex_state)) - end - - def each(&block) - @callback = block - parse + data << Token.new(lineno, column, event, tok, @lex_state) end end unless RIPPER_HAS_LEX_STATE @@ -308,21 +310,17 @@ def initialize(code) end def on_default(event, tok, data) - @callback.call(Token.new(lineno, column, event, tok, state)) - end - - def each(&block) - @callback = block - parse + data << Token.new(lineno, column, event, tok, state) end end if RIPPER_HAS_LEX_STATE def get_squashed_tk if @buf.empty? - tk = @inner_lex_enumerator.next + tk = @tokens.shift else tk = @buf.shift end + return nil if tk.nil? case tk[:kind] when :on_symbeg then tk = get_symbol_tk(tk) @@ -472,7 +470,7 @@ def get_squashed_tk string = '' start_tk = nil prev_tk = nil - until heredoc_end?(heredoc_name, indent, tk = @inner_lex_enumerator.next) do + until heredoc_end?(heredoc_name, indent, tk = @tokens.shift) do start_tk = tk unless start_tk if (prev_tk.nil? or "\n" == prev_tk[:text][-1]) and 0 != tk[:char_no] string = string + (' ' * tk[:char_no]) @@ -566,11 +564,7 @@ def initialize(code) @buf = [] @heredoc_queue = [] @inner_lex = InnerStateLex.new(code) - @inner_lex_enumerator = Enumerator.new do |y| - @inner_lex.each do |tk| - y << tk - end - end + @tokens = @inner_lex.parse([]) end def self.parse(code) From a41d9b9990725feaddaeb0e9685f0f835cbf0bde Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 25 Jul 2018 00:33:48 +0900 Subject: [PATCH 0580/1389] Support mutable/immutable heredoc The heredoc literal is just a String literal syntax, so it can take prepositive String#-@ or String#+@. --- lib/rdoc/parser/ripper_state_lex.rb | 4 ++++ test/test_rdoc_parser_ruby.rb | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 773a830450..3c761f985d 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -555,6 +555,10 @@ def get_squashed_tk tk[:text] += tk_ahead[:text] tk[:kind] = tk_ahead[:kind] tk[:state] = tk_ahead[:state] + when :on_heredoc_beg, :on_tstring, :on_dstring # frozen/non-frozen string literal + tk[:text] += tk_ahead[:text] + tk[:kind] = tk_ahead[:kind] + tk[:state] = tk_ahead[:state] else @buf.unshift tk_ahead end diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 8e31141f59..6f7413a0b4 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -2848,6 +2848,35 @@ def blah() assert_equal expected, markup_code end + def test_parse_mutable_heredocbeg + @filename = 'file.rb' + util_parser <def blah() + @str = -<<-EOM + EOM + end +EXPECTED + expected = expected.rstrip + + @parser.scan + + foo = @top_level.classes.first + assert_equal 'Foo', foo.full_name + + blah = foo.method_list.first + markup_code = blah.markup_code.sub(/^.*\n/, '') + assert_equal expected, markup_code + end + def test_parse_statements_method_oneliner_with_regexp util_parser < Date: Fri, 3 Aug 2018 11:35:55 +0200 Subject: [PATCH 0581/1389] Fix indent and typo from moveTimout to moveTimeout. --- lib/rdoc/generator/template/json_index/js/navigation.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/generator/template/json_index/js/navigation.js b/lib/rdoc/generator/template/json_index/js/navigation.js index e41268123e..43c5118abd 100644 --- a/lib/rdoc/generator/template/json_index/js/navigation.js +++ b/lib/rdoc/generator/template/json_index/js/navigation.js @@ -59,9 +59,8 @@ Navigation = new function() { } break; case 13: //Event.KEY_RETURN: - if (this.$current) - e.preventDefault(); - this.select(this.$current); + if (this.$current) e.preventDefault(); + this.select(this.$current); break; } if (e.ctrlKey && e.shiftKey) this.select(this.$current); @@ -80,7 +79,7 @@ Navigation = new function() { var go = function() { if (!_this.moveTimeout) return; _this[isDown ? 'moveDown' : 'moveUp'](); - _this.moveTimout = setTimeout(go, 100); + _this.moveTimeout = setTimeout(go, 100); } this.moveTimeout = setTimeout(go, 200); } From 056fba770d6c558869e2ca20fec400713255cf22 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 21 Aug 2018 21:15:49 +0900 Subject: [PATCH 0582/1389] Split RDoc::VERSION from rdoc.rb. It makes simplify logic of gemspec file. --- lib/rdoc.rb | 5 +---- lib/rdoc/version.rb | 8 ++++++++ rdoc.gemspec | 14 ++++---------- 3 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 lib/rdoc/version.rb diff --git a/lib/rdoc.rb b/lib/rdoc.rb index 027772838e..fc8ad9e144 100644 --- a/lib/rdoc.rb +++ b/lib/rdoc.rb @@ -62,10 +62,7 @@ module RDoc class Error < RuntimeError; end - ## - # RDoc version you are using - - VERSION = '6.0.4' + require 'rdoc/version' ## # Method visibilities diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb new file mode 100644 index 0000000000..287c0c62c2 --- /dev/null +++ b/lib/rdoc/version.rb @@ -0,0 +1,8 @@ +module RDoc + + ## + # RDoc version you are using + + VERSION = '6.0.4' + +end diff --git a/rdoc.gemspec b/rdoc.gemspec index 59d8fb52c3..efef1863b9 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -1,14 +1,8 @@ begin - require_relative "lib/rdoc" + require_relative "lib/rdoc/version" rescue LoadError - begin - # for Ruby repository - require_relative "../rdoc" - rescue LoadError - # for JRuby - $LOAD_PATH.unshift File.expand_path('../lib', __FILE__) - require "rdoc" - end + # for Ruby repository + require_relative "version" end Gem::Specification.new do |s| @@ -38,7 +32,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "lib/rdoc/version.rb", "rdoc.gemspec"] # files from .gitignore s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb" From 3412a10bc7f4092af656d76a68b3975131386fbf Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:19:31 +0900 Subject: [PATCH 0583/1389] Travis is working with JRuby 9.1.17.0. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0c56f83790..a87a4577bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,3 @@ env: global: NOBENCHMARK=1 script: rake -matrix: - allow_failures: - - rvm: jruby-9.1.17.0 From ec8ba36838b5a8032ec5c80dc747d4be4c1779da Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:19:56 +0900 Subject: [PATCH 0584/1389] Added JRuby 9.2.0.0. Fixes #628 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a87a4577bb..293b6c2af7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: - 2.5.0 - ruby-head - jruby-9.1.17.0 + - jruby-9.2.0.0 env: global: NOBENCHMARK=1 From c16bfd93ee1267c04126f060eff1ca1f5431d65d Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:20:15 +0900 Subject: [PATCH 0585/1389] Removed EOL version --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 293b6c2af7..49ed6a48a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ before_install: - gem update bundler language: ruby rvm: - - 2.2.9 - 2.3.6 - 2.4.3 - 2.5.0 From f4dfd811982a88be1987f00bc44131bded4b4431 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:20:26 +0900 Subject: [PATCH 0586/1389] To use latest versions --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 49ed6a48a5..7776ec3717 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ before_install: - gem update bundler language: ruby rvm: - - 2.3.6 - - 2.4.3 - - 2.5.0 + - 2.3.7 + - 2.4.4 + - 2.5.1 - ruby-head - jruby-9.1.17.0 - jruby-9.2.0.0 From 5a406b8ad83d255c6d01b90617438bf266ac312c Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:27:34 +0900 Subject: [PATCH 0587/1389] Ignore JRuby 9.2.0.0 from result of Travis CI. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7776ec3717..7fe9ab73ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,6 @@ env: global: NOBENCHMARK=1 script: rake +matrix: + allow_failures: + - rvm: jruby-9.2.0.0 From 7d8194f9319b2a0726ba1c56f73bff32d9879062 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Wed, 22 Aug 2018 14:56:25 +0900 Subject: [PATCH 0588/1389] Also ignored JRuby-9.1.17.0 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7fe9ab73ff..365c638261 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,4 +16,5 @@ env: script: rake matrix: allow_failures: + - rvm: jruby-9.1.17.0 - rvm: jruby-9.2.0.0 From 5f93cefa1f78fa1610bf5b08dbff81adb5f5ae47 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 27 Aug 2018 09:51:29 +0900 Subject: [PATCH 0589/1389] bump version to 6.1.0.beta1 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index 287c0c62c2..5139f8dd4b 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.0.4' + VERSION = '6.1.0.beta1' end From 03d36a44935d5da8720514204b527be41828c7c4 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 27 Aug 2018 10:06:33 +0900 Subject: [PATCH 0590/1389] Fixup #634, fixes #647 --- test/test_rdoc_ri_driver.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index ddd0904021..16c764fee3 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -702,7 +702,16 @@ def test_display_method_overridden def test_display_name util_store - assert_equal true, @driver.display_name('home:README.rdoc') + out, = capture_io do + assert_equal true, @driver.display_name('home:README.rdoc') + end + + expected = <<-EXPECTED += README +This is a README + EXPECTED + + assert_equal expected, out end def test_display_name_not_found_class From 7a013695f19a4a81538693c40d8e056b5ba6a79c Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Mon, 27 Aug 2018 10:07:42 +0900 Subject: [PATCH 0591/1389] indent --- test/test_rdoc_ri_driver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index 16c764fee3..f636c6346f 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -709,7 +709,7 @@ def test_display_name expected = <<-EXPECTED = README This is a README - EXPECTED + EXPECTED assert_equal expected, out end From 37481c34cf121f099459153692fffe01270a0830 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 31 Aug 2018 14:31:27 +0900 Subject: [PATCH 0592/1389] Removed deprecated file of inline.rb --- lib/rdoc/markup/inline.rb | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 lib/rdoc/markup/inline.rb diff --git a/lib/rdoc/markup/inline.rb b/lib/rdoc/markup/inline.rb deleted file mode 100644 index aba7ec21ce..0000000000 --- a/lib/rdoc/markup/inline.rb +++ /dev/null @@ -1,2 +0,0 @@ -# frozen_string_literal: true -warn "requiring rdoc/markup/inline is deprecated and will be removed in RDoc 4." if $-w From c047201105818cf5ff3f31b6b350d94266a7b5e0 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 3 Sep 2018 03:31:15 +0900 Subject: [PATCH 0593/1389] Rename the name "special" with "regexp handling" The name "special" makes no sence. This commit renames it with "regexp handling". --- lib/rdoc/cross_reference.rb | 4 +- lib/rdoc/markup.rb | 22 +++++----- lib/rdoc/markup/attribute_manager.rb | 44 ++++++++++---------- lib/rdoc/markup/attributes.rb | 12 +++--- lib/rdoc/markup/formatter.rb | 47 +++++++++++----------- lib/rdoc/markup/heading.rb | 6 +-- lib/rdoc/markup/regexp_handling.rb | 41 +++++++++++++++++++ lib/rdoc/markup/special.rb | 41 ------------------- lib/rdoc/markup/to_bs.rb | 6 +-- lib/rdoc/markup/to_html.rb | 36 ++++++++--------- lib/rdoc/markup/to_html_crossref.rb | 18 ++++----- lib/rdoc/markup/to_html_snippet.rb | 16 ++++---- lib/rdoc/markup/to_label.rb | 18 ++++----- lib/rdoc/markup/to_markdown.rb | 14 +++---- lib/rdoc/markup/to_rdoc.rb | 10 ++--- lib/rdoc/markup/to_tt_only.rb | 4 +- test/test_rdoc_markup_attribute_manager.rb | 22 +++++----- test/test_rdoc_markup_attributes.rb | 8 ++-- test/test_rdoc_markup_formatter.rb | 38 ++++++++--------- test/test_rdoc_markup_to_html.rb | 12 +++--- test/test_rdoc_markup_to_html_crossref.rb | 46 ++++++++++----------- test/test_rdoc_markup_to_html_snippet.rb | 6 +-- 22 files changed, 235 insertions(+), 236 deletions(-) create mode 100644 lib/rdoc/markup/regexp_handling.rb delete mode 100644 lib/rdoc/markup/special.rb diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb index 3f5f33ba42..7b137483d5 100644 --- a/lib/rdoc/cross_reference.rb +++ b/lib/rdoc/cross_reference.rb @@ -23,8 +23,8 @@ class RDoc::CrossReference ## # Regular expressions matching text that should potentially have - # cross-reference links generated are passed to add_special. Note that - # these expressions are meant to pick up text for which cross-references + # cross-reference links generated are passed to add_regexp_handling. Note + # that these expressions are meant to pick up text for which cross-references # have been suppressed, since the suppression characters are removed by the # code that is triggered. diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb index 08ecc6f7df..f20ee1169e 100644 --- a/lib/rdoc/markup.rb +++ b/lib/rdoc/markup.rb @@ -65,17 +65,16 @@ # puts h.convert(input_string) # # You can extend the RDoc::Markup parser to recognize new markup -# sequences, and to add special processing for text that matches a -# regular expression. Here we make WikiWords significant to the parser, -# and also make the sequences {word} and \text... signify +# sequences, and to add regexp handling. Here we make WikiWords significant to +# the parser, and also make the sequences {word} and \text... signify # strike-through text. We then subclass the HTML output class to deal # with these: # # require 'rdoc' # # class WikiHtml < RDoc::Markup::ToHtml -# def handle_special_WIKIWORD(special) -# "" + special.text + "" +# def handle_regexp_WIKIWORD(target) +# "" + target.text + "" # end # end # @@ -83,7 +82,7 @@ # markup.add_word_pair("{", "}", :STRIKE) # markup.add_html("no", :STRIKE) # -# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) +# markup.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) # # wh = WikiHtml.new RDoc::Options.new, markup # wh.add_tag(:STRIKE, "", "") @@ -800,13 +799,12 @@ def add_html(tag, name) # Add to other inline sequences. For example, we could add WikiWords using # something like: # - # parser.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) + # parser.add_regexp_handling(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD) # - # Each wiki word will be presented to the output formatter via the - # accept_special method. + # Each wiki word will be presented to the output formatter. - def add_special(pattern, name) - @attribute_manager.add_special(pattern, name) + def add_regexp_handling(pattern, name) + @attribute_manager.add_regexp_handling(pattern, name) end ## @@ -832,7 +830,7 @@ def convert input, formatter autoload :AttrSpan, 'rdoc/markup/attr_span' autoload :Attributes, 'rdoc/markup/attributes' autoload :AttributeManager, 'rdoc/markup/attribute_manager' - autoload :Special, 'rdoc/markup/special' + autoload :RegexpHandling, 'rdoc/markup/regexp_handling' # RDoc::Markup AST autoload :BlankLine, 'rdoc/markup/blank_line' diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index a10f731615..f052bc8b01 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -53,10 +53,10 @@ class RDoc::Markup::AttributeManager attr_reader :protectable ## - # And this maps _special_ sequences to a name. A special sequence is - # something like a WikiWord + # And this maps _regexp handling_ sequences to a name. A regexp handling + # sequence is something like a WikiWord - attr_reader :special + attr_reader :regexp_handlings ## # Creates a new attribute manager that understands bold, emphasized and @@ -66,7 +66,7 @@ def initialize @html_tags = {} @matching_word_pairs = {} @protectable = %w[<] - @special = [] + @regexp_handlings = [] @word_pair_map = {} @attributes = RDoc::Markup::Attributes.new @@ -166,22 +166,22 @@ def convert_html(str, attrs) end ## - # Converts special sequences to RDoc attributes + # Converts regexp handling sequences to RDoc attributes - def convert_specials str, attrs - @special.each do |regexp, attribute| + def convert_regexp_handlings str, attrs + @regexp_handlings.each do |regexp, attribute| str.scan(regexp) do capture = $~.size == 1 ? 0 : 1 s, e = $~.offset capture - attrs.set_attrs s, e - s, attribute | @attributes.special + attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling end end end ## - # Escapes special sequences of text to prevent conversion to RDoc + # Escapes regexp handling sequences of text to prevent conversion to RDoc def mask_protected_sequences # protect __send__, __FILE__, etc. @@ -193,7 +193,7 @@ def mask_protected_sequences end ## - # Unescapes special sequences of text + # Unescapes regexp handling sequences of text def unmask_protected_sequences @str.gsub!(/(.)#{PROTECT_ATTR}/, "\\1\000") @@ -233,17 +233,17 @@ def add_html(tag, name) end ## - # Adds a special handler for +pattern+ with +name+. A simple URL handler + # Adds a regexp handling for +pattern+ with +name+. A simple URL handler # would be: # - # @am.add_special(/((https?:)\S+\w)/, :HYPERLINK) + # @am.add_regexp_handling(/((https?:)\S+\w)/, :HYPERLINK) - def add_special pattern, name - @special << [pattern, @attributes.bitmap_for(name)] + def add_regexp_handling pattern, name + @regexp_handlings << [pattern, @attributes.bitmap_for(name)] end ## - # Processes +str+ converting attributes, HTML and specials + # Processes +str+ converting attributes, HTML and regexp handlings def flow str @str = str.dup @@ -252,9 +252,9 @@ def flow str @attrs = RDoc::Markup::AttrSpan.new @str.length - convert_attrs @str, @attrs - convert_html @str, @attrs - convert_specials @str, @attrs + convert_attrs @str, @attrs + convert_html @str, @attrs + convert_regexp_handlings @str, @attrs unmask_protected_sequences @@ -312,12 +312,12 @@ def split_into_flow res << change_attribute(current_attr, new_attr) current_attr = new_attr - if (current_attr & @attributes.special) != 0 then + if (current_attr & @attributes.regexp_handling) != 0 then i += 1 while - i < str_len and (@attrs[i] & @attributes.special) != 0 + i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0 - res << RDoc::Markup::Special.new(current_attr, - copy_string(start_pos, i)) + res << RDoc::Markup::RegexpHandling.new(current_attr, + copy_string(start_pos, i)) start_pos = i next end diff --git a/lib/rdoc/markup/attributes.rb b/lib/rdoc/markup/attributes.rb index ec30160d3d..ce014ce928 100644 --- a/lib/rdoc/markup/attributes.rb +++ b/lib/rdoc/markup/attributes.rb @@ -6,21 +6,21 @@ class RDoc::Markup::Attributes ## - # The special attribute type. See RDoc::Markup#add_special + # The regexp handling attribute type. See RDoc::Markup#add_regexp_handling - attr_reader :special + attr_reader :regexp_handling ## # Creates a new attributes set. def initialize - @special = 1 + @regexp_handling = 1 @name_to_bitmap = [ - [:_SPECIAL_, @special], + [:_REGEXP_HANDLING_, @regexp_handling], ] - @next_bitmap = @special << 1 + @next_bitmap = @regexp_handling << 1 end ## @@ -61,7 +61,7 @@ def each_name_of bitmap return enum_for __method__, bitmap unless block_given? @name_to_bitmap.each do |name, bit| - next if bit == @special + next if bit == @regexp_handling yield name.to_s if (bitmap & bit) != 0 end diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb index 5dc71d2242..6dff96c7d0 100644 --- a/lib/rdoc/markup/formatter.rb +++ b/lib/rdoc/markup/formatter.rb @@ -50,7 +50,7 @@ def initialize options, markup = nil @markup = markup || RDoc::Markup.new @am = @markup.attribute_manager - @am.add_special(/
/, :HARD_BREAK) + @am.add_regexp_handling(/
/, :HARD_BREAK) @attributes = @am.attributes @@ -78,23 +78,24 @@ def accept_document document end ## - # Adds a special for links of the form rdoc-...: + # Adds a regexp handling for links of the form rdoc-...: - def add_special_RDOCLINK - @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK) + def add_regexp_handling_RDOCLINK + @markup.add_regexp_handling(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK) end ## - # Adds a special for links of the form {}[] and [] + # Adds a regexp handling for links of the form {}[] and + # [] - def add_special_TIDYLINK - @markup.add_special(/(?: - \{.*?\} | # multi-word label - \b[^\s{}]+? # single-word label - ) + def add_regexp_handling_TIDYLINK + @markup.add_regexp_handling(/(?: + \{.*?\} | # multi-word label + \b[^\s{}]+? # single-word label + ) - \[\S+?\] # link target - /x, :TIDYLINK) + \[\S+?\] # link target + /x, :TIDYLINK) end ## @@ -133,8 +134,8 @@ def convert_flow(flow) when RDoc::Markup::AttrChanger then off_tags res, item on_tags res, item - when RDoc::Markup::Special then - res << convert_special(item) + when RDoc::Markup::RegexpHandling then + res << convert_regexp_handling(item) else raise "Unknown flow element: #{item.inspect}" end @@ -144,29 +145,29 @@ def convert_flow(flow) end ## - # Converts added specials. See RDoc::Markup#add_special + # Converts added regexp handlings. See RDoc::Markup#add_regexp_handling - def convert_special special - return special.text if in_tt? + def convert_regexp_handling target + return target.text if in_tt? handled = false - @attributes.each_name_of special.type do |name| - method_name = "handle_special_#{name}" + @attributes.each_name_of target.type do |name| + method_name = "handle_regexp_#{name}" if respond_to? method_name then - special.text = send method_name, special + target.text = send method_name, target handled = true end end unless handled then - special_name = @attributes.as_string special.type + target_name = @attributes.as_string target.type - raise RDoc::Error, "Unhandled special #{special_name}: #{special}" + raise RDoc::Error, "Unhandled regexp handling #{target_name}: #{target}" end - special.text + target.text end ## diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb index 233774c5c4..93a3a52000 100644 --- a/lib/rdoc/markup/heading.rb +++ b/lib/rdoc/markup/heading.rb @@ -23,12 +23,12 @@ def self.to_html return @to_html if @to_html markup = RDoc::Markup.new - markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF + markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF @to_html = RDoc::Markup::ToHtml.new nil - def @to_html.handle_special_CROSSREF special - special.text.sub(/^\\/, '') + def @to_html.handle_regexp_CROSSREF target + target.text.sub(/^\\/, '') end @to_html diff --git a/lib/rdoc/markup/regexp_handling.rb b/lib/rdoc/markup/regexp_handling.rb new file mode 100644 index 0000000000..6ed868c2c1 --- /dev/null +++ b/lib/rdoc/markup/regexp_handling.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true +## +# Hold details of a regexp handling sequence + +class RDoc::Markup::RegexpHandling + + ## + # Regexp handling type + + attr_reader :type + + ## + # Regexp handling text + + attr_accessor :text + + ## + # Creates a new regexp handling sequence of +type+ with +text+ + + def initialize(type, text) + @type, @text = type, text + end + + ## + # Regexp handlings are equal when the have the same text and type + + def ==(o) + self.text == o.text && self.type == o.type + end + + def inspect # :nodoc: + "#" % [ + object_id, @type, text.dump] + end + + def to_s # :nodoc: + "RegexpHandling: type=#{type} text=#{text.dump}" + end + +end + diff --git a/lib/rdoc/markup/special.rb b/lib/rdoc/markup/special.rb deleted file mode 100644 index 57261b44a7..0000000000 --- a/lib/rdoc/markup/special.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true -## -# Hold details of a special sequence - -class RDoc::Markup::Special - - ## - # Special type - - attr_reader :type - - ## - # Special text - - attr_accessor :text - - ## - # Creates a new special sequence of +type+ with +text+ - - def initialize(type, text) - @type, @text = type, text - end - - ## - # Specials are equal when the have the same text and type - - def ==(o) - self.text == o.text && self.type == o.type - end - - def inspect # :nodoc: - "#" % [ - object_id, @type, text.dump] - end - - def to_s # :nodoc: - "Special: type=#{type} text=#{text.dump}" - end - -end - diff --git a/lib/rdoc/markup/to_bs.rb b/lib/rdoc/markup/to_bs.rb index fea017e89d..f9b86487db 100644 --- a/lib/rdoc/markup/to_bs.rb +++ b/lib/rdoc/markup/to_bs.rb @@ -41,7 +41,7 @@ def accept_heading heading end ## - # Turns on or off special handling for +convert_string+ + # Turns on or off regexp handling for +convert_string+ def annotate tag case tag @@ -54,9 +54,9 @@ def annotate tag end ## - # Calls convert_string on the result of convert_special + # Calls convert_string on the result of convert_regexp_handling - def convert_special special + def convert_regexp_handling target convert_string super end diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 79b13e1819..28a096e7cd 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -53,18 +53,18 @@ def initialize options, markup = nil @hard_break = "
\n" # external links - @markup.add_special(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/, - :HYPERLINK) + @markup.add_regexp_handling(/(?:link:|https?:|mailto:|ftp:|irc:|www\.)\S+\w/, + :HYPERLINK) - add_special_RDOCLINK - add_special_TIDYLINK + add_regexp_handling_RDOCLINK + add_regexp_handling_TIDYLINK init_tags end - # :section: Special Handling + # :section: Regexp Handling # - # These methods handle special markup added by RDoc::Markup#add_special. + # These methods are used by regexp handling markup added by RDoc::Markup#add_regexp_handling. def handle_RDOCLINK url # :nodoc: case url @@ -91,14 +91,14 @@ def handle_RDOCLINK url # :nodoc: end ## - # +special+ is a
+ # +target+ is a
- def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target '
' end ## - # +special+ is a potential link. The following schemes are handled: + # +target+ is a potential link. The following schemes are handled: # # mailto::: # Inserted as-is. @@ -109,14 +109,14 @@ def handle_special_HARD_BREAK special # link::: # Reference to a local file relative to the output directory. - def handle_special_HYPERLINK(special) - url = special.text + def handle_regexp_HYPERLINK(target) + url = target.text gen_url url, url end ## - # +special+ is an rdoc-schemed link that will be converted into a hyperlink. + # +target+ is an rdoc-schemed link that will be converted into a hyperlink. # # For the +rdoc-ref+ scheme the named reference will be returned without # creating a link. @@ -124,16 +124,16 @@ def handle_special_HYPERLINK(special) # For the +rdoc-label+ scheme the footnote and label prefixes are stripped # when creating a link. All other contents will be linked verbatim. - def handle_special_RDOCLINK special - handle_RDOCLINK special.text + def handle_regexp_RDOCLINK target + handle_RDOCLINK target.text end ## - # This +special+ is a link where the label is different from the URL + # This +target+ is a link where the label is different from the URL # label[url] or {long label}[url] - def handle_special_TIDYLINK(special) - text = special.text + def handle_regexp_TIDYLINK(target) + text = target.text return text unless text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/ @@ -312,7 +312,7 @@ def convert_string(text) ## # Generate a link to +url+ with content +text+. Handles the special cases - # for img: and link: described under handle_special_HYPERLINK + # for img: and link: described under handle_regexp_HYPERLINK def gen_url url, text scheme, url, id = parse_url url diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index cc93021540..404e2ccfd5 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -40,7 +40,7 @@ def initialize(options, from_path, context, markup = nil) @show_hash = @options.show_hash crossref_re = @hyperlink_all ? ALL_CROSSREF_REGEXP : CROSSREF_REGEXP - @markup.add_special crossref_re, :CROSSREF + @markup.add_regexp_handling crossref_re, :CROSSREF @cross_reference = RDoc::CrossReference.new @context end @@ -68,8 +68,8 @@ def cross_reference name, text = nil # example, ToHtml is found, even without the RDoc::Markup:: prefix, # because we look for it in module Markup first. - def handle_special_CROSSREF(special) - name = special.text + def handle_regexp_CROSSREF(target) + name = target.text return name if name =~ /@[\w-]+\.[\w-]/ # labels that look like emails @@ -87,22 +87,22 @@ def handle_special_CROSSREF(special) # Handles rdoc-ref: scheme links and allows RDoc::Markup::ToHtml to # handle other schemes. - def handle_special_HYPERLINK special - return cross_reference $' if special.text =~ /\Ardoc-ref:/ + def handle_regexp_HYPERLINK target + return cross_reference $' if target.text =~ /\Ardoc-ref:/ super end ## - # +special+ is an rdoc-schemed link that will be converted into a hyperlink. + # +target+ is an rdoc-schemed link that will be converted into a hyperlink. # For the rdoc-ref scheme the cross-reference will be looked up and the # given name will be used. # # All other contents are handled by - # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_special_RDOCLINK] + # {the superclass}[rdoc-ref:RDoc::Markup::ToHtml#handle_regexp_RDOCLINK] - def handle_special_RDOCLINK special - url = special.text + def handle_regexp_RDOCLINK target + url = target.text case url when /\Ardoc-ref:/ then diff --git a/lib/rdoc/markup/to_html_snippet.rb b/lib/rdoc/markup/to_html_snippet.rb index 24aa1d32d9..336c60e198 100644 --- a/lib/rdoc/markup/to_html_snippet.rb +++ b/lib/rdoc/markup/to_html_snippet.rb @@ -44,7 +44,7 @@ def initialize options, characters = 100, paragraphs = 3, markup = nil @mask = 0 @paragraphs = 0 - @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF + @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF end ## @@ -123,16 +123,16 @@ def start_accepting end ## - # Removes escaping from the cross-references in +special+ + # Removes escaping from the cross-references in +target+ - def handle_special_CROSSREF special - special.text.sub(/\A\\/, '') + def handle_regexp_CROSSREF target + target.text.sub(/\A\\/, '') end ## - # +special+ is a
+ # +target+ is a
- def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target @characters -= 4 '
' end @@ -226,8 +226,8 @@ def convert_flow flow when String then text = convert_string item res << truncate(text) - when RDoc::Markup::Special then - text = convert_special item + when RDoc::Markup::RegexpHandling then + text = convert_regexp_handling item res << truncate(text) else raise "Unknown flow element: #{item.inspect}" diff --git a/lib/rdoc/markup/to_label.rb b/lib/rdoc/markup/to_label.rb index 9f179013f2..3d95ccc2e2 100644 --- a/lib/rdoc/markup/to_label.rb +++ b/lib/rdoc/markup/to_label.rb @@ -16,8 +16,8 @@ class RDoc::Markup::ToLabel < RDoc::Markup::Formatter def initialize markup = nil super nil, markup - @markup.add_special RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF - @markup.add_special(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK) + @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF + @markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK) add_tag :BOLD, '', '' add_tag :TT, '', '' @@ -36,20 +36,20 @@ def convert text end ## - # Converts the CROSSREF +special+ to plain text, removing the suppression + # Converts the CROSSREF +target+ to plain text, removing the suppression # marker, if any - def handle_special_CROSSREF special - text = special.text + def handle_regexp_CROSSREF target + text = target.text text.sub(/^\\/, '') end ## - # Converts the TIDYLINK +special+ to just the text part + # Converts the TIDYLINK +target+ to just the text part - def handle_special_TIDYLINK special - text = special.text + def handle_regexp_TIDYLINK target + text = target.text return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/ @@ -68,7 +68,7 @@ def handle_special_TIDYLINK special alias accept_rule ignore alias accept_verbatim ignore alias end_accepting ignore - alias handle_special_HARD_BREAK ignore + alias handle_regexp_HARD_BREAK ignore alias start_accepting ignore end diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb index d471032f9f..7932815405 100644 --- a/lib/rdoc/markup/to_markdown.rb +++ b/lib/rdoc/markup/to_markdown.rb @@ -19,8 +19,8 @@ def initialize markup = nil @headings[5] = ['##### ', ''] @headings[6] = ['###### ', ''] - add_special_RDOCLINK - add_special_TIDYLINK + add_regexp_handling_RDOCLINK + add_regexp_handling_TIDYLINK @hard_break = " \n" end @@ -37,7 +37,7 @@ def init_tags ## # Adds a newline to the output - def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target " \n" end @@ -166,8 +166,8 @@ def handle_rdoc_link url ## # Converts the RDoc markup tidylink into a Markdown.style link. - def handle_special_TIDYLINK special - text = special.text + def handle_regexp_TIDYLINK target + text = target.text return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/ @@ -184,8 +184,8 @@ def handle_special_TIDYLINK special ## # Converts the rdoc-...: links into a Markdown.style links. - def handle_special_RDOCLINK special - handle_rdoc_link special.text + def handle_regexp_RDOCLINK target + handle_rdoc_link target.text end end diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb index 1cb4d6bab2..3aee85afbe 100644 --- a/lib/rdoc/markup/to_rdoc.rb +++ b/lib/rdoc/markup/to_rdoc.rb @@ -45,7 +45,7 @@ class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter def initialize markup = nil super nil, markup - @markup.add_special(/\\\S/, :SUPPRESSED_CROSSREF) + @markup.add_regexp_handling(/\\\S/, :SUPPRESSED_CROSSREF) @width = 78 init_tags @@ -253,10 +253,10 @@ def end_accepting end ## - # Removes preceding \\ from the suppressed crossref +special+ + # Removes preceding \\ from the suppressed crossref +target+ - def handle_special_SUPPRESSED_CROSSREF special - text = special.text + def handle_regexp_SUPPRESSED_CROSSREF target + text = target.text text = text.sub('\\', '') unless in_tt? text end @@ -264,7 +264,7 @@ def handle_special_SUPPRESSED_CROSSREF special ## # Adds a newline to the output - def handle_special_HARD_BREAK special + def handle_regexp_HARD_BREAK target "\n" end diff --git a/lib/rdoc/markup/to_tt_only.rb b/lib/rdoc/markup/to_tt_only.rb index 4f43546e3d..9235d33f04 100644 --- a/lib/rdoc/markup/to_tt_only.rb +++ b/lib/rdoc/markup/to_tt_only.rb @@ -91,8 +91,8 @@ def tt_sections text when RDoc::Markup::AttrChanger then off_tags res, item on_tags res, item - when RDoc::Markup::Special then - @res << convert_special(item) if in_tt? # TODO can this happen? + when RDoc::Markup::RegexpHandling then + @res << convert_regexp_handling(item) if in_tt? # TODO can this happen? else raise "Unknown flow element: #{item.inspect}" end diff --git a/test/test_rdoc_markup_attribute_manager.rb b/test/test_rdoc_markup_attribute_manager.rb index 93338ecb50..d6eccdf76f 100644 --- a/test/test_rdoc_markup_attribute_manager.rb +++ b/test/test_rdoc_markup_attribute_manager.rb @@ -36,12 +36,12 @@ def setup end def crossref(text) - crossref_bitmap = @am.attributes.bitmap_for(:_SPECIAL_) | + crossref_bitmap = @am.attributes.bitmap_for(:_REGEXP_HANDLING_) | @am.attributes.bitmap_for(:CROSSREF) - [ @am.changed_attribute_by_name([], [:CROSSREF, :_SPECIAL_]), - RDoc::Markup::Special.new(crossref_bitmap, text), - @am.changed_attribute_by_name([:CROSSREF, :_SPECIAL_], []) + [ @am.changed_attribute_by_name([], [:CROSSREF, :_REGEXP_HANDLING_]), + RDoc::Markup::RegexpHandling.new(crossref_bitmap, text), + @am.changed_attribute_by_name([:CROSSREF, :_REGEXP_HANDLING_], []) ] end @@ -58,12 +58,12 @@ def test_add_html_tag assert(tags.has_key?("test")) end - def test_add_special - @am.add_special "WikiWord", :WIKIWORD - specials = @am.special + def test_add_regexp_handling + @am.add_regexp_handling "WikiWord", :WIKIWORD + regexp_handlings = @am.regexp_handlings - assert_equal 1, specials.size - assert specials.assoc "WikiWord" + assert_equal 1, regexp_handlings.size + assert regexp_handlings.assoc "WikiWord" end def test_add_word_pair @@ -340,8 +340,8 @@ def test_lost_tag_for_the_second_time @am.flow(str)) end - def test_special - @am.add_special(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF) + def test_regexp_handling + @am.add_regexp_handling(RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF) # # The apostrophes in "cats'" and "dogs'" suppress the flagging of these diff --git a/test/test_rdoc_markup_attributes.rb b/test/test_rdoc_markup_attributes.rb index 91c253a6b0..e592fa7145 100644 --- a/test/test_rdoc_markup_attributes.rb +++ b/test/test_rdoc_markup_attributes.rb @@ -19,10 +19,10 @@ def test_as_string @as.bitmap_for 'two' @as.bitmap_for 'three' - assert_equal 'none', @as.as_string(0) - assert_equal '_SPECIAL_', @as.as_string(1) - assert_equal 'two', @as.as_string(2) - assert_equal '_SPECIAL_,two', @as.as_string(3) + assert_equal 'none', @as.as_string(0) + assert_equal '_REGEXP_HANDLING_', @as.as_string(1) + assert_equal 'two', @as.as_string(2) + assert_equal '_REGEXP_HANDLING_,two', @as.as_string(3) end def test_each_name_of diff --git a/test/test_rdoc_markup_formatter.rb b/test/test_rdoc_markup_formatter.rb index b1f0855de3..cdc5944cdf 100644 --- a/test/test_rdoc_markup_formatter.rb +++ b/test/test_rdoc_markup_formatter.rb @@ -19,8 +19,8 @@ def attributes text convert_flow @am.flow text.dup end - def handle_special_CAPS special - "handled #{special.text}" + def handle_regexp_CAPS target + "handled #{target.text}" end def start_accepting @@ -37,16 +37,16 @@ def setup super @markup = @RM.new - @markup.add_special(/[A-Z]+/, :CAPS) + @markup.add_regexp_handling(/[A-Z]+/, :CAPS) @attribute_manager = @markup.attribute_manager @attributes = @attribute_manager.attributes @to = ToTest.new @markup - @caps = @attributes.bitmap_for :CAPS - @special = @attributes.bitmap_for :_SPECIAL_ - @tt = @attributes.bitmap_for :TT + @caps = @attributes.bitmap_for :CAPS + @regexp_handling = @attributes.bitmap_for :_REGEXP_HANDLING_ + @tt = @attributes.bitmap_for :TT end def test_class_gen_relative_url @@ -62,19 +62,19 @@ def gen(from, to) assert_equal 'a/c.html', gen('a.html', 'a/c.html') end - def special_names - @attribute_manager.special.map do |_, mask| + def regexp_handling_names + @attribute_manager.regexp_handlings.map do |_, mask| @attributes.as_string mask end end - def test_add_special_RDOCLINK - @to.add_special_RDOCLINK + def test_add_regexp_handling_RDOCLINK + @to.add_regexp_handling_RDOCLINK - assert_includes special_names, 'RDOCLINK' + assert_includes regexp_handling_names, 'RDOCLINK' - def @to.handle_special_RDOCLINK special - "<#{special.text}>" + def @to.handle_regexp_RDOCLINK target + "<#{target.text}>" end document = doc(para('{foo}[rdoc-label:bar].')) @@ -84,13 +84,13 @@ def @to.handle_special_RDOCLINK special assert_equal '{foo}[].', formatted end - def test_add_special_TIDYLINK - @to.add_special_TIDYLINK + def test_add_regexp_handling_TIDYLINK + @to.add_regexp_handling_TIDYLINK - assert_includes special_names, 'TIDYLINK' + assert_includes regexp_handling_names, 'TIDYLINK' - def @to.handle_special_TIDYLINK special - "<#{special.text}>" + def @to.handle_regexp_TIDYLINK target + "<#{target.text}>" end document = doc(para('foo[rdoc-label:bar].')) @@ -166,7 +166,7 @@ def test_parse_url_scheme assert_nil id end - def test_convert_tt_special + def test_convert_tt_regexp_handling converted = @to.convert 'AAA' assert_equal 'AAA', converted diff --git a/test/test_rdoc_markup_to_html.rb b/test/test_rdoc_markup_to_html.rb index 59889dcc5a..86829df564 100644 --- a/test/test_rdoc_markup_to_html.rb +++ b/test/test_rdoc_markup_to_html.rb @@ -727,18 +727,18 @@ def test_gen_url_ssl_image_url assert_equal '', @to.gen_url('https://example.com/image.png', 'ignored') end - def test_handle_special_HYPERLINK_link - special = RDoc::Markup::Special.new 0, 'link:README.txt' + def test_handle_regexp_HYPERLINK_link + target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt' - link = @to.handle_special_HYPERLINK special + link = @to.handle_regexp_HYPERLINK target assert_equal 'README.txt', link end - def test_handle_special_HYPERLINK_irc - special = RDoc::Markup::Special.new 0, 'irc://irc.freenode.net/#ruby-lang' + def test_handle_regexp_HYPERLINK_irc + target = RDoc::Markup::RegexpHandling.new 0, 'irc://irc.freenode.net/#ruby-lang' - link = @to.handle_special_HYPERLINK special + link = @to.handle_regexp_HYPERLINK target assert_equal 'irc.freenode.net/#ruby-lang', link end diff --git a/test/test_rdoc_markup_to_html_crossref.rb b/test/test_rdoc_markup_to_html_crossref.rb index 63fc95ff51..19cc6a8ec1 100644 --- a/test/test_rdoc_markup_to_html_crossref.rb +++ b/test/test_rdoc_markup_to_html_crossref.rb @@ -116,66 +116,66 @@ def test_gen_url @to.gen_url('http://example', 'HTTP example') end - def test_handle_special_CROSSREF - assert_equal "C2::C3", SPECIAL('C2::C3') + def test_handle_regexp_CROSSREF + assert_equal "C2::C3", REGEXP_HANDLING('C2::C3') end - def test_handle_special_CROSSREF_label + def test_handle_regexp_CROSSREF_label assert_equal "foo at C1#m", - SPECIAL('C1#m@foo') + REGEXP_HANDLING('C1#m@foo') end - def test_handle_special_CROSSREF_show_hash_false + def test_handle_regexp_CROSSREF_show_hash_false @to.show_hash = false assert_equal "m", - SPECIAL('#m') + REGEXP_HANDLING('#m') end - def test_handle_special_HYPERLINK_rdoc + def test_handle_regexp_HYPERLINK_rdoc readme = @store.add_file 'README.txt' readme.parser = RDoc::Parser::Simple @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2 - link = @to.handle_special_HYPERLINK hyper 'C2::C3' + link = @to.handle_regexp_HYPERLINK hyper 'C2::C3' assert_equal 'C2::C3', link - link = @to.handle_special_HYPERLINK hyper 'C4' + link = @to.handle_regexp_HYPERLINK hyper 'C4' assert_equal 'C4', link - link = @to.handle_special_HYPERLINK hyper 'README.txt' + link = @to.handle_regexp_HYPERLINK hyper 'README.txt' assert_equal 'README.txt', link end - def test_handle_special_TIDYLINK_rdoc + def test_handle_regexp_TIDYLINK_rdoc readme = @store.add_file 'README.txt' readme.parser = RDoc::Parser::Simple @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c2 - link = @to.handle_special_TIDYLINK tidy 'C2::C3' + link = @to.handle_regexp_TIDYLINK tidy 'C2::C3' assert_equal 'tidy', link - link = @to.handle_special_TIDYLINK tidy 'C4' + link = @to.handle_regexp_TIDYLINK tidy 'C4' assert_equal 'tidy', link - link = @to.handle_special_TIDYLINK tidy 'C1#m' + link = @to.handle_regexp_TIDYLINK tidy 'C1#m' assert_equal 'tidy', link - link = @to.handle_special_TIDYLINK tidy 'README.txt' + link = @to.handle_regexp_TIDYLINK tidy 'README.txt' assert_equal 'tidy', link end - def test_handle_special_TIDYLINK_label - link = @to.handle_special_TIDYLINK tidy 'C1#m@foo' + def test_handle_regexp_TIDYLINK_label + link = @to.handle_regexp_TIDYLINK tidy 'C1#m@foo' assert_equal "tidy", link, 'C1#m@foo' @@ -217,20 +217,20 @@ def para text "\n

#{text}

\n" end - def SPECIAL text - @to.handle_special_CROSSREF special text + def REGEXP_HANDLING text + @to.handle_regexp_CROSSREF regexp_handling text end def hyper reference - RDoc::Markup::Special.new 0, "rdoc-ref:#{reference}" + RDoc::Markup::RegexpHandling.new 0, "rdoc-ref:#{reference}" end - def special text - RDoc::Markup::Special.new 0, text + def regexp_handling text + RDoc::Markup::RegexpHandling.new 0, text end def tidy reference - RDoc::Markup::Special.new 0, "{tidy}[rdoc-ref:#{reference}]" + RDoc::Markup::RegexpHandling.new 0, "{tidy}[rdoc-ref:#{reference}]" end end diff --git a/test/test_rdoc_markup_to_html_snippet.rb b/test/test_rdoc_markup_to_html_snippet.rb index 98102ba553..a114b896a9 100644 --- a/test/test_rdoc_markup_to_html_snippet.rb +++ b/test/test_rdoc_markup_to_html_snippet.rb @@ -652,10 +652,10 @@ def test_convert_TIDYLINK_rdoc_label assert_equal 3, @to.characters end - def test_handle_special_HYPERLINK_link - special = RDoc::Markup::Special.new 0, 'link:README.txt' + def test_handle_regexp_HYPERLINK_link + target = RDoc::Markup::RegexpHandling.new 0, 'link:README.txt' - link = @to.handle_special_HYPERLINK special + link = @to.handle_regexp_HYPERLINK target assert_equal 'README.txt', link end From 9262fdd43a3a87403dc095e096f968576cd611d9 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 7 Sep 2018 15:30:55 +0900 Subject: [PATCH 0594/1389] Added initial rubocop rule --- .rubocop.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000000..9b1b621f8a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,8 @@ +AllCops: + TargetRubyVersion: 2.5 + DisabledByDefault: true + Exclude: + - rdoc.gemspec + +Layout/TrailingWhitespace: + Enabled: true From 1917dcdf1714a7f738a44c484c0ae70ca86552f0 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 7 Sep 2018 15:35:52 +0900 Subject: [PATCH 0595/1389] Removed trailing-space --- test/test_rdoc_parser_ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 8e31141f59..8a3e723614 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -4087,7 +4087,7 @@ def test_parse_include_by_dynamic_definition_without_paren module A class B include(Module.new do - def e m + def e m end end) end From e448a542857c8ec5fe657cbc04a4eec787915b46 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 7 Sep 2018 16:00:55 +0900 Subject: [PATCH 0596/1389] Added rubocop task after generating kpeg files. Because it files always contained trailing-whitespaces. --- Rakefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 63aab4ffd5..8fbfa03711 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,7 @@ $:.unshift File.expand_path 'lib' require 'rdoc/task' require 'bundler/gem_tasks' require 'rake/testtask' +require 'rubocop/rake_task' task :docs => :generate task :test => :generate @@ -80,7 +81,11 @@ end task "#{path}.gem" => package_parser_files +RuboCop::RakeTask.new(:rubocop) do |t| + t.options = [*parsed_files] +end + desc "Genrate all files used racc and kpeg" task :generate => parsed_files -task :build => [:generate] +task :build => [:generate, "rubocop:auto_correct"] From 14205f371ee76c4f531c94ca30a05d7fea173342 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Fri, 7 Sep 2018 16:11:37 +0900 Subject: [PATCH 0597/1389] Added dependency --- rdoc.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/rdoc.gemspec b/rdoc.gemspec index efef1863b9..eb2413f042 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -58,4 +58,5 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.add_development_dependency("racc", "> 1.4.10") s.add_development_dependency("kpeg") s.add_development_dependency("minitest", "~> 5") + s.add_development_dependency("rubocop") end From b836c3378ee17f7c120a442cd27294aad226f562 Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sun, 7 Oct 2018 12:04:11 +0200 Subject: [PATCH 0598/1389] Improve language in "alias for" comment for ri --- lib/rdoc/ri/driver.rb | 2 +- test/test_rdoc_ri_driver.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index c4d1dd03df..46b98e99b5 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1468,7 +1468,7 @@ def render_method_comment out, method, alias_for = nil# :nodoc: out << method.comment end out << RDoc::Markup::BlankLine.new - out << RDoc::Markup::Paragraph.new("(this method is alias for #{alias_for.full_name})") + out << RDoc::Markup::Paragraph.new("(This method is an alias for #{alias_for.full_name}.)") out << RDoc::Markup::BlankLine.new out << alias_for.comment out << RDoc::Markup::BlankLine.new diff --git a/test/test_rdoc_ri_driver.rb b/test/test_rdoc_ri_driver.rb index f636c6346f..18dcb5b68a 100644 --- a/test/test_rdoc_ri_driver.rb +++ b/test/test_rdoc_ri_driver.rb @@ -260,7 +260,7 @@ def test_add_method_that_is_alias_for_original para('alias comment'), blank_line, blank_line, - para('(this method is alias for Qux#original)'), + para('(This method is an alias for Qux#original.)'), blank_line, para('original comment'), blank_line, From dd75c6cad0f7a4ee9ee254c3ddf90bf15fa1a0fc Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Oct 2018 13:56:39 +0900 Subject: [PATCH 0599/1389] Remove unnecessary variable --- lib/rdoc/markup/to_html_crossref.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 404e2ccfd5..6020263799 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -126,8 +126,6 @@ def gen_url url, text # Creates an HTML link to +name+ with the given +text+. def link name, text - original_name = name - if name =~ /(.*[^#:])@/ then name = $1 label = $' From 9b826f710da4d7fd039c7456a39150a6af01aa9d Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 17 Oct 2018 14:22:16 +0900 Subject: [PATCH 0600/1389] Remove lib/rdoc/markup/{inline,special}.rb from s.files --- rdoc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index eb2413f042..9c6fbe1970 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -32,7 +32,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "lib/rdoc/version.rb", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/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/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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "lib/rdoc/version.rb", "rdoc.gemspec"] # files from .gitignore s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb" From b1bba637216d9204f5f0a3fe0c82b8b25b319fcb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 28 Oct 2018 00:20:53 +0900 Subject: [PATCH 0601/1389] Mark up code inside link text as --- lib/rdoc/markup/to_html_crossref.rb | 22 +++++++---- test/test_rdoc_markup_to_html_crossref.rb | 46 +++++++++++------------ 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb index 6020263799..2fbddeb83b 100644 --- a/lib/rdoc/markup/to_html_crossref.rb +++ b/lib/rdoc/markup/to_html_crossref.rb @@ -49,16 +49,19 @@ def initialize(options, from_path, context, markup = nil) # Creates a link to the reference +name+ if the name exists. If +text+ is # given it is used as the link text, otherwise +name+ is used. - def cross_reference name, text = nil + def cross_reference name, text = nil, code = true lookup = name name = name[1..-1] unless @show_hash if name[0, 1] == '#' - name = "#{CGI.unescape $'} at #{$1}" if name =~ /(.*[^#:])@/ - - text = name unless text + if name =~ /(.*[^#:])@/ + text ||= "#{CGI.unescape $'} at #{$1}" + code = false + else + text ||= name + end - link lookup, text + link lookup, text, code end ## @@ -119,13 +122,14 @@ def handle_regexp_RDOCLINK target def gen_url url, text return super unless url =~ /\Ardoc-ref:/ - cross_reference $', text + name = $' + cross_reference name, text, name == text end ## # Creates an HTML link to +name+ with the given +text+. - def link name, text + def link name, text, code = true if name =~ /(.*[^#:])@/ then name = $1 label = $' @@ -139,6 +143,10 @@ def link name, text else path = ref.as_href @from_path + if code and RDoc::CodeObject === ref and !(RDoc::TopLevel === ref) + text = "#{text}" + end + if path =~ /#/ then path << "-label-#{label}" elsif ref.sections and diff --git a/test/test_rdoc_markup_to_html_crossref.rb b/test/test_rdoc_markup_to_html_crossref.rb index 19cc6a8ec1..598bae3d3f 100644 --- a/test/test_rdoc_markup_to_html_crossref.rb +++ b/test/test_rdoc_markup_to_html_crossref.rb @@ -14,26 +14,26 @@ def setup def test_convert_CROSSREF result = @to.convert 'C1' - assert_equal para("C1"), result + assert_equal para("C1"), result end def test_convert_CROSSREF_label result = @to.convert 'C1@foo' - assert_equal para("foo at C1"), result + assert_equal para("foo at C1"), result result = @to.convert 'C1#m@foo' - assert_equal para("foo at C1#m"), + assert_equal para("foo at C1#m"), result end def test_convert_CROSSREF_label_period result = @to.convert 'C1@foo.' - assert_equal para("foo at C1."), result + assert_equal para("foo at C1."), result end def test_convert_CROSSREF_label_space result = @to.convert 'C1@foo+bar' - assert_equal para("foo bar at C1"), + assert_equal para("foo bar at C1"), result end @@ -41,31 +41,31 @@ def test_convert_CROSSREF_section @c1.add_section 'Section' result = @to.convert 'C1@Section' - assert_equal para("Section at C1"), result + assert_equal para("Section at C1"), result end def test_convert_CROSSREF_constant result = @to.convert 'C1::CONST' - assert_equal para("C1::CONST"), result + assert_equal para("C1::CONST"), result end def test_convert_RDOCLINK_rdoc_ref result = @to.convert 'rdoc-ref:C1' - assert_equal para("C1"), result + assert_equal para("C1"), result end def test_convert_RDOCLINK_rdoc_ref_method result = @to.convert 'rdoc-ref:C1#m' - assert_equal para("C1#m"), result + assert_equal para("C1#m"), result end def test_convert_RDOCLINK_rdoc_ref_method_label result = @to.convert 'rdoc-ref:C1#m@foo' - assert_equal para("foo at C1#m"), + assert_equal para("foo at C1#m"), result, 'rdoc-ref:C1#m@foo' end @@ -75,13 +75,13 @@ def test_convert_RDOCLINK_rdoc_ref_method_percent result = @to.convert 'rdoc-ref:C1#%' - assert_equal para("C1#%"), result + assert_equal para("C1#%"), result m.singleton = true result = @to.convert 'rdoc-ref:C1::%' - assert_equal para("C1::%"), result + assert_equal para("C1::%"), result end def test_convert_RDOCLINK_rdoc_ref_method_percent_label @@ -90,21 +90,21 @@ def test_convert_RDOCLINK_rdoc_ref_method_percent_label result = @to.convert 'rdoc-ref:C1#%@f' - assert_equal para("f at C1#%"), + assert_equal para("f at C1#%"), result m.singleton = true result = @to.convert 'rdoc-ref:C1::%@f' - assert_equal para("f at C1::%"), + assert_equal para("f at C1::%"), result end def test_convert_RDOCLINK_rdoc_ref_label result = @to.convert 'rdoc-ref:C1@foo' - assert_equal para("foo at C1"), result, + assert_equal para("foo at C1"), result, 'rdoc-ref:C1@foo' end @@ -117,18 +117,18 @@ def test_gen_url end def test_handle_regexp_CROSSREF - assert_equal "C2::C3", REGEXP_HANDLING('C2::C3') + assert_equal "C2::C3", REGEXP_HANDLING('C2::C3') end def test_handle_regexp_CROSSREF_label - assert_equal "foo at C1#m", + assert_equal "foo at C1#m", REGEXP_HANDLING('C1#m@foo') end def test_handle_regexp_CROSSREF_show_hash_false @to.show_hash = false - assert_equal "m", + assert_equal "m", REGEXP_HANDLING('#m') end @@ -140,11 +140,11 @@ def test_handle_regexp_HYPERLINK_rdoc link = @to.handle_regexp_HYPERLINK hyper 'C2::C3' - assert_equal 'C2::C3', link + assert_equal 'C2::C3', link link = @to.handle_regexp_HYPERLINK hyper 'C4' - assert_equal 'C4', link + assert_equal 'C4', link link = @to.handle_regexp_HYPERLINK hyper 'README.txt' @@ -200,16 +200,16 @@ def test_to_html_CROSSREF_email_hyperlink_all def test_link assert_equal 'n', @to.link('n', 'n') - assert_equal 'm', @to.link('m', 'm') + assert_equal 'm', @to.link('m', 'm') end def test_link_for_method_traverse @to = RDoc::Markup::ToHtmlCrossref.new @options, 'C2.html', @c9 - assert_equal 'C9::B#foo', @to.link('C9::B#foo', 'C9::B#foo') + assert_equal 'C9::B#foo', @to.link('C9::B#foo', 'C9::B#foo') end def test_link_class_method_full - assert_equal 'Parent::m', + assert_equal 'Parent::m', @to.link('Parent::m', 'Parent::m') end From 1ce2ccc2abe2ea7e3746ba307d0b1959ba5d0529 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 29 Oct 2018 15:07:02 +0900 Subject: [PATCH 0602/1389] rdoc/parser/c.rb: ignore dynamically added methods * lib/rdoc/parser/c.rb (RDoc::Parser::C#deduplicate_call_seq): skip dynamically added methods at runtime, because the class name is unknown and the defined methods are not accessible from that class. --- lib/rdoc/parser/c.rb | 1 + test/test_rdoc_parser_c.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 183538d54b..425ea11f63 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -217,6 +217,7 @@ def @enclosure_dependencies.tsort_each_child node, &block def deduplicate_call_seq @methods.each do |var_name, functions| class_name = @known_classes[var_name] + next unless class_name class_obj = find_class var_name, class_name functions.each_value do |method_names| diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index b8bdbca7fd..3d30d767df 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -1630,6 +1630,19 @@ def test_define_method assert read_method.singleton end + def test_define_method_dynamically + content = <<-EOF +void +Init_foo(void) +{ + rb_define_singleton_method(obj, "foo", foo, -1); +} + EOF + + klass = util_get_class content, 'obj' + assert_nil klass + end + def test_define_method_with_prototype content = <<-EOF static VALUE rb_io_s_read(int, VALUE*, VALUE); From ceabeac50e3cd3252ea343e0743010017a76c5e4 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 11 Mar 2018 23:43:29 +0900 Subject: [PATCH 0603/1389] Use Ruby 2.3.8, 2.4.5, and 2.5.3 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 365c638261..e8ea459f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ before_install: - gem update bundler language: ruby rvm: - - 2.3.7 - - 2.4.4 - - 2.5.1 + - 2.3.8 + - 2.4.5 + - 2.5.3 - ruby-head - jruby-9.1.17.0 - jruby-9.2.0.0 From f5321b33d69340798b12cde14170f220d374aa91 Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 6 Nov 2018 18:35:28 +1100 Subject: [PATCH 0604/1389] add ruby 2.5 to appveyor --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 93e7745823..6238bbffba 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,4 +29,6 @@ environment: - ruby_version: 23-x64 - ruby_version: 24 - ruby_version: 24-x64 + - ruby_version: 25 + - ruby_version: 25-x64 - ruby_version: _trunk From ef604d213320780ba25a56153cddd4c9985f00ca Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 7 Nov 2018 20:43:31 +0900 Subject: [PATCH 0605/1389] Move ruby-head to allow_failures in .travis.yml Travis CI tests with ruby-head fail in Racc processing and I still can't reproduce it locally. Maybe it's heavy problem and I'm surveying about that. The ruby-head should be disabled until the problem is solved. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 365c638261..a2fbffcb97 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,5 +16,6 @@ env: script: rake matrix: allow_failures: + - rvm: ruby-head - rvm: jruby-9.1.17.0 - rvm: jruby-9.2.0.0 From e74274fb2466616232ff72bf12e5149bb4147962 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 8 Nov 2018 18:41:59 +0900 Subject: [PATCH 0606/1389] Use JRuby 9.2.1.0 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b6fc45121c..68b855c97d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.5.3 - ruby-head - jruby-9.1.17.0 - - jruby-9.2.0.0 + - jruby-9.2.1.0 env: global: NOBENCHMARK=1 @@ -18,4 +18,4 @@ matrix: allow_failures: - rvm: ruby-head - rvm: jruby-9.1.17.0 - - rvm: jruby-9.2.0.0 + - rvm: jruby-9.2.1.0 From ea22758ccfe27077d58178a21463c101868a3b05 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 11 Nov 2018 06:27:38 +0900 Subject: [PATCH 0607/1389] Use JRuby 9.2.3.0 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 68b855c97d..9307516752 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.5.3 - ruby-head - jruby-9.1.17.0 - - jruby-9.2.1.0 + - jruby-9.2.3.0 env: global: NOBENCHMARK=1 @@ -18,4 +18,4 @@ matrix: allow_failures: - rvm: ruby-head - rvm: jruby-9.1.17.0 - - rvm: jruby-9.2.1.0 + - rvm: jruby-9.2.3.0 From 008a792e745e660cc681a86437b2a0a92570cdb7 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 15 Nov 2018 21:40:01 +0900 Subject: [PATCH 0608/1389] Use JRuby 9.2.4.0 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9307516752..a6038b8fbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.5.3 - ruby-head - jruby-9.1.17.0 - - jruby-9.2.3.0 + - jruby-9.2.4.0 env: global: NOBENCHMARK=1 @@ -18,4 +18,4 @@ matrix: allow_failures: - rvm: ruby-head - rvm: jruby-9.1.17.0 - - rvm: jruby-9.2.3.0 + - rvm: jruby-9.2.4.0 From aff29255ede1c8f8f4f53ccce3f5da288898329d Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 27 Nov 2018 08:55:11 +0900 Subject: [PATCH 0609/1389] Use @pwd instead of __FILE__ for test dir --- test/test_rdoc_generator_json_index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index ca7260c820..400a77f075 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -96,7 +96,7 @@ def test_generate assert_file 'js/navigation.js' assert_file 'js/search_index.js' - srcdir = File.expand_path("../../lib/rdoc", __FILE__) + srcdir = File.expand_path('lib/rdoc', @pwd) if !File.directory? srcdir # for Ruby core repository srcdir = File.expand_path("../../../lib/rdoc", __FILE__) From f972375099a232cb0c554dd8067983f5fb696ef2 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 27 Nov 2018 15:39:28 +0900 Subject: [PATCH 0610/1389] Add description to a timestamp assertion --- test/test_rdoc_generator_json_index.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index 400a77f075..b057832329 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -109,7 +109,11 @@ def test_generate assert orig_file.mtime.inspect == generated_file.mtime.inspect, '.js files should be tha same timestamp of original' - assert generated_file.mtime < now, '.js files should be the same timestamp' + assert generated_file.mtime < now, + ".js files should be the same timestamp,\n" + + "path: #{generated_file.inspect},\n" + + "time: #{generated_file.mtime.inspect},\n" + + "now : #{now.inspect}" generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js') assert generated_search_index.mtime > (now - 1), 'search_index.js should be generated timestamp' From 355c4e46f11982440da86e623380f7421e21029d Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 27 Nov 2018 15:49:15 +0900 Subject: [PATCH 0611/1389] Bump version to 6.1.0.beta2 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index 5139f8dd4b..7ad9d47a25 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.1.0.beta1' + VERSION = '6.1.0.beta2' end From 3754646b75bd80636107fcb77868b934acb3dd47 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 28 Nov 2018 15:52:15 +0900 Subject: [PATCH 0612/1389] Use VT100 sequence to erase previous line --- lib/rdoc/stats/normal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index a3a6ff377e..41e6040452 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -42,7 +42,7 @@ def print_file files_so_far, filename if $stdout.tty? # Clean the line with whitespaces so that leftover output from the # previous line doesn't show up. - $stdout.print("\r" + (" " * @last_width) + ("\b" * @last_width) + "\r") if @last_width && @last_width > 0 + $stdout.print("\r\e[K") if @last_width && @last_width > 0 @last_width = line.size $stdout.print("#{line}\r") else From 2b849f9ee315b0714fb9a1a4769066f073b125a6 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 3 Dec 2018 16:02:24 +0900 Subject: [PATCH 0613/1389] Use JRuby 9.2.4.1 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6038b8fbd..b46fd1fa8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ rvm: - 2.5.3 - ruby-head - jruby-9.1.17.0 - - jruby-9.2.4.0 + - jruby-9.2.4.1 env: global: NOBENCHMARK=1 @@ -18,4 +18,4 @@ matrix: allow_failures: - rvm: ruby-head - rvm: jruby-9.1.17.0 - - rvm: jruby-9.2.4.0 + - rvm: jruby-9.2.4.1 From e6326db2e2cf4d01941e9f9b5bd6a013cae6805a Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 1 Dec 2018 18:37:51 +0900 Subject: [PATCH 0614/1389] Set UTF-8 to use Unicode property The default encoding on AppVeyor is Encoding::IBM437. --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 93e7745823..7f1ea6ac4a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,7 @@ --- init: + # Set UTF-8 to use Unicode property because the defualt encoding on AppVeyor is Encoding::IBM437 + - set RUBYOPT=-EUTF-8 # To avoid duplicated executables in PATH, see https://github.com/ruby/spec/pull/468 - set PATH=C:\ruby%RUBY_VERSION%\bin;C:\msys64\usr\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Program Files;C:\Windows # Loads trunk build and updates MSYS2 / MinGW to most recent gcc compiler From ed698a63930af237eaf58827b78ef34474cb0eae Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 3 Dec 2018 17:23:02 +0900 Subject: [PATCH 0615/1389] Add AppVeyor badge to README.md --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 1ab223b1c2..a0224acc85 100644 --- a/README.rdoc +++ b/README.rdoc @@ -3,7 +3,7 @@ home :: https://github.com/ruby/rdoc rdoc :: https://ruby.github.io/rdoc bugs :: https://github.com/ruby/rdoc/issues -build status :: {Build Status}[https://travis-ci.org/ruby/rdoc] +build status :: {Build Status on Travis CI}[https://travis-ci.org/ruby/rdoc] {Build Status on AppVeyor}[https://ci.appveyor.com/project/ruby/rdoc] code quality :: {Code Climate}[https://codeclimate.com/github/ruby/rdoc] == Description From 384ea4cc76b55f4dbaf7dfd386876b5ea18c9c8b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 28 Nov 2018 15:59:53 +0900 Subject: [PATCH 0616/1389] Log full lines unless output is a tty --- lib/rdoc/stats/normal.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index 41e6040452..0c661c5498 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -26,28 +26,28 @@ def print_file files_so_far, filename files_so_far, @num_files) - # Print a progress bar, but make sure it fits on a single line. Filename - # will be truncated if necessary. - size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize - terminal_width = size[1].to_i.nonzero? || 80 - max_filename_size = terminal_width - progress_bar.size - - if filename.size > max_filename_size then - # Turn "some_long_filename.rb" to "...ong_filename.rb" - filename = filename[(filename.size - max_filename_size) .. -1] - filename[0..2] = "..." - end - - line = "#{progress_bar}#{filename}" if $stdout.tty? + # Print a progress bar, but make sure it fits on a single line. Filename + # will be truncated if necessary. + size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize + terminal_width = size[1].to_i.nonzero? || 80 + max_filename_size = terminal_width - progress_bar.size + + if filename.size > max_filename_size then + # Turn "some_long_filename.rb" to "...ong_filename.rb" + filename = filename[(filename.size - max_filename_size) .. -1] + filename[0..2] = "..." + end + # Clean the line with whitespaces so that leftover output from the # previous line doesn't show up. $stdout.print("\r\e[K") if @last_width && @last_width > 0 - @last_width = line.size - $stdout.print("#{line}\r") + @last_width = progress_bar.size + filename.size + term = "\r" else - $stdout.puts(line) + term = "\n" end + $stdout.print(progress_bar, filename, term) $stdout.flush end From 0c23002a91003b7fdf4768b21f5eadcaac796f94 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 2 Dec 2018 12:06:30 +0900 Subject: [PATCH 0617/1389] Place expression next line of `else` It is not a bug, but very confusing when multiple lines block follows. --- lib/rdoc/markup/parser.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index f08587e676..a8d5f8441c 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -505,7 +505,8 @@ def tokenize input when @s.scan(/(.*?)::( +|\r?$)/) then [:NOTE, @s[1], *token_pos(pos)] # anything else: :TEXT - else @s.scan(/(.*?)( )?\r?$/) + else + @s.scan(/(.*?)( )?\r?$/) token = [:TEXT, @s[1], *token_pos(pos)] if @s[2] then From b33f2e8d3d58b50811e747ea88ba0f5daa84d948 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 2 Dec 2018 11:53:17 +0900 Subject: [PATCH 0618/1389] Merge ruby/ruby@03cde6c805bea904111311de87a1714aa902c5d3 --- lib/rdoc/markup/to_markdown.rb | 2 +- lib/rdoc/markup/to_rdoc.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb index 7932815405..3ee48becb0 100644 --- a/lib/rdoc/markup/to_markdown.rb +++ b/lib/rdoc/markup/to_markdown.rb @@ -131,7 +131,7 @@ def accept_verbatim verbatim @res << part end - @res << "\n" unless @res =~ /\n\z/ + @res << "\n" end ## diff --git a/lib/rdoc/markup/to_rdoc.rb b/lib/rdoc/markup/to_rdoc.rb index 3aee85afbe..81b16c4973 100644 --- a/lib/rdoc/markup/to_rdoc.rb +++ b/lib/rdoc/markup/to_rdoc.rb @@ -234,7 +234,7 @@ def accept_verbatim verbatim @res << part end - @res << "\n" unless @res =~ /\n\z/ + @res << "\n" end ## From 9f5fcdd5e217a58b44df48ebaa03464ff5c668ac Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 2 Dec 2018 11:55:25 +0900 Subject: [PATCH 0619/1389] RDoc::Options#exclude should return regexp or nil --- lib/rdoc/options.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 99d7aaaec1..801a84b21f 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -164,7 +164,7 @@ class RDoc::Options ## # Files matching this pattern will be excluded - attr_accessor :exclude + attr_writer :exclude ## # The list of files to be processed @@ -493,6 +493,20 @@ def encode_with coder # :nodoc: end end + ## + # Create a regexp for #exclude + + def exclude + if @exclude.nil? or Regexp === @exclude then + # done, #finish is being re-run + @exclude + elsif @exclude.empty? then + nil + else + Regexp.new(@exclude.join("|")) + end + end + ## # Completes any unfinished option setup business such as filtering for # existent files, creating a regexp for #exclude and setting a default @@ -505,13 +519,7 @@ def finish root = @root.to_s @rdoc_include << root unless @rdoc_include.include?(root) - if @exclude.nil? or Regexp === @exclude then - # done, #finish is being re-run - elsif @exclude.empty? then - @exclude = nil - else - @exclude = Regexp.new(@exclude.join("|")) - end + @exclude = self.exclude finish_page_dir From b02b37d4b29f31b7b053e71dcb6323e305eae128 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 2 Dec 2018 12:11:48 +0900 Subject: [PATCH 0620/1389] Support blockquote RDoc::Markup::BlockQuote is supported by RDoc::Markdown, but not RDoc::Markup yet and the syntax for it is not too. This patch implements `>>>` as blockquote tentatively, ``` >>> foo ``` to ```

foo

``` --- lib/rdoc/markup/parser.rb | 19 ++++++++++++++++-- test/test_rdoc_markup_parser.rb | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index f08587e676..be4a72c406 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -9,8 +9,9 @@ # RDoc::Markup::ToHTML. # # The parser only handles the block-level constructs Paragraph, List, -# ListItem, Heading, Verbatim, BlankLine and Rule. Inline markup such as -# \+blah\+ is handled separately by RDoc::Markup::AttributeManager. +# ListItem, Heading, Verbatim, BlankLine, Rule and BlockQuote. +# Inline markup such as \+blah\+ is handled separately by +# RDoc::Markup::AttributeManager. # # To see what markup the Parser implements read RDoc. To see how to use # RDoc markup to format text in your program read RDoc::Markup. @@ -381,6 +382,17 @@ def parse parent, indent = 0 when :TEXT then unget parse_text parent, indent + when :BLOCKQUOTE then + type, _, column = get + if type == :NEWLINE + type, _, column = get + end + unget if type + bq = RDoc::Markup::BlockQuote.new + p :blockquote_start => [data, column] if @debug + parse bq, column + p :blockquote_end => indent if @debug + parent << bq when *LIST_TOKENS then unget parent << build_list(indent) @@ -504,6 +516,9 @@ def tokenize input # text:: followed by spaces or end of line => :NOTE when @s.scan(/(.*?)::( +|\r?$)/) then [:NOTE, @s[1], *token_pos(pos)] + # >>> followed by end of line => :BLOCKQUOTE + when @s.scan(/>>> *(\w+)?$/) then + [:BLOCKQUOTE, @s[1], *token_pos(pos)] # anything else: :TEXT else @s.scan(/(.*?)( )?\r?$/) token = [:TEXT, @s[1], *token_pos(pos)] diff --git a/test/test_rdoc_markup_parser.rb b/test/test_rdoc_markup_parser.rb index 6d4953bc06..344d67df39 100644 --- a/test/test_rdoc_markup_parser.rb +++ b/test/test_rdoc_markup_parser.rb @@ -1045,6 +1045,41 @@ def test_parse_whitespace assert_equal expected, @RMP.parse(" 1\n 2\n\n 3").parts end + def test_parse_block_quote + expected = [ + @RM::BlockQuote.new(@RM::Paragraph.new("foo")) + ] + assert_equal expected, @RMP.parse(<<-DOC).parts +>>> + foo + DOC + + expected = [ + @RM::BlockQuote.new(@RM::Paragraph.new("foo"), + @RM::Verbatim.new("code\n"), + @RM::Paragraph.new("bar")) + ] + assert_equal expected, @RMP.parse(<<-DOC).parts +>>> + foo + code + bar + DOC + + expected = [ + @RM::BlockQuote.new(@RM::Paragraph.new("foo"), + @RM::BlockQuote.new(@RM::Paragraph.new("bar")), + @RM::Paragraph.new("zot")) + ] + assert_equal expected, @RMP.parse(<<-DOC).parts +>>> + foo + >>> + bar + zot + DOC + end + def test_peek_token parser = util_parser From a446cb105fced383f6f51006d5f67490ba176509 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 28 Nov 2018 15:02:36 +0900 Subject: [PATCH 0621/1389] Reduce 1 char from progress output for Windows Windows command prompt force wraps at the maximum number of chars of the last line so this commit reduces 1 char of it. --- lib/rdoc/stats/normal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index 0c661c5498..0a22f0582b 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -31,7 +31,7 @@ def print_file files_so_far, filename # will be truncated if necessary. size = IO.respond_to?(:console_size) ? IO.console_size : IO.console.winsize terminal_width = size[1].to_i.nonzero? || 80 - max_filename_size = terminal_width - progress_bar.size + max_filename_size = (terminal_width - progress_bar.size) - 1 if filename.size > max_filename_size then # Turn "some_long_filename.rb" to "...ong_filename.rb" From 4f426a6f02cffebfbb3936b85221232f1f8dac46 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sat, 8 Dec 2018 10:34:48 +0900 Subject: [PATCH 0622/1389] Remove Time.now from test for comparison of timestamp Because some environment especially CI, it behaves strangely in timestamp and Time.now. --- test/test_rdoc_generator_json_index.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index b057832329..ab8f6f1521 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -89,7 +89,6 @@ def test_file_dir end def test_generate - now = Time.now @g.generate assert_file 'js/searcher.js' @@ -109,15 +108,6 @@ def test_generate assert orig_file.mtime.inspect == generated_file.mtime.inspect, '.js files should be tha same timestamp of original' - assert generated_file.mtime < now, - ".js files should be the same timestamp,\n" + - "path: #{generated_file.inspect},\n" + - "time: #{generated_file.mtime.inspect},\n" + - "now : #{now.inspect}" - - generated_search_index = Pathname(File.join @tmpdir, 'js/search_index.js') - assert generated_search_index.mtime > (now - 1), 'search_index.js should be generated timestamp' - json = File.read 'js/search_index.js' json =~ /\Avar search_data = / From 7f975353aa545d301d2278987eb59e3875c3b931 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 9 Dec 2018 02:18:27 +0900 Subject: [PATCH 0623/1389] Bump version to 6.1.0.beta3 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index 7ad9d47a25..5e48f073da 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.1.0.beta2' + VERSION = '6.1.0.beta3' end From 7a0998145fb8fbc836cdf1f19858ab5834159b07 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Sun, 9 Dec 2018 21:38:05 +0900 Subject: [PATCH 0624/1389] Fix random test failure by Bundler integration --- test/minitest_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index 1814669bf9..9fb0cd676b 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true +require 'bundler/errors' begin gem 'minitest', '~> 5.0' -rescue NoMethodError, Gem::LoadError +rescue NoMethodError, Gem::LoadError, Bundler::GemfileNotFound # for ruby tests end From ba8f9bfdb2be16dcd4fbe82a34fbd0504bc5af45 Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 23 Dec 2018 21:44:59 +0900 Subject: [PATCH 0625/1389] Bump version to 6.1.0 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index 5e48f073da..9f66c50a5f 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.1.0.beta3' + VERSION = '6.1.0' end From b7a43ac557998b4ee5bd360365fde17c3fa6f1e1 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 24 Dec 2018 16:20:10 +0900 Subject: [PATCH 0626/1389] Remove ruby-head from allow_failures --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b46fd1fa8d..60f29f0b5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,5 @@ env: script: rake matrix: allow_failures: - - rvm: ruby-head - rvm: jruby-9.1.17.0 - rvm: jruby-9.2.4.1 From 814880d56ee0e8d7f2fbf5f47d9b48f866b64756 Mon Sep 17 00:00:00 2001 From: mame Date: Wed, 26 Dec 2018 06:01:18 +0000 Subject: [PATCH 0627/1389] test/rdoc: skip some tests when euid is root root user can access a file whose permission is 0000. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_rdoc_options.rb | 1 + test/test_rdoc_rdoc.rb | 1 + test/test_rdoc_rubygems_hook.rb | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb index 394d155241..baef2d860e 100644 --- a/test/test_rdoc_options.rb +++ b/test/test_rdoc_options.rb @@ -18,6 +18,7 @@ def teardown def test_check_files skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM + skip "assumes that euid is not root" if Process.euid == 0 out, err = capture_io do temp_dir do diff --git a/test/test_rdoc_rdoc.rb b/test/test_rdoc_rdoc.rb index 4014ecfa54..3bce54b243 100644 --- a/test/test_rdoc_rdoc.rb +++ b/test/test_rdoc_rdoc.rb @@ -350,6 +350,7 @@ def test_parse_file_encoding def test_parse_file_forbidden skip 'chmod not supported' if Gem.win_platform? + skip "assumes that euid is not root" if Process.euid == 0 @rdoc.store = RDoc::Store.new diff --git a/test/test_rdoc_rubygems_hook.rb b/test/test_rdoc_rubygems_hook.rb index 2fb79ff577..ff0c29ae1b 100644 --- a/test/test_rdoc_rubygems_hook.rb +++ b/test/test_rdoc_rubygems_hook.rb @@ -200,6 +200,8 @@ def test_remove def test_remove_unwritable skip 'chmod not supported' if Gem.win_platform? + skip "assumes that euid is not root" if Process.euid == 0 + FileUtils.mkdir_p @a.base_dir FileUtils.chmod 0, @a.base_dir @@ -228,6 +230,8 @@ def test_setup def test_setup_unwritable skip 'chmod not supported' if Gem.win_platform? + skip "assumes that euid is not root" if Process.euid == 0 + FileUtils.mkdir_p @a.doc_dir FileUtils.chmod 0, @a.doc_dir From 1940b2318c6001b2a6ce002871e2918203bbbebf Mon Sep 17 00:00:00 2001 From: poloka Date: Wed, 26 Dec 2018 13:06:23 -0600 Subject: [PATCH 0628/1389] Correction to include regexp_handling in list of loaded files --- rdoc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rdoc.gemspec b/rdoc.gemspec index 9c6fbe1970..99bf3a63f5 100644 --- a/rdoc.gemspec +++ b/rdoc.gemspec @@ -32,7 +32,7 @@ RDoc includes the +rdoc+ and +ri+ tools for generating and displaying documentat s.executables = ["rdoc", "ri"] s.require_paths = ["lib"] # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/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/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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "lib/rdoc/version.rb", "rdoc.gemspec"] + s.files = [".document", ".gitignore", ".travis.yml", "CONTRIBUTING.rdoc", "CVE-2013-0256.rdoc", "ExampleMarkdown.md", "ExampleRDoc.rdoc", "Gemfile", "History.rdoc", "LEGAL.rdoc", "LICENSE.rdoc", "README.rdoc", "RI.rdoc", "Rakefile", "TODO.rdoc", "appveyor.yml", "bin/console", "bin/setup", "exe/rdoc", "exe/ri", "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/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/ri.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/css/rdoc.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/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/entities.rb", "lib/rdoc/markdown/literals.kpeg", "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/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/regexp_handling.rb", "lib/rdoc/markup/rule.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/ripper_state_lex.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.ry", "lib/rdoc/rd/inline.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/ri/task.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/text.rb", "lib/rdoc/token_stream.rb", "lib/rdoc/tom_doc.rb", "lib/rdoc/top_level.rb", "lib/rdoc/version.rb", "rdoc.gemspec"] # files from .gitignore s.files << "lib/rdoc/rd/block_parser.rb" << "lib/rdoc/rd/inline_parser.rb" << "lib/rdoc/markdown.rb" << "lib/rdoc/markdown/literals.rb" From 55c0627fe02160da4431d064546ad3eaf0d04a05 Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 27 Dec 2018 07:09:56 +0900 Subject: [PATCH 0629/1389] Bump version to 6.1.1 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index 9f66c50a5f..d9c4aa154d 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.1.0' + VERSION = '6.1.1' end From d86e0ac937d83bc552cc6a1b6e3b86f858d01dbe Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 1 Jan 2019 00:49:44 +0900 Subject: [PATCH 0630/1389] Add 2.6.0 to .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b46fd1fa8d..22c0ed5672 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ rvm: - 2.3.8 - 2.4.5 - 2.5.3 + - 2.6.0 - ruby-head - jruby-9.1.17.0 - jruby-9.2.4.1 From 724e438b07527e28dbb94588f2c20bab8d750639 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 4 Jan 2019 14:41:48 +0900 Subject: [PATCH 0631/1389] Drop Ruby 2.2 from test because of EOL --- appveyor.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ad6cb27b71..b16c24e10f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,8 +25,6 @@ deploy: off environment: NOBENCHMARK: 1 matrix: - - ruby_version: 22 - - ruby_version: 22-x64 - ruby_version: 23 - ruby_version: 23-x64 - ruby_version: 24 From 0bc02787ba5c3f3e3fc95ceebebcc9daddb11808 Mon Sep 17 00:00:00 2001 From: kazu Date: Fri, 4 Jan 2019 09:10:10 +0000 Subject: [PATCH 0632/1389] [DOC] Fix close tags [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parser/c.rb | 5 ++--- lib/rdoc/rdoc.rb | 2 +- lib/rdoc/task.rb | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 425ea11f63..19151d7b27 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -74,11 +74,11 @@ # Documentation for the named method. Use this when the method name is # unambiguous. # -# [Document-method: ClassName::method_name] +# [Document-method: ClassName::method_name] # Documentation for a singleton method in the given class. Use this when # the method name alone is ambiguous. # -# [Document-method: ClassName#method_name] +# [Document-method: ClassName#method_name] # Documentation for a instance method in the given class. Use this when the # method name alone is ambiguous. # @@ -1266,4 +1266,3 @@ def scan end end - diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb index ca2c1abefd..c60e017609 100644 --- a/lib/rdoc/rdoc.rb +++ b/lib/rdoc/rdoc.rb @@ -24,7 +24,7 @@ # rdoc.document argv # # Where +argv+ is an array of strings, each corresponding to an argument you'd -# give rdoc on the command line. See rdoc --help for details. +# give rdoc on the command line. See rdoc --help for details. class RDoc::RDoc diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb index 323d00eabc..0bedaa50b0 100644 --- a/lib/rdoc/task.rb +++ b/lib/rdoc/task.rb @@ -128,7 +128,7 @@ class RDoc::Task < Rake::TaskLib attr_accessor :template ## - # Name of format generator (--format) used by rdoc. (defaults to + # Name of format generator (--format) used by rdoc. (defaults to # rdoc's default) attr_accessor :generator From e5afa8999ebf97adef0931176b2d70738e3e1c84 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Jan 2019 09:25:32 +0000 Subject: [PATCH 0633/1389] [DOC] split a tag for each function name [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parser/c.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 19151d7b27..554efa6f1f 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -3,8 +3,8 @@ ## # RDoc::Parser::C attempts to parse C extension files. It looks for -# the standard patterns that you find in extensions: rb_define_class, -# rb_define_method and so on. It tries to find the corresponding +# the standard patterns that you find in extensions: rb_define_class, +# rb_define_method and so on. It tries to find the corresponding # C source for the methods and extract comments, but if we fail # we don't worry too much. # From 6a1e4a09f9d917ad17fc50701e989308b9eb7dbd Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Jan 2019 09:41:13 +0000 Subject: [PATCH 0634/1389] [DOC] mark function names [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parser/c.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 554efa6f1f..43a5df9126 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -3,15 +3,15 @@ ## # RDoc::Parser::C attempts to parse C extension files. It looks for -# the standard patterns that you find in extensions: rb_define_class, -# rb_define_method and so on. It tries to find the corresponding +# the standard patterns that you find in extensions: +rb_define_class+, +# +rb_define_method+ and so on. It tries to find the corresponding # C source for the methods and extract comments, but if we fail # we don't worry too much. # # The comments associated with a Ruby method are extracted from the C # comment block associated with the routine that _implements_ that # method, that is to say the method whose name is given in the -# rb_define_method call. For example, you might write: +# +rb_define_method+ call. For example, you might write: # # /* # * Returns a new array that is a one-dimensional flattening of this @@ -24,8 +24,7 @@ # * a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # */ # static VALUE -# rb_ary_flatten(ary) -# VALUE ary; +# rb_ary_flatten(VALUE ary) # { # ary = rb_obj_dup(ary); # rb_ary_flatten_bang(ary); @@ -35,16 +34,16 @@ # ... # # void -# Init_Array() +# Init_Array(void) # { # ... # rb_define_method(rb_cArray, "flatten", rb_ary_flatten, 0); # -# Here RDoc will determine from the rb_define_method line that there's a +# Here RDoc will determine from the +rb_define_method+ line that there's a # method called "flatten" in class Array, and will look for the implementation -# in the method rb_ary_flatten. It will then use the comment from that +# in the method +rb_ary_flatten+. It will then use the comment from that # method in the HTML output. This method must be in the same source file -# as the rb_define_method. +# as the +rb_define_method+. # # The comment blocks may include special directives: # From ca50871d53406de48ce8754a8b98ca17d107d385 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 4 Jan 2019 09:49:32 +0000 Subject: [PATCH 0635/1389] [DOC] escape descriptions [ci skip] Escape descriptions not to get parsed as directives. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parser/c.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 43a5df9126..e2283088cc 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -69,15 +69,15 @@ # [Document-variable: +name+] # Documentation for the named +rb_define_variable+ # -# [Document-method: +method_name+] +# [Document-method\: +method_name+] # Documentation for the named method. Use this when the method name is # unambiguous. # -# [Document-method: ClassName::method_name] +# [Document-method\: ClassName::method_name] # Documentation for a singleton method in the given class. Use this when # the method name alone is ambiguous. # -# [Document-method: ClassName#method_name] +# [Document-method\: ClassName#method_name] # Documentation for a instance method in the given class. Use this when the # method name alone is ambiguous. # From 3fb03bf399455050a8a51cc9e46e08925f695b6c Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 20 Jan 2019 13:18:22 +0900 Subject: [PATCH 0636/1389] ClassModule#add_comment should receive RDoc::Comment --- lib/rdoc/class_module.rb | 2 +- lib/rdoc/comment.rb | 5 +++++ test/test_rdoc_class_module.rb | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb index fdd56e236b..7609080fbf 100644 --- a/lib/rdoc/class_module.rb +++ b/lib/rdoc/class_module.rb @@ -210,7 +210,7 @@ def comment= comment # :nodoc: normalize_comment comment end - comment = "#{@comment}\n---\n#{comment}" unless @comment.empty? + comment = "#{@comment.to_s}\n---\n#{comment.to_s}" unless @comment.empty? super comment end diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb index 134f6440a0..0f643c45b9 100644 --- a/lib/rdoc/comment.rb +++ b/lib/rdoc/comment.rb @@ -33,6 +33,11 @@ class RDoc::Comment attr_reader :text + ## + # Alias for text + + alias to_s text + ## # Overrides the content returned by #parse. Use when there is no #text # source for this comment diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index cc53a13528..138ede58b6 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -9,21 +9,24 @@ def test_add_comment tl3 = @store.add_file 'three.rb' cm = RDoc::ClassModule.new 'Klass' - cm.add_comment '# comment 1', tl1 + comment_tl1 = RDoc::Comment.new('# comment 1') + cm.add_comment comment_tl1, tl1 - assert_equal [['comment 1', tl1]], cm.comment_location - assert_equal 'comment 1', cm.comment + assert_equal [[comment_tl1, tl1]], cm.comment_location + assert_equal 'comment 1', cm.comment.text - cm.add_comment '# comment 2', tl2 + comment_tl2 = RDoc::Comment.new('# comment 2') + cm.add_comment comment_tl2, tl2 - assert_equal [['comment 1', tl1], ['comment 2', tl2]], cm.comment_location + assert_equal [[comment_tl1, tl1], [comment_tl2, tl2]], cm.comment_location assert_equal "comment 1\n---\ncomment 2", cm.comment - cm.add_comment "# * comment 3", tl3 + comment_tl3 = RDoc::Comment.new('# * comment 3') + cm.add_comment comment_tl3, tl3 - assert_equal [['comment 1', tl1], - ['comment 2', tl2], - ['* comment 3', tl3]], cm.comment_location + assert_equal [[comment_tl1, tl1], + [comment_tl2, tl2], + [comment_tl3, tl3]], cm.comment_location assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment end From 316205e9ea5af2b426f24389c89b1d0fb8cc7fd2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 13 Jan 2019 13:16:56 +0000 Subject: [PATCH 0637/1389] rdoc: ignore garbage files * lib/rdoc/options.rb (RDoc::Options#init_ivars): exclude backup files by default. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/options.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 801a84b21f..f83972b881 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -344,7 +344,9 @@ def initialize # :nodoc: def init_ivars # :nodoc: @dry_run = false - @exclude = [] + @exclude = %w[ + ~\z \.orig\z \.rej\z \.bak\z + ] @files = nil @force_output = false @force_update = true From cd792d44609a69ae2097e3d5b6a6d7a8e3bba59c Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 13 Jan 2019 13:41:36 +0000 Subject: [PATCH 0638/1389] rdoc: fixup the test for r66806 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_rdoc_options.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb index baef2d860e..1eb20618a5 100644 --- a/test/test_rdoc_options.rb +++ b/test/test_rdoc_options.rb @@ -66,7 +66,7 @@ class << coder; alias add []=; end expected = { 'charset' => 'UTF-8', 'encoding' => encoding, - 'exclude' => [], + 'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z], 'hyperlink_all' => false, 'line_numbers' => false, 'locale' => nil, From eecc49e66289ea256f818da6af6e45bf3216ad04 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 13 Jan 2019 13:49:25 +0000 Subject: [PATCH 0639/1389] rdoc: ignore gemspec files [ruby-core:91067] [Bug #15531] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/options.rb | 1 + test/test_rdoc_options.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index f83972b881..53cc3af63c 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -346,6 +346,7 @@ def init_ivars # :nodoc: @dry_run = false @exclude = %w[ ~\z \.orig\z \.rej\z \.bak\z + \.gemspec\z ] @files = nil @force_output = false diff --git a/test/test_rdoc_options.rb b/test/test_rdoc_options.rb index 1eb20618a5..b6769d14b3 100644 --- a/test/test_rdoc_options.rb +++ b/test/test_rdoc_options.rb @@ -66,7 +66,7 @@ class << coder; alias add []=; end expected = { 'charset' => 'UTF-8', 'encoding' => encoding, - 'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z], + 'exclude' => %w[~\z \.orig\z \.rej\z \.bak\z \.gemspec\z], 'hyperlink_all' => false, 'line_numbers' => false, 'locale' => nil, From c26bd8e0c34a1d58a503d235064cad51a4063f7c Mon Sep 17 00:00:00 2001 From: aycabta Date: Sun, 3 Feb 2019 23:48:41 +0900 Subject: [PATCH 0640/1389] Use Ruby 2.6.1 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0a7a717527..1b6d3e98dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ rvm: - 2.3.8 - 2.4.5 - 2.5.3 - - 2.6.0 + - 2.6.1 - ruby-head - jruby-9.1.17.0 - jruby-9.2.4.1 From 94a4066d69880d1527d2587f884bdce3e1f5500f Mon Sep 17 00:00:00 2001 From: aycabta Date: Thu, 14 Feb 2019 23:47:26 +0900 Subject: [PATCH 0641/1389] Use JRuby 9.2.6.0 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1b6d3e98dd..b33839680b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ rvm: - 2.6.1 - ruby-head - jruby-9.1.17.0 - - jruby-9.2.4.1 + - jruby-9.2.6.0 env: global: NOBENCHMARK=1 @@ -18,4 +18,4 @@ script: rake matrix: allow_failures: - rvm: jruby-9.1.17.0 - - rvm: jruby-9.2.4.1 + - rvm: jruby-9.2.6.0 From fa278108fc83c804da31641c06b454ca2c0af11a Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 15 Feb 2019 19:08:01 +0900 Subject: [PATCH 0642/1389] Add ruby-head to allow_failures temporarily --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b33839680b..09775a8d16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,3 +19,4 @@ matrix: allow_failures: - rvm: jruby-9.1.17.0 - rvm: jruby-9.2.6.0 + - rvm: ruby-head From fe210acc7930336a6b6b638e30dc21a3dc09f9d3 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 15 Feb 2019 21:13:50 +0900 Subject: [PATCH 0643/1389] Comment out _trunk --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index b16c24e10f..6c6457652e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,4 +31,4 @@ environment: - ruby_version: 24-x64 - ruby_version: 25 - ruby_version: 25-x64 - - ruby_version: _trunk + #- ruby_version: _trunk From 558fe04c916ca86bdf5ae101dfaaa8f25a66a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Sat, 16 Feb 2019 14:47:53 +0100 Subject: [PATCH 0644/1389] Gitignore coverage folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 40234874d7..eb0b44af3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.rbc *.swp +/coverage .DS_Store /.rdoc /.rvmrc From ca68ba1e7368b5d49d985bab163e74aa78df4944 Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 22 Jan 2019 04:46:46 +0900 Subject: [PATCH 0645/1389] Normalization of comment should check language RDoc::Text#normalize_comment that is included RDoc::Comment always remove Ruby style comment indicator "#" and C style comment indicator "/**/", but should check language and remove only the language's comment indicator. --- lib/rdoc/comment.rb | 3 +- lib/rdoc/parser/c.rb | 18 ++++++------ lib/rdoc/parser/ruby.rb | 2 +- lib/rdoc/text.rb | 10 +++++-- test/minitest_helper.rb | 5 ++-- test/test_rdoc_class_module.rb | 28 ++++++++++--------- test/test_rdoc_comment.rb | 1 + test/test_rdoc_context_section.rb | 2 +- test/test_rdoc_parser_c.rb | 2 +- test/test_rdoc_parser_ruby.rb | 46 +++++++++++++++---------------- test/test_rdoc_text.rb | 9 ++++++ 11 files changed, 73 insertions(+), 53 deletions(-) diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb index 0f643c45b9..35cacdd087 100644 --- a/lib/rdoc/comment.rb +++ b/lib/rdoc/comment.rb @@ -48,9 +48,10 @@ class RDoc::Comment # Creates a new comment with +text+ that is found in the RDoc::TopLevel # +location+. - def initialize text = nil, location = nil + def initialize text = nil, location = nil, language = nil @location = location @text = text.nil? ? nil : text.dup + @language = language @document = nil @format = 'rdoc' diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index e2283088cc..69aeba8111 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -446,7 +446,7 @@ def do_includes next unless cls = @classes[c] m = @known_classes[m] || m - comment = RDoc::Comment.new '', @top_level + comment = RDoc::Comment.new '', @top_level, :c incl = cls.add_include RDoc::Include.new(m, comment) incl.record_location @top_level end @@ -564,7 +564,7 @@ def find_alias_comment class_name, new_name, old_name \s*"#{Regexp.escape new_name}"\s*, \s*"#{Regexp.escape old_name}"\s*\);%xm - RDoc::Comment.new($1 || '', @top_level) + RDoc::Comment.new($1 || '', @top_level, :c) end ## @@ -603,7 +603,7 @@ def find_attr_comment var_name, attr_name, read = nil, write = nil '' end - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -643,7 +643,7 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false case type when :func_def - comment = RDoc::Comment.new args[0], @top_level + comment = RDoc::Comment.new args[0], @top_level, :c body = args[1] offset, = args[2] @@ -673,7 +673,7 @@ def find_body class_name, meth_name, meth_obj, file_content, quiet = false body when :macro_def - comment = RDoc::Comment.new args[0], @top_level + comment = RDoc::Comment.new args[0], @top_level, :c body = args[1] offset, = args[2] @@ -780,7 +780,7 @@ def find_class_comment class_name, class_mod comment = '' end - comment = RDoc::Comment.new comment, @top_level + comment = RDoc::Comment.new comment, @top_level, :c comment.normalize look_for_directives_in class_mod, comment @@ -825,7 +825,7 @@ def find_const_comment(type, const_name, class_name = nil) table[const_name] || '' - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -856,7 +856,7 @@ def find_override_comment class_name, meth_obj return unless comment - RDoc::Comment.new comment, @top_level + RDoc::Comment.new comment, @top_level, :c end ## @@ -990,7 +990,7 @@ def handle_constants(type, var_name, const_name, definition) new_comment = "#{$1}#{new_comment.lstrip}" - new_comment = RDoc::Comment.new new_comment, @top_level + new_comment = RDoc::Comment.new new_comment, @top_level, :c con = RDoc::Constant.new const_name, new_definition, new_comment else diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 97399f87ff..8da19cf2e2 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -667,7 +667,7 @@ def make_message message # Creates a comment with the correct format def new_comment comment - c = RDoc::Comment.new comment, @top_level + c = RDoc::Comment.new comment, @top_level, :ruby c.format = @markup c end diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 22c3777ff9..c3218fdb2f 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -10,6 +10,8 @@ module RDoc::Text + attr_accessor :language + ## # Maps markup formats to classes that can parse them. If the format is # unknown, "rdoc" format is used. @@ -111,8 +113,12 @@ def markup text def normalize_comment text return text if text.empty? - text = strip_stars text - text = strip_hashes text + case language + when :ruby + text = strip_hashes text + when :c + text = strip_stars text + end text = expand_tabs text text = flush_left text text = strip_newlines text diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index 9fb0cd676b..5db0c315ef 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -97,8 +97,9 @@ def block *contents # Creates an RDoc::Comment with +text+ which was defined on +top_level+. # By default the comment has the 'rdoc' format. - def comment text, top_level = @top_level - RDoc::Comment.new text, top_level + def comment text, top_level = @top_level, language = nil + comment = RDoc::Comment.new text, top_level, language + comment end ## diff --git a/test/test_rdoc_class_module.rb b/test/test_rdoc_class_module.rb index 138ede58b6..4dcc5d15ab 100644 --- a/test/test_rdoc_class_module.rb +++ b/test/test_rdoc_class_module.rb @@ -9,19 +9,19 @@ def test_add_comment tl3 = @store.add_file 'three.rb' cm = RDoc::ClassModule.new 'Klass' - comment_tl1 = RDoc::Comment.new('# comment 1') + comment_tl1 = RDoc::Comment.new('# comment 1', @top_level, :ruby) cm.add_comment comment_tl1, tl1 assert_equal [[comment_tl1, tl1]], cm.comment_location assert_equal 'comment 1', cm.comment.text - comment_tl2 = RDoc::Comment.new('# comment 2') + comment_tl2 = RDoc::Comment.new('# comment 2', @top_level, :ruby) cm.add_comment comment_tl2, tl2 assert_equal [[comment_tl1, tl1], [comment_tl2, tl2]], cm.comment_location assert_equal "comment 1\n---\ncomment 2", cm.comment - comment_tl3 = RDoc::Comment.new('# * comment 3') + comment_tl3 = RDoc::Comment.new('# * comment 3', @top_level, :ruby) cm.add_comment comment_tl3, tl3 assert_equal [[comment_tl1, tl1], @@ -42,11 +42,13 @@ def test_add_comment_duplicate tl1 = @store.add_file 'one.rb' cm = RDoc::ClassModule.new 'Klass' - cm.add_comment '# comment 1', tl1 - cm.add_comment '# comment 2', tl1 + comment1 = RDoc::Comment.new('# comment 1', @top_level, :ruby) + comment2 = RDoc::Comment.new('# comment 2', @top_level, :ruby) + cm.add_comment comment1, tl1 + cm.add_comment comment2, tl1 - assert_equal [['comment 1', tl1], - ['comment 2', tl1]], cm.comment_location + assert_equal [[comment1, tl1], + [comment2, tl1]], cm.comment_location end def test_add_comment_stopdoc @@ -66,17 +68,17 @@ def test_ancestors def test_comment_equals cm = RDoc::ClassModule.new 'Klass' - cm.comment = '# comment 1' + cm.comment = RDoc::Comment.new('# comment 1', @top_level, :ruby) - assert_equal 'comment 1', cm.comment + assert_equal 'comment 1', cm.comment.to_s - cm.comment = '# comment 2' + cm.comment = RDoc::Comment.new('# comment 2', @top_level, :ruby) - assert_equal "comment 1\n---\ncomment 2", cm.comment + assert_equal "comment 1\n---\ncomment 2", cm.comment.to_s - cm.comment = "# * comment 3" + cm.comment = RDoc::Comment.new('# * comment 3', @top_level, :ruby) - assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment + assert_equal "comment 1\n---\ncomment 2\n---\n* comment 3", cm.comment.to_s end def test_comment_equals_comment diff --git a/test/test_rdoc_comment.rb b/test/test_rdoc_comment.rb index 9b3c105bb0..48d0042f16 100644 --- a/test/test_rdoc_comment.rb +++ b/test/test_rdoc_comment.rb @@ -241,6 +241,7 @@ def test_normalize @comment.text = <<-TEXT # comment TEXT + @comment.language = :ruby assert_same @comment, @comment.normalize diff --git a/test/test_rdoc_context_section.rb b/test/test_rdoc_context_section.rb index f1cf493d3d..93cfbdf0a7 100644 --- a/test/test_rdoc_context_section.rb +++ b/test/test_rdoc_context_section.rb @@ -11,7 +11,7 @@ def setup @klass = @top_level.add_class RDoc::NormalClass, 'Object' @S = RDoc::Context::Section - @s = @S.new @klass, 'section', comment('# comment', @top_level) + @s = @S.new @klass, 'section', comment('# comment', @top_level, :ruby) end def test_add_comment diff --git a/test/test_rdoc_parser_c.rb b/test/test_rdoc_parser_c.rb index 3d30d767df..ca668f61fc 100644 --- a/test/test_rdoc_parser_c.rb +++ b/test/test_rdoc_parser_c.rb @@ -1381,7 +1381,7 @@ def test_find_modifiers_nodoc end def test_find_modifiers_yields - comment = RDoc::Comment.new <<-COMMENT + comment = RDoc::Comment.new <<-COMMENT, @top_level, :c /* :yields: a, b * * Blah diff --git a/test/test_rdoc_parser_ruby.rb b/test/test_rdoc_parser_ruby.rb index 8188318769..674f2d36d7 100644 --- a/test/test_rdoc_parser_ruby.rb +++ b/test/test_rdoc_parser_ruby.rb @@ -435,7 +435,7 @@ def test_parse_attr klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my attr\n", @top_level + comment = RDoc::Comment.new "##\n# my attr\n", @top_level, :ruby util_parser "attr :foo, :bar" @@ -472,7 +472,7 @@ def test_parse_attr_accessor klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my attr\n", @top_level + comment = RDoc::Comment.new "##\n# my attr\n", @top_level, :ruby util_parser "attr_accessor :foo, :bar" @@ -499,7 +499,7 @@ def test_parse_attr_accessor_with_newline klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my attr\n", @top_level + comment = RDoc::Comment.new "##\n# my attr\n", @top_level, :ruby util_parser "attr_accessor :foo, :bar,\n :baz,\n :qux" @@ -584,7 +584,7 @@ def test_parse_attr_accessor_writer klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my attr\n", @top_level + comment = RDoc::Comment.new "##\n# my attr\n", @top_level, :ruby util_parser "attr_writer :foo, :bar" @@ -610,7 +610,7 @@ def test_parse_meta_attr klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# :attr: \n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# :attr: \n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar" @@ -631,7 +631,7 @@ def test_parse_meta_attr_accessor klass.parent = @top_level comment = - RDoc::Comment.new "##\n# :attr_accessor: \n# my method\n", @top_level + RDoc::Comment.new "##\n# :attr_accessor: \n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar" @@ -651,7 +651,7 @@ def test_parse_meta_attr_named klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# :attr: foo\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# :attr: foo\n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar" @@ -672,7 +672,7 @@ def test_parse_meta_attr_reader klass.parent = @top_level comment = - RDoc::Comment.new "##\n# :attr_reader: \n# my method\n", @top_level + RDoc::Comment.new "##\n# :attr_reader: \n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar" @@ -708,7 +708,7 @@ def test_parse_meta_attr_writer klass.parent = @top_level comment = - RDoc::Comment.new "##\n# :attr_writer: \n# my method\n", @top_level + RDoc::Comment.new "##\n# :attr_writer: \n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar" @@ -724,7 +724,7 @@ def test_parse_meta_attr_writer end def test_parse_class - comment = RDoc::Comment.new "##\n# my class\n", @top_level + comment = RDoc::Comment.new "##\n# my class\n", @top_level, :ruby util_parser "class Foo\nend" @@ -1001,7 +1001,7 @@ def test_parse_class_nested_superclass end def test_parse_module - comment = RDoc::Comment.new "##\n# my module\n", @top_level + comment = RDoc::Comment.new "##\n# my module\n", @top_level, :ruby util_parser "module Foo\nend" @@ -1247,7 +1247,7 @@ def test_parse_comment_attr klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# :attr: foo\n# my attr\n", @top_level + comment = RDoc::Comment.new "##\n# :attr: foo\n# my attr\n", @top_level, :ruby util_parser "\n" @@ -1311,7 +1311,7 @@ def test_parse_comment_method klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# :method: foo\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# :method: foo\n# my method\n", @top_level, :ruby util_parser "\n" @@ -1595,7 +1595,7 @@ def test_parse_extend_or_include_extend klass = RDoc::NormalClass.new 'C' klass.parent = @top_level - comment = RDoc::Comment.new "# my extend\n", @top_level + comment = RDoc::Comment.new "# my extend\n", @top_level, :ruby util_parser "extend I" @@ -1615,7 +1615,7 @@ def test_parse_extend_or_include_include klass = RDoc::NormalClass.new 'C' klass.parent = @top_level - comment = RDoc::Comment.new "# my include\n", @top_level + comment = RDoc::Comment.new "# my include\n", @top_level, :ruby util_parser "include I" @@ -1635,7 +1635,7 @@ def test_parse_meta_method klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar\nadd_my_method :baz" @@ -1719,7 +1719,7 @@ def test_parse_meta_method_block def test_parse_meta_method_define_method klass = RDoc::NormalClass.new 'Foo' - comment = RDoc::Comment.new "##\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# my method\n", @top_level, :ruby util_parser "define_method :foo do end" @@ -1738,7 +1738,7 @@ def test_parse_meta_method_name klass.parent = @top_level comment = - RDoc::Comment.new "##\n# :method: woo_hoo!\n# my method\n", @top_level + RDoc::Comment.new "##\n# :method: woo_hoo!\n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar\nadd_my_method :baz" @@ -1757,7 +1757,7 @@ def test_parse_meta_method_singleton klass.parent = @top_level comment = - RDoc::Comment.new "##\n# :singleton-method:\n# my method\n", @top_level + RDoc::Comment.new "##\n# :singleton-method:\n# my method\n", @top_level, :ruby util_parser "add_my_method :foo, :bar\nadd_my_method :baz" @@ -1778,7 +1778,7 @@ def test_parse_meta_method_singleton_name comment = RDoc::Comment.new "##\n# :singleton-method: woo_hoo!\n# my method\n", - @top_level + @top_level, :ruby util_parser "add_my_method :foo, :bar\nadd_my_method :baz" @@ -1795,7 +1795,7 @@ def test_parse_meta_method_singleton_name def test_parse_meta_method_string_name klass = RDoc::NormalClass.new 'Foo' - comment = RDoc::Comment.new "##\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# my method\n", @top_level, :ruby util_parser "add_my_method 'foo'" @@ -1827,7 +1827,7 @@ def test_parse_meta_method_stopdoc def test_parse_meta_method_unknown klass = RDoc::NormalClass.new 'Foo' - comment = RDoc::Comment.new "##\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# my method\n", @top_level, :ruby util_parser "add_my_method ('foo')" @@ -1845,7 +1845,7 @@ def test_parse_method klass = RDoc::NormalClass.new 'Foo' klass.parent = @top_level - comment = RDoc::Comment.new "##\n# my method\n", @top_level + comment = RDoc::Comment.new "##\n# my method\n", @top_level, :ruby util_parser "def foo() :bar end" diff --git a/test/test_rdoc_text.rb b/test/test_rdoc_text.rb index 2669766e71..fcd993f834 100644 --- a/test/test_rdoc_text.rb +++ b/test/test_rdoc_text.rb @@ -13,6 +13,7 @@ def setup @options = RDoc::Options.new @top_level = @store.add_file 'file.rb' + @language = nil end def test_self_encode_fallback @@ -137,6 +138,8 @@ def test_normalize_comment_hash The comments associated with EXPECTED + @language = :ruby + assert_equal expected, normalize_comment(text) end @@ -155,6 +158,8 @@ def test_normalize_comment_stars_single_space The comments associated with EXPECTED + @language = :c + assert_equal expected, normalize_comment(text) end @@ -173,6 +178,8 @@ def test_normalize_comment_stars_single_double_space The comments associated with EXPECTED + @language = :c + assert_equal expected, normalize_comment(text) end @@ -200,6 +207,8 @@ def test_parse_empty end def test_parse_empty_newline + @language = :ruby + assert_equal RDoc::Markup::Document.new, parse("#\n") end From ddb92416eba356dd69ecfc4291c7ec68984b56a6 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 28 Feb 2019 20:40:44 +0900 Subject: [PATCH 0646/1389] Set up CI with Azure Pipelines --- azure-pipelines.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..c23ced43ca --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: 'Ubuntu-16.04' + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From 79234db7f14b2d7d382019bef3e83a9594271755 Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Thu, 28 Feb 2019 20:42:21 +0900 Subject: [PATCH 0647/1389] Try to test with macOS. --- azure-pipelines.yml | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c23ced43ca..1d3ec008ec 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,19 +1,11 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: -- master - -pool: - vmImage: 'Ubuntu-16.04' - -steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' - -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' +jobs: +- job: macOS + pool: + vmImage: 'macos-10.13' + steps: + - script: | + gem install bundler + bundle install --retry=3 --jobs=4 + displayName: 'bundle install' + - script: rake + displayName: 'rake' From 0874bb62d932b86682ca2c3760fffc00d89ef4c6 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 22 Mar 2019 21:18:14 +0900 Subject: [PATCH 0648/1389] Use Ruby 2.5.5 and 2.6.2 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 09775a8d16..a0b24657e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,8 @@ language: ruby rvm: - 2.3.8 - 2.4.5 - - 2.5.3 - - 2.6.1 + - 2.5.5 + - 2.6.2 - ruby-head - jruby-9.1.17.0 - jruby-9.2.6.0 From d73b915b1e377d10592bb189c90977943bd9b130 Mon Sep 17 00:00:00 2001 From: aycabta Date: Fri, 25 Jan 2019 23:58:30 +0900 Subject: [PATCH 0649/1389] Support nesting text page URL RDoc::Servlet#documentation_page replaces "/" in URL with "::" for class or module but it's also used for the replaced name on text pages. This causes a bug when text pages are in nesting directory. This commit fixes #615. --- lib/rdoc/servlet.rb | 5 ++++- test/test_rdoc_servlet.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index 79550fe63b..72e6e90193 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -145,12 +145,15 @@ def do_GET req, res # +generator+ is used to create the page. def documentation_page store, generator, path, req, res - name = path.sub(/.html$/, '').gsub '/', '::' + text_name = path.sub /.html$/, '' + name = text_name.gsub '/', '::' if klass = store.find_class_or_module(name) then res.body = generator.generate_class klass elsif page = store.find_text_page(name.sub(/_([^_]*)$/, '.\1')) then res.body = generator.generate_page page + elsif page = store.find_text_page(text_name.sub(/_([^_]*)$/, '.\1')) then + res.body = generator.generate_page page else not_found generator, req, res end diff --git a/test/test_rdoc_servlet.rb b/test/test_rdoc_servlet.rb index 0a197a31b6..eb56360a6d 100644 --- a/test/test_rdoc_servlet.rb +++ b/test/test_rdoc_servlet.rb @@ -232,6 +232,18 @@ def test_documentation_page_page assert_match %r%]+ class="file">%, @res.body end + def test_documentation_page_page_with_nesting + store = RDoc::Store.new + + generator = @s.generator_for store + + readme = store.add_file 'nesting/README.rdoc', parser: RDoc::Parser::Simple + + @s.documentation_page store, generator, 'nesting/README_rdoc.html', @req, @res + + assert_equal 200, @res.status + end + def test_documentation_source store, path = @s.documentation_source '/ruby/Object.html' From 76578cd55f547d04ffd96b1779e81c7a5f1ead1b Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 28 Mar 2019 08:39:24 +0000 Subject: [PATCH 0650/1389] [DOC] fix missing paren [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/parser/c.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index 69aeba8111..5cc009e499 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -952,7 +952,7 @@ def handle_class_module(var_name, type, class_name, parent, in_module) # can override the C value of the comment to give a friendly definition. # # /* 300: The perfect score in bowling */ - # rb_define_const(cFoo, "PERFECT", INT2FIX(300); + # rb_define_const(cFoo, "PERFECT", INT2FIX(300)); # # Will override INT2FIX(300) with the value +300+ in the output # RDoc. Values may include quotes and escaped colons (\:). From 18abd1c951b54dfb1015073ca92b0a3cd0ed79ea Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 2 Feb 2019 06:54:55 +0000 Subject: [PATCH 0651/1389] rdoc.css: make label-list compact "Labeled Lists" section in lib/rdoc/markup.rb states labeled-list will be formatted in same lines. ``` Notice that blank lines right after the label are ignored in labeled lists: [one] definition 1 [two] definition 2 produces the same output as [one] definition 1 [two] definition 2 ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/generator/template/darkfish/css/rdoc.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css index 2f4dca7e08..a6a577d1a1 100644 --- a/lib/rdoc/generator/template/darkfish/css/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css @@ -261,6 +261,11 @@ ul.link-list .type { -webkit-border-radius: 5px; } +dl.label-list dt { + float: left; + margin-right: 1em; +} + .calls-super { background: url(images/arrow_up.png) no-repeat right center; } From 2fd0962c793c3d2e6a22a1414b8054fddf984283 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 30 Mar 2019 14:00:36 +0900 Subject: [PATCH 0652/1389] Colorize background of code/pre Copied the style of bugs.ruby-lang.org. --- lib/rdoc/generator/template/darkfish/css/rdoc.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css index a6a577d1a1..43588e6f1a 100644 --- a/lib/rdoc/generator/template/darkfish/css/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css @@ -62,6 +62,9 @@ h6:hover span { code, pre { font-family: "Source Code Pro", Monaco, monospace; + background-color: rgba(27,31,35,0.05); + padding: 0em 0.2em; + border-radius: 0.2em; } /* @group Generic Classes */ From 5b2e1ca2fbce0a0d8c62ba4401375917b93400b2 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 30 Mar 2019 14:11:38 +0900 Subject: [PATCH 0653/1389] Fix a typo in an assertion message --- test/test_rdoc_generator_json_index.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rdoc_generator_json_index.rb b/test/test_rdoc_generator_json_index.rb index ab8f6f1521..3281cac304 100644 --- a/test/test_rdoc_generator_json_index.rb +++ b/test/test_rdoc_generator_json_index.rb @@ -106,7 +106,7 @@ def test_generate # This is dirty hack on JRuby for MiniTest 4 assert orig_file.mtime.inspect == generated_file.mtime.inspect, - '.js files should be tha same timestamp of original' + '.js files should be the same timestamp of original' json = File.read 'js/search_index.js' From 17df871eec502560590e5509e92fe562e927ba53 Mon Sep 17 00:00:00 2001 From: aycabta Date: Mon, 1 Apr 2019 17:16:57 +0900 Subject: [PATCH 0654/1389] Update jQuery to 3.3.1 --- lib/rdoc/generator/template/darkfish/js/jquery.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js index 628ed9b316..4d9b3a2587 100644 --- a/lib/rdoc/generator/template/darkfish/js/jquery.js +++ b/lib/rdoc/generator/template/darkfish/js/jquery.js @@ -1,4 +1,2 @@ -/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */ -(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"":"")+""),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file +/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w(" - - + + + + + diff --git a/lib/rdoc/generator/template/darkfish/css/rdoc.css b/lib/rdoc/generator/template/darkfish/css/rdoc.css index 47ecae768c..a52e44ff8f 100644 --- a/lib/rdoc/generator/template/darkfish/css/rdoc.css +++ b/lib/rdoc/generator/template/darkfish/css/rdoc.css @@ -9,6 +9,8 @@ /* vim: ft=css et sw=2 ts=2 sts=2 */ /* Base Green is: #6C8C22 */ +.hide { display: none !important; } + * { padding: 0; margin: 0; } body { @@ -48,6 +50,16 @@ h6:hover span { display: inline; } +h1:target, +h2:target, +h3:target, +h4:target, +h5:target, +h6:target { + margin-left: -10px; + border-left: 10px solid #f1edba; +} + :link, :visited { color: #6C8C22; @@ -449,7 +461,16 @@ main header h3 { /* @group Method Details */ main .method-source-code { - display: none; + max-height: 0; + overflow: hidden; + transition-duration: 200ms; + transition-delay: 0ms; + transition-property: all; + transition-timing-function: ease-in-out; +} + +main .method-source-code.active-menu { + max-height: 100vh; } main .method-description .method-calls-super { diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js index 38f877ed40..089813fcde 100644 --- a/lib/rdoc/generator/template/darkfish/js/darkfish.js +++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js @@ -8,6 +8,7 @@ */ /* Provide console simulation for firebug-less environments */ +/* if (!("console" in window) || !("firebug" in console)) { var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; @@ -16,41 +17,35 @@ if (!("console" in window) || !("firebug" in console)) { for (var i = 0; i < names.length; ++i) window.console[names[i]] = function() {}; }; - - -/** - * Unwrap the first element that matches the given @expr@ from the targets and return them. - */ -$.fn.unwrap = function( expr ) { - return this.each( function() { - $(this).parents( expr ).eq( 0 ).after( this ).remove(); - }); -}; +*/ function showSource( e ) { var target = e.target; - var codeSections = $(target). - parents('.method-detail'). - find('.method-source-code'); - - $(target). - parents('.method-detail'). - find('.method-source-code'). - slideToggle(); + while (!target.classList.contains('method-detail')) { + target = target.parentNode; + } + if (typeof target !== "undefined" && target !== null) { + target = target.querySelector('.method-source-code'); + } + if (typeof target !== "undefined" && target !== null) { + target.classList.toggle('active-menu') + } }; function hookSourceViews() { - $('.method-heading').click( showSource ); + document.querySelectorAll('.method-heading').forEach(function (codeObject) { + codeObject.addEventListener('click', showSource); + }); }; function hookSearch() { - var input = $('#search-field').eq(0); - var result = $('#search-results').eq(0); - $(result).show(); + var input = document.querySelector('#search-field'); + var result = document.querySelector('#search-results'); + result.classList.remove("initially-hidden"); - var search_section = $('#search-section').get(0); - $(search_section).show(); + var search_section = document.querySelector('#search-section'); + search_section.classList.remove("initially-hidden"); var search = new Search(search_data, input, result); @@ -77,85 +72,14 @@ function hookSearch() { } search.select = function(result) { - var result_element = result.get(0); - window.location.href = result_element.firstChild.firstChild.href; + console.log(result); + window.location.href = result.firstChild.firstChild.href; } search.scrollIntoView = search.scrollInWindow; }; -function highlightTarget( anchor ) { - console.debug( "Highlighting target '%s'.", anchor ); - - $("a[name]").each( function() { - if ( $(this).attr("name") == anchor ) { - if ( !$(this).parent().parent().hasClass('target-section') ) { - console.debug( "Wrapping the target-section" ); - $('div.method-detail').unwrap( 'div.target-section' ); - $(this).parent().wrap( '
' ); - } else { - console.debug( "Already wrapped." ); - } - } - }); -}; - -function highlightLocationTarget() { - console.debug( "Location hash: %s", window.location.hash ); - if ( ! window.location.hash || window.location.hash.length == 0 ) return; - - var anchor = window.location.hash.substring(1); - console.debug( "Found anchor: %s; matching %s", anchor, "a[name=" + anchor + "]" ); - - highlightTarget( anchor ); -}; - -function highlightClickTarget( event ) { - console.debug( "Highlighting click target for event %o", event.target ); - try { - var anchor = $(event.target).attr( 'href' ).substring(1); - console.debug( "Found target anchor: %s", anchor ); - highlightTarget( anchor ); - } catch ( err ) { - console.error( "Exception while highlighting: %o", err ); - }; -}; - -function loadAsync(path, success, prefix) { - $.ajax({ - url: prefix + path, - dataType: 'script', - success: success, - cache: true - }); -}; - -$(document).ready( function() { +document.addEventListener('DOMContentLoaded', function() { hookSourceViews(); - highlightLocationTarget(); - $('ul.link-list a').bind( "click", highlightClickTarget ); - - var search_scripts_loaded = { - navigation_loaded: false, - search_loaded: false, - search_index_loaded: false, - searcher_loaded: false, - } - - var search_success_function = function(variable) { - return (function (data, status, xhr) { - search_scripts_loaded[variable] = true; - - if (search_scripts_loaded['navigation_loaded'] == true && - search_scripts_loaded['search_loaded'] == true && - search_scripts_loaded['search_index_loaded'] == true && - search_scripts_loaded['searcher_loaded'] == true) - hookSearch(); - }); - } - - 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); + hookSearch(); }); diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js index 60ac295e6c..b558ca5b4f 100644 --- a/lib/rdoc/generator/template/darkfish/js/search.js +++ b/lib/rdoc/generator/template/darkfish/js/search.js @@ -1,29 +1,29 @@ Search = function(data, input, result) { this.data = data; - this.$input = $(input); - this.$result = $(result); + this.input = input; + this.result = result; - this.$current = null; - this.$view = this.$result.parent(); + this.current = null; + this.view = this.result.parentNode; this.searcher = new Searcher(data.index); this.init(); } -Search.prototype = $.extend({}, Navigation, new function() { +Search.prototype = Object.assign({}, Navigation, new function() { var suid = 1; this.init = function() { var _this = this; var observer = function(e) { - switch(e.originalEvent.keyCode) { + switch(e.keyCode) { case 38: // Event.KEY_UP case 40: // Event.KEY_DOWN return; } - _this.search(_this.$input[0].value); + _this.search(_this.input.value); }; - this.$input.keyup(observer); - this.$input.click(observer); // mac's clear field + this.input.addEventListener('keyup', observer); + this.input.addEventListener('click', observer); // mac's clear field this.searcher.ready(function(results, isLast) { _this.addResults(results, isLast); @@ -34,7 +34,7 @@ Search.prototype = $.extend({}, Navigation, new function() { } this.search = function(value, selectFirstMatch) { - value = jQuery.trim(value).toLowerCase(); + value = value.trim().toLowerCase(); if (value) { this.setNavigationActive(true); } else { @@ -43,23 +43,23 @@ Search.prototype = $.extend({}, Navigation, new function() { if (value == '') { this.lastQuery = value; - this.$result.empty(); - this.$result.attr('aria-expanded', 'false'); + this.result.innerHTML = ''; + this.result.setAttribute('aria-expanded', 'false'); this.setNavigationActive(false); } else if (value != this.lastQuery) { this.lastQuery = value; - this.$result.attr('aria-busy', 'true'); - this.$result.attr('aria-expanded', 'true'); + this.result.setAttribute('aria-busy', 'true'); + this.result.setAttribute('aria-expanded', 'true'); this.firstRun = true; this.searcher.find(value); } } this.addResults = function(results, isLast) { - var target = this.$result.get(0); + var target = this.result; if (this.firstRun && (results.length > 0 || isLast)) { - this.$current = null; - this.$result.empty(); + this.current = null; + this.result.innerHTML = ''; } for (var i=0, l = results.length; i < l; i++) { @@ -70,25 +70,26 @@ Search.prototype = $.extend({}, Navigation, new function() { if (this.firstRun && results.length > 0) { this.firstRun = false; - this.$current = $(target.firstChild); - this.$current.addClass('search-selected'); + this.current = target.firstChild; + this.current.classList.add('search-selected'); } - if (jQuery.browser.msie) this.$element[0].className += ''; + //TODO: ECMAScript + //if (jQuery.browser.msie) this.$element[0].className += ''; - if (isLast) this.$result.attr('aria-busy', 'false'); + if (isLast) this.result.setAttribute('aria-busy', 'false'); } this.move = function(isDown) { - if (!this.$current) return; - var $next = this.$current[isDown ? 'next' : 'prev'](); - if ($next.length) { - this.$current.removeClass('search-selected'); - $next.addClass('search-selected'); - this.$input.attr('aria-activedescendant', $next.attr('id')); - this.scrollIntoView($next[0], this.$view[0]); - this.$current = $next; - this.$input.val($next[0].firstChild.firstChild.text); - this.$input.select(); + if (!this.current) return; + var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling; + if (next) { + this.current.classList.remove('search-selected'); + next.classList.add('search-selected'); + this.input.setAttribute('aria-activedescendant', next.getAttribute('id')); + this.scrollIntoView(next, this.view); + this.current = next; + this.input.value = next.firstChild.firstChild.text; + this.input.select(); } return true; } diff --git a/lib/rdoc/generator/template/json_index/js/navigation.js b/lib/rdoc/generator/template/json_index/js/navigation.js index 43c5118abd..dfad74b1ae 100644 --- a/lib/rdoc/generator/template/json_index/js/navigation.js +++ b/lib/rdoc/generator/template/json_index/js/navigation.js @@ -10,10 +10,8 @@ Navigation = new function() { this.initNavigation = function() { var _this = this; - $(document).keydown(function(e) { + document.addEventListener('keydown', function(e) { _this.onkeydown(e); - }).keyup(function(e) { - _this.onkeyup(e); }); this.navigationActive = true; @@ -21,20 +19,6 @@ Navigation = new function() { this.setNavigationActive = function(state) { this.navigationActive = state; - this.clearMoveTimeout(); - } - - this.onkeyup = function(e) { - if (!this.navigationActive) return; - - switch(e.keyCode) { - case 37: //Event.KEY_LEFT: - case 38: //Event.KEY_UP: - case 39: //Event.KEY_RIGHT: - case 40: //Event.KEY_DOWN: - this.clearMoveTimeout(); - break; - } } this.onkeydown = function(e) { @@ -46,7 +30,6 @@ Navigation = new function() { case 38: //Event.KEY_UP: if (e.keyCode == 38 || e.ctrlKey) { if (this.moveUp()) e.preventDefault(); - this.startMoveTimeout(false); } break; case 39: //Event.KEY_RIGHT: @@ -55,33 +38,14 @@ Navigation = new function() { case 40: //Event.KEY_DOWN: if (e.keyCode == 40 || e.ctrlKey) { if (this.moveDown()) e.preventDefault(); - this.startMoveTimeout(true); } break; case 13: //Event.KEY_RETURN: - if (this.$current) e.preventDefault(); - this.select(this.$current); + if (this.current) e.preventDefault(); + this.select(this.current); break; } - if (e.ctrlKey && e.shiftKey) this.select(this.$current); - } - - this.clearMoveTimeout = function() { - clearTimeout(this.moveTimeout); - this.moveTimeout = null; - } - - this.startMoveTimeout = function(isDown) { - if (!$.browser.mozilla && !$.browser.opera) return; - if (this.moveTimeout) this.clearMoveTimeout(); - var _this = this; - - var go = function() { - if (!_this.moveTimeout) return; - _this[isDown ? 'moveDown' : 'moveUp'](); - _this.moveTimeout = setTimeout(go, 100); - } - this.moveTimeout = setTimeout(go, 200); + if (e.ctrlKey && e.shiftKey) this.select(this.current); } this.moveRight = function() { diff --git a/lib/rdoc/generator/template/json_index/js/searcher.js b/lib/rdoc/generator/template/json_index/js/searcher.js index b3b1c58a0f..e200a168b0 100644 --- a/lib/rdoc/generator/template/json_index/js/searcher.js +++ b/lib/rdoc/generator/template/json_index/js/searcher.js @@ -51,20 +51,20 @@ Searcher.prototype = new function() { /* ----- Utilities ------ */ function splitQuery(query) { - return jQuery.grep(query.split(/(\s+|::?|\(\)?)/), function(string) { + return query.split(/(\s+|::?|\(\)?)/).filter(function(string) { return string.match(/\S/); }); } function buildRegexps(queries) { - return jQuery.map(queries, function(query) { + return queries.map(function(query) { return new RegExp(query.replace(/(.)/g, '([$1])([^$1]*?)'), 'i'); }); } function buildHilighters(queries) { - return jQuery.map(queries, function(query) { - return jQuery.map(query.split(''), function(l, i) { + return queries.map(function(query) { + return query.split('').map(function(l, i) { return '\u0001$' + (i*2+1) + '\u0002$' + (i*2+2); }).join(''); }); @@ -221,9 +221,9 @@ Searcher.prototype = new function() { } function triggerResults(results, isLast) { - jQuery.each(this.handlers, function(i, fn) { + this.handlers.forEach(function(fn) { fn.call(this, results, isLast) - }) + }); } } From ec367c03f7cd80cad965497844d0f318301b24ff Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 19 Aug 2019 09:45:41 +0900 Subject: [PATCH 0704/1389] lib/rdoc/markup/parser.rb: remove a unused variable initialization --- lib/rdoc/markup/parser.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb index 600eb841ac..1b54a519d1 100644 --- a/lib/rdoc/markup/parser.rb +++ b/lib/rdoc/markup/parser.rb @@ -423,7 +423,6 @@ def initialize(input) end def scan(re) - prev_pos = @s.pos ret = @s.scan(re) @column += ret.length if ret ret From 1d7cf023cce7ef1e1f609349c0bcbc1156dcd6a5 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 16 Aug 2019 11:36:47 +0900 Subject: [PATCH 0705/1389] lib/rdoc/parser/ruby.rb: Avoid `.chars.to_a.last` The code creates a lot of useless objects. Instead, using a regexp is shorter and faster. --- lib/rdoc/parser/ruby.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb index 8da19cf2e2..4d6c038deb 100644 --- a/lib/rdoc/parser/ruby.rb +++ b/lib/rdoc/parser/ruby.rb @@ -1779,9 +1779,9 @@ def parse_statements(container, single = NORMAL, current_method = nil, while tk and (:on_comment == tk[:kind] or :on_embdoc == tk[:kind]) do comment_body = retrieve_comment_body(tk) comment += comment_body - comment += "\n" unless "\n" == comment_body.chars.to_a.last + comment << "\n" unless comment_body =~ /\n\z/ - if comment_body.size > 1 && "\n" == comment_body.chars.to_a.last then + if comment_body.size > 1 && comment_body =~ /\n\z/ then skip_tkspace_without_nl # leading spaces end tk = get_tk From 5ffedc0d0504348a2f7df69e92e7b75c054c9493 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Fri, 16 Aug 2019 21:27:05 +0900 Subject: [PATCH 0706/1389] lib/rdoc/store.rb: Use `Marshal.dump(obj, io)` instead of dumping obj to a string and then saving the string. It omits object creation. --- lib/rdoc/store.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index f420fc2bd2..0f6cd06e3c 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -795,10 +795,8 @@ def save_cache return if @dry_run - marshal = Marshal.dump @cache - File.open cache_path, 'wb' do |io| - io.write marshal + Marshal.dump @cache, io end end @@ -871,10 +869,8 @@ def save_class klass FileUtils.rm_f to_delete - marshal = Marshal.dump klass - File.open path, 'wb' do |io| - io.write marshal + Marshal.dump klass, io end end @@ -896,10 +892,8 @@ def save_method klass, method return if @dry_run - marshal = Marshal.dump method - File.open method_file(full_name, method.full_name), 'wb' do |io| - io.write marshal + Marshal.dump method, io end end @@ -918,10 +912,8 @@ def save_page page return if @dry_run - marshal = Marshal.dump page - File.open path, 'wb' do |io| - io.write marshal + Marshal.dump page, io end end From b8576f950c67398e1e4dd200d2e1ed951add100d Mon Sep 17 00:00:00 2001 From: aycabta Date: Tue, 27 Aug 2019 21:56:04 +0900 Subject: [PATCH 0707/1389] Version 6.2.0 --- lib/rdoc/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/version.rb b/lib/rdoc/version.rb index d9c4aa154d..bf15aa7d79 100644 --- a/lib/rdoc/version.rb +++ b/lib/rdoc/version.rb @@ -3,6 +3,6 @@ module RDoc ## # RDoc version you are using - VERSION = '6.1.1' + VERSION = '6.2.0' end From 6bd3ec32d7ef158dd4a331c0fc377121e91d07f7 Mon Sep 17 00:00:00 2001 From: aycabta Date: Wed, 28 Aug 2019 01:09:15 +0900 Subject: [PATCH 0708/1389] Remove jquery.js --- lib/rdoc/generator/template/darkfish/js/jquery.js | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 lib/rdoc/generator/template/darkfish/js/jquery.js diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js deleted file mode 100644 index 4d9b3a2587..0000000000 --- a/lib/rdoc/generator/template/darkfish/js/jquery.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w("',], + ] + aligns = [:left, :right, nil] + @to.start_accepting + @to.accept_table(header, body, aligns) + res = @to.end_accepting + assert_include(res[%r<]*>Col1>], 'align="left"') + assert_include(res[%r<]*>Col2>], 'align="right"') + assert_not_include(res[%r<]*>Col3>], 'align=') + assert_include(res[%r<]*>cell1_1>], 'align="left"') + assert_include(res[%r<]*>cell1_2>], 'align="right"') + assert_not_include(res[%r<]*>cell1_3>], 'align=') + assert_include(res[%r<]*>cell2_1>], 'align="left"') + assert_include(res[%r<]*>cell2_2>], 'align="right"') + assert_not_include(res[%r<]*>cell2_3>], 'align=') + assert_not_include(res, '',], + %w[+code+ _em_ **strong**], ] aligns = [:left, :right, nil] @to.start_accepting @@ -898,6 +899,9 @@ def test_accept_table assert_not_include(res[%r<]*>cell2_3>], 'align=') assert_not_include(res, '}[a]' + assert_escaped '[[]' + end + + def test_convert_TIDYLINK_escape_javascript + assert_not_include '{click}[javascript:alert`javascript_scheme`]', 'aaa[:symbol]

\n", @to.convert('+aaa+[:symbol]') assert_equal "\n

aaa[:symbol]

\n", @to.convert('+aaa[:symbol]+') @@ -903,5 +920,11 @@ def test_accept_table assert_include(res[%r<]*>.*em.*>], 'em') assert_include(res[%r<]*>.*strong.*>], 'strong') end + + def assert_escaped(unexpected, code) + result = @to.convert(code) + assert_not_include result, unexpected + assert_include result, CGI.escapeHTML(unexpected) + end end From 7cecf1efae53a31f1ae2f6c840a9b129c1800f4e Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 13 Apr 2022 16:14:07 +0900 Subject: [PATCH 0979/1389] Escape RDOCLINKs https://hackerone.com/reports/1187156 --- lib/rdoc/markup/to_html.rb | 12 +++++------- test/rdoc/test_rdoc_markup_to_html.rb | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb index 3c4f82f748..ccafdb61ba 100644 --- a/lib/rdoc/markup/to_html.rb +++ b/lib/rdoc/markup/to_html.rb @@ -84,7 +84,7 @@ def init_link_notation_regexp_handlings def handle_RDOCLINK url # :nodoc: case url when /^rdoc-ref:/ - $' + CGI.escapeHTML($') when /^rdoc-label:/ text = $' @@ -95,13 +95,11 @@ def handle_RDOCLINK url # :nodoc: else text end - gen_url url, text + gen_url CGI.escapeHTML(url), CGI.escapeHTML(text) when /^rdoc-image:/ - "" - else - url =~ /\Ardoc-[a-z]+:/ - - $' + %[] + when /\Ardoc-[a-z]+:/ + CGI.escapeHTML($') end end diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb index 8a38694c45..3e4a8e8915 100644 --- a/test/rdoc/test_rdoc_markup_to_html.rb +++ b/test/rdoc/test_rdoc_markup_to_html.rb @@ -665,6 +665,26 @@ def test_convert_RDOCLINK_ref assert_equal "\n

C

\n", result end + def test_convert_RDOCLINK_escape_image + assert_escaped '"' + end + + def test_convert_RDOCLINK_escape_label_id + assert_escaped '"' + end + + def test_convert_RDOCLINK_escape_label_path + assert_escaped '"' + end + + def test_convert_RDOCLINK_escape_ref + assert_escaped '"' + end + + def test_convert_RDOCLINK_escape_xxx + assert_escaped '"' + end + def test_convert_TIDYLINK_footnote result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]' @@ -690,6 +710,11 @@ def test_convert_TIDYLINK_image "\n

\n" assert_equal expected, result + + result = + @to.convert '{rdoc-image:}[http://example.com]' + + assert_not_include result, "', code + end + def test_list_verbatim_2 str = "* one\n verb1\n verb2\n* two\n" From 5dedb5741da14decfa460297278dc04ac7e65df1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 13 Apr 2022 22:02:21 +0900 Subject: [PATCH 0981/1389] Escape main title https://hackerone.com/reports/1187156 --- .../generator/template/darkfish/index.rhtml | 2 +- test/rdoc/test_rdoc_generator_darkfish.rb | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/rdoc/generator/template/darkfish/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml index 13fa3dcc7f..423e225b68 100644 --- a/lib/rdoc/generator/template/darkfish/index.rhtml +++ b/lib/rdoc/generator/template/darkfish/index.rhtml @@ -17,6 +17,6 @@ main_page = @files.find { |f| f.full_name == @options.main_page } then %> <%= main_page.description %> <%- else -%> -

This is the API documentation for <%= @title %>. +

This is the API documentation for <%= h @title %>. <%- end -%> diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb index ae3a4c5ebf..1cee3e44ab 100644 --- a/test/rdoc/test_rdoc_generator_darkfish.rb +++ b/test/rdoc/test_rdoc_generator_darkfish.rb @@ -248,6 +248,22 @@ def test_template_stylesheets assert_include File.read('index.html'), %Q[href="./#{base}"] end + def test_title + title = "RDoc Test".freeze + @options.title = title + @g.generate + + assert_main_title(File.read('index.html'), title) + end + + def test_title_escape + title = %[].freeze + @options.title = title + @g.generate + + assert_main_title(File.read('index.html'), title) + end + ## # Asserts that +filename+ has a link count greater than 1 if hard links to # @tmpdir are supported. @@ -271,4 +287,9 @@ def assert_hard_link filename "#{filename} is not hard-linked" end + def assert_main_title(content, title) + title = CGI.escapeHTML(title) + assert_equal(title, content[%r[(.*?)<\/title>]im, 1]) + assert_include(content[%r[<main\s[^<>]*+>\s*(.*?)</main>]im, 1], title) + end end From 8c07cc4657772d076e994896d8f3618c7c25083f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@ruby-lang.org> Date: Sat, 28 Aug 2021 17:41:47 +0900 Subject: [PATCH 0982/1389] Escape file names https://hackerone.com/reports/1321358 --- .../template/darkfish/_sidebar_pages.rhtml | 6 +++--- .../template/darkfish/table_of_contents.rhtml | 4 ++-- test/rdoc/test_rdoc_generator_darkfish.rb | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml index 0ed683ca14..3f68f0c0dc 100644 --- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml @@ -12,18 +12,18 @@ <%- end.each do |n, files| -%> <%- f = files.shift -%> <%- if files.empty? -%> - <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a> + <li><a href="<%= rel_prefix %>/<%= h 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><% + %><a href="<%= rel_prefix %>/<%= h 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> + <li><a href="<%= rel_prefix %>/<%= h f.path %>"><%= h f.page_name %></a> <%- end -%> </ul></details> <%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml index 303d7016cc..941ff9d630 100644 --- a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml @@ -8,14 +8,14 @@ <ul> <%- simple_files.sort.each do |file| -%> <li class="file"> - <a href="<%= file.path %>"><%= h file.page_name %></a> + <a href="<%= h file.path %>"><%= h file.page_name %></a> <% # HACK table_of_contents should not exist on Document table = file.parse(file.comment).table_of_contents unless table.empty? then %> <ul> <%- table.each do |heading| -%> - <li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a> + <li><a href="<%= h file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a> <%- end -%> </ul> <%- end -%> diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb index ae3a4c5ebf..26397bb6cb 100644 --- a/test/rdoc/test_rdoc_generator_darkfish.rb +++ b/test/rdoc/test_rdoc_generator_darkfish.rb @@ -233,6 +233,20 @@ def test_generated_method_with_html_tag_yield assert_includes method_name, '{ |%<<script>alert("atui")</script>>, yield_arg| ... }' end + def test_generated_filename_with_html_tag + @store.add_file '"><em>should be escaped' + doc = @store.all_files.last + doc.parser = RDoc::Parser::Simple + + @g.generate + + Dir.glob("*.html", base: @tmpdir) do |html| + File.read(File.join(@tmpdir, html)).scan(/.*should be escaped.*/) do |line| + assert_not_include line, "<em>", html + end + end + end + def test_template_stylesheets css = Tempfile.create(%W'hoge .css', Dir.mktmpdir('tmp', '.')) File.write(css, '') From 2ebf8fd51005f389ad9f906311e6266de8e96fec Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@ruby-lang.org> Date: Tue, 7 Sep 2021 23:52:13 +0900 Subject: [PATCH 0983/1389] Escape search results https://hackerone.com/reports/1321358 --- .../generator/template/darkfish/_head.rhtml | 20 +++++++++---------- .../template/darkfish/js/darkfish.js | 2 +- .../generator/template/darkfish/js/search.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/rdoc/generator/template/darkfish/_head.rhtml b/lib/rdoc/generator/template/darkfish/_head.rhtml index 4f331245c3..d5aed3e9ef 100644 --- a/lib/rdoc/generator/template/darkfish/_head.rhtml +++ b/lib/rdoc/generator/template/darkfish/_head.rhtml @@ -3,18 +3,18 @@ <title><%= h @title %> - - - - - + + + + + - - + + <%- @options.template_stylesheets.each do |stylesheet| -%> - + <%- end -%> diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js index 111bbf8eb9..d0c9467751 100644 --- a/lib/rdoc/generator/template/darkfish/js/darkfish.js +++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js @@ -54,7 +54,7 @@ function hookSearch() { var html = ''; // TODO add relative path to ',], - %w[+code+ _em_ **strong**], + %w[cell1_1 cell1_2 cell1_3 cell1_4], + %w[cell2_1 cell2_2 cell2_3 cell2_4], + [''], + %w[+code+ _em_ **strong** C1], ] - aligns = [:left, :right, nil] + aligns = [:left, :right, nil, :center] @to.start_accepting @to.accept_table(header, body, aligns) res = @to.end_accepting assert_include(res[%r<]*>Col1>], 'align="left"') assert_include(res[%r<]*>Col2>], 'align="right"') assert_not_include(res[%r<]*>Col3>], 'align=') + assert_include(res[%r<]*>Col4>], 'align="center"') assert_include(res[%r<]*>cell1_1>], 'align="left"') assert_include(res[%r<]*>cell1_2>], 'align="right"') assert_not_include(res[%r<]*>cell1_3>], 'align=') assert_include(res[%r<]*>cell2_1>], 'align="left"') assert_include(res[%r<]*>cell2_2>], 'align="right"') assert_not_include(res[%r<]*>cell2_3>], 'align=') + assert_include(res[%r<]*>cell2_4>], 'align="center"') assert_not_include(res, '