Skip to content

Commit 371958b

Browse files
committed
Adjust styles and add comments
1 parent 2a9411b commit 371958b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/rdoc/parser/changelog.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,21 @@ def initialize(base, commit, author, email, date, contents)
277277
if base&.match(%r[\A([^:/]+:/+[^/]+/)[^/]+/[^/]+/])
278278
repo, host = $&, $1
279279
contents = contents.dup
280-
contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do
281-
"[#$&](#{repo}pull/#{$1 || $2 || $3})"
280+
# base: https://github.com/ruby/ruby/
281+
# Fix #15791 -> Fix [#15791](https://github.com/ruby/ruby/pull/15791)
282+
# GH-15791 -> [GH-15791](https://github.com/ruby/ruby/pull/15791)
283+
# (#15791) -> ([#15791](https://github.com/ruby/ruby/pull/15791))
284+
contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) +)\K\#(\d+\b)|\bGH-(\d+)\b|\(\K\#(\d+)(?=\))/) do
285+
"[#{$&}](#{repo}pull/#{$1 || $2 || $3})"
282286
end
287+
# repo#PR, repo@HASH
288+
# ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791)
289+
# ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/net-http/commit/a8a989b6)
290+
# ref in branckets is not extended
291+
# [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791]
283292
contents.gsub!(%r[(?<![-\w#/@]|\]\[)([-\w]+/[-\w]+)(?:@(\h{8,40})|\#(\d+))(?![-\w#/@]|\]\[)]) do
284293
path = defined?($2) ? "commit/#{$2}" : "pull/#{$3}"
285-
"[#$&](#{host}#{$1}/#{path})"
294+
"[#{$&}](#{host}#{$1}/#{path})"
286295
end
287296
end
288297

0 commit comments

Comments
 (0)