Skip to content

Commit 6aadf6e

Browse files
committed
Merge #735: Plugins: fix monotree repo ref from gui/#123 to gui#123
2ca4ef2 Plugins: fix monotree repo ref from gui/#123 to gui#123 (David A. Harding) Pull request description: There was a slight miscommunication about the expected format in #733, this uses the format from #734 as tested on the actual release notes: ![2021-01-14-05_34_49_583462950](https://user-images.githubusercontent.com/61096/104612399-3f90c700-562a-11eb-82a3-3de2af4ac4de.png) I also quickly checked the HTML diff from before and after this change and I only saw one unwanted change (a link to an issue was dropped). I think that's acceptable to keep the pattern simple. ![2021-01-14-05_28_39_838430961](https://user-images.githubusercontent.com/61096/104612600-7961cd80-562a-11eb-8fa0-839eba950f62.png) ACKs for top commit: laanwj: ACK 2ca4ef2 Tree-SHA512: 4e312ac92904f0abab70ca0fa5d45586bff686746162d25ae9ce0653f732e9e0964ea435a9a0f7a4fa40de4ee4372a7cb9c37f8e53a55d978333636bf89373fe
2 parents f9d6f3f + 2ca4ef2 commit 6aadf6e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

_plugins/githubify.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ def render(context)
2626
## Convert #1234 into URL for the pull request
2727
## If #1234 links to an issue, GitHub automatically redirects
2828
#
29-
## Main repository; forbid prefix of "/" to avoid conflation with
29+
## Main repository; forbid any lowercase alphabetical prefix to avoid conflation with
3030
## other monotree repos like bitcoin-core/gui. Require at least a
3131
## double-digit number to reduce false positive matches (e.g. "fix thing,
3232
## try #2")
33-
output.gsub!(/(^|[^\/])#([0-9]+)/){ |s|
33+
output.gsub!(/(^|[^a-z])#([0-9][0-9]+)/){ |s|
3434
$1 + '<a href="' + @repository_url + '/pull/' + $2 + '">#' + $2 + '</a>'
3535
}
3636

37-
## Other monotree repos; for repo "bitcoin-core/foo", PR format is "foo/#123"
38-
output.gsub!(/([a-z]+)\/#([0-9]+)/){ |s|
37+
## Other monotree repos; for repo "bitcoin-core/foo", PR format is "foo#123".
38+
## Must start at word boundary
39+
output.gsub!(/\b([a-z]+)#([0-9]+)/){ |s|
3940
'<a href="https://github.com/bitcoin-core/' + $1 + '/pull/' + $2 + '">' + s + '</a>'
4041
}
4142

0 commit comments

Comments
 (0)