diff options
Diffstat (limited to 'custom/extensions/link-commits.lua')
| -rw-r--r-- | custom/extensions/link-commits.lua | 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 6 insertions, 7 deletions
diff --git a/custom/extensions/link-commits.lua b/custom/extensions/link-commits.lua index e7b17cc..fabd05b 100644 --- a/custom/extensions/link-commits.lua +++ b/custom/extensions/link-commits.lua @@ -10,12 +10,9 @@ -- -- Two kinds of thing are linked, object names (runs of hex that look like git -- hashes) and any number of text-reference rules you define, each a pattern --- and a URL. Both are configured in the block below. All matches are resolved +-- and a URL. Both are configured among the values below. All matches are resolved -- in a single left-to-right pass, so nothing is ever linked twice. --- --- ===== CONFIGURATION ===== --- -- Object names (git hashes). Handled specially, because the length rule cannot -- be written as a plain Lua pattern. @@ -49,6 +46,11 @@ local objects = { -- {n,m} repetition. %d is a digit, %a a letter, %w a letter or digit, %x a hex -- digit, and a literal magic character is escaped with %, so a literal '-' is -- '%-'. Reference: https://www.lua.org/manual/5.1/manual.html#5.4.1 +-- +-- Patterns run against the escaped message, so '&', '<' and '>' reach them as +-- '&', '<' and '>'. Match those entity spellings rather than the +-- bare character, and keep a pattern from ending part way through one, since +-- the matched run is what gets wrapped in the anchor. local rules = { { pattern = "#(%d+)", url = "https://bugs.example.com/?bug=%s" }, -- { pattern = "CVE%-(%d%d%d%d%-%d+)", url = "https://www.cve.org/CVERecord?id=CVE-%s" }, @@ -56,9 +58,6 @@ local rules = { -- { pattern = "RFC%s?(%d+)", url = "https://www.rfc-editor.org/rfc/rfc%s" }, } --- --- ========================= --- local chunks = {} |
