ruby-changes:65028
From: Nobuyoshi <ko1@a...>
Date: Sun, 24 Jan 2021 16:53:51 +0900 (JST)
Subject: [ruby-changes:65028] 127f735c1e (master): [ruby/rdoc] Tweak log entry markdown
https://git.ruby-lang.org/ruby.git/commit/?id=127f735c1e From 127f735c1e5e0771076caf2a74390757a42fb177 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 21 Jan 2021 21:03:55 +0900 Subject: [ruby/rdoc] Tweak log entry markdown * add 3 levels to headings * prefix commit log to labels to make unique IDs https://github.com/ruby/rdoc/commit/5074c13209 --- lib/rdoc/parser/changelog.rb | 20 +++++++++++++++++- test/rdoc/test_rdoc_parser_changelog.rb | 36 ++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 763ba03..eca4b56 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -229,11 +229,29 @@ class RDoc::Parser::ChangeLog < RDoc::Parser https://github.com/ruby/ruby/blob/trunk/lib/rdoc/parser/changelog.rb#L229 out = [] entries.each do |entry, (author, date, body)| title = RDoc::Markup::Heading.new(3, "#{date} #{author}") + title.extend(Aref) + title.aref = "label-#{entry}" out << title - out.concat RDoc::Markdown.parse(body).parts + out.concat parse_log_entry(body, entry) end out end + + def parse_log_entry(content, sha) + RDoc::Markdown.parse(content).parts.each do |body| + case body + when RDoc::Markup::Heading + body.level += 3 + label = body.aref.sub(/\Alabel-/, "label-#{sha}-") + body.extend(Aref) + body.aref = label + end + end + end + + module Aref + attr_accessor :aref + end end end diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb index 220f008..5f43811 100644 --- a/test/rdoc/test_rdoc_parser_changelog.rb +++ b/test/rdoc/test_rdoc_parser_changelog.rb @@ -340,6 +340,29 @@ commit\ a8dc5156e183489c5121fb1759bda5d9406d9175 https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_changelog.rb#L340 Date: 2021-01-20 01:58:26 +0900 * 2021-01-20 [ci skip] + +commit de5f8a92d5001799bedb3b1a271a2d9b23c6c8fb + Author: Masataka Pocke Kuwabara <kuwabara@p...> + Date: 2021-01-01 14:25:08 +0900 + + Make args info for RubyVM::AST to available on endless method without parens + + Problem + === + + Arguments information is missing for endless method without parens. + For example: + + ```ruby + # ok + ``` + + It causes an error if a program expects `args` node exists. + + Solution + === + + Call `new_args` on this case. ChangeLog parser.scan @@ -354,7 +377,18 @@ ChangeLog https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_changelog.rb#L377 head(2, '2021-01-20'), blank_line, head(3, '2021-01-20 01:58:26 +0900 git <svn-admin@r...>'), - list(:BULLET, item(nil, para('2021-01-20 [ci skip]')))) + list(:BULLET, item(nil, para('2021-01-20 [ci skip]'))), + head(2, '2021-01-01'), + blank_line, + head(3, '2021-01-01 14:25:08 +0900 Masataka Pocke Kuwabara <kuwabara@p...>'), + para('Make args info for RubyVM::AST to available on endless method without parens'), + head(4, 'Problem'), + para("Arguments information is missing for endless method without parens.\n" + + "For example:"), + verb("# ok\n").tap {|v| v.format = :ruby}, + para('It causes an error if a program expects <code>args</code> node exists.'), + head(4, 'Solution'), + para('Call <code>new_args</code> on this case.')) expected.file = @top_level -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/