From 2a9411bcbc7b49ee159dd75cfdc4d5bbfe7c64ea Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 4 Jan 2026 20:21:14 +0900 Subject: [PATCH 1/3] Expand GitHub style references in ChangeLog to URL --- lib/rdoc/parser/changelog.rb | 12 ++++++++++++ test/rdoc/parser/changelog_test.rb | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 85ec46e0aa..0356038bf5 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -274,6 +274,18 @@ def create_entries(entries) def initialize(base, commit, author, email, date, contents) case contents when String + if base&.match(%r[\A([^:/]+:/+[^/]+/)[^/]+/[^/]+/]) + repo, host = $&, $1 + contents = contents.dup + contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do + "[#$&](#{repo}pull/#{$1 || $2 || $3})" + end + contents.gsub!(%r[(? Date: Mon, 5 Jan 2026 14:15:34 +0900 Subject: [PATCH 2/3] Adjust styles and add comments --- lib/rdoc/parser/changelog.rb | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 0356038bf5..3554594c62 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -277,12 +277,21 @@ def initialize(base, commit, author, email, date, contents) if base&.match(%r[\A([^:/]+:/+[^/]+/)[^/]+/[^/]+/]) repo, host = $&, $1 contents = contents.dup - contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do - "[#$&](#{repo}pull/#{$1 || $2 || $3})" + # base: https://github.com/ruby/ruby/ + # Fix #15791 -> Fix [#15791](https://github.com/ruby/ruby/pull/15791) + # GH-15791 -> [GH-15791](https://github.com/ruby/ruby/pull/15791) + # (#15791) -> ([#15791](https://github.com/ruby/ruby/pull/15791)) + contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K\#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do + "[#{$&}](#{repo}pull/#{$1 || $2 || $3})" end + # repo#PR, repo@HASH + # ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791) + # ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/net-http/commit/a8a989b6) + # ref in branckets is not extended + # [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791] contents.gsub!(%r[(? Date: Wed, 14 Jan 2026 18:57:56 +0900 Subject: [PATCH 3/3] Fix an example in a comment Co-authored-by: Sutou Kouhei --- lib/rdoc/parser/changelog.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb index 3554594c62..802ac96f01 100644 --- a/lib/rdoc/parser/changelog.rb +++ b/lib/rdoc/parser/changelog.rb @@ -286,7 +286,7 @@ def initialize(base, commit, author, email, date, contents) end # repo#PR, repo@HASH # ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791) - # ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/net-http/commit/a8a989b6) + # ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/ruby/commit/a8a989b6) # ref in branckets is not extended # [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791] contents.gsub!(%r[(?