diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Clean up the whole tree
Diffstat (limited to 'custom/extensions/link-commits.lua')
-rw-r--r--custom/extensions/link-commits.lua15
1 file changed, 5 insertions, 10 deletions
diff --git a/custom/extensions/link-commits.lua b/custom/extensions/link-commits.lua
index 42252f3..8dc0bc3 100644
--- a/custom/extensions/link-commits.lua
+++ b/custom/extensions/link-commits.lua
@@ -81,8 +81,7 @@ local function collect(text)
pcall(function()
local init = 1
while init <= #text do
- local start, stop, capture =
- string.find(text, rule.pattern, init)
+ local start, stop, capture = string.find(text, rule.pattern, init)
if not start then break end
if capture == nil then
capture = string.sub(text, start, stop)
@@ -91,8 +90,7 @@ local function collect(text)
start = start,
stop = stop,
priority = priority,
- link = make_link(rule.url, capture,
- string.sub(text, start, stop)),
+ link = make_link(rule.url, capture, string.sub(text, start, stop)),
}
-- An empty match still has to advance the
-- scan, or it never reaches the end.
@@ -104,11 +102,9 @@ local function collect(text)
local priority = #rules + 1
local init = 1
while init <= #text do
- local start, stop, run =
- string.find(text, "%f[%w](%x+)%f[%W]", init)
+ local start, stop, run = string.find(text, "%f[%w](%x+)%f[%W]", init)
if not start then break end
- if #run >= objects.min_length
- and #run <= objects.max_length then
+ if #run >= objects.min_length and #run <= objects.max_length then
candidates[#candidates + 1] = {
start = start,
stop = stop,
@@ -145,8 +141,7 @@ function filter_close()
-- A candidate reaching back into one already emitted is
-- dropped, so no run of text is ever wrapped twice.
if candidate.start >= pos then
- out[#out + 1] =
- string.sub(text, pos, candidate.start - 1)
+ out[#out + 1] = string.sub(text, pos, candidate.start - 1)
out[#out + 1] = candidate.link
pos = candidate.stop + 1
end