summaryrefslogtreecommitdiffstats
path: root/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/simple/cgit-about-filter/cgit-about-filter.lua')
-rw-r--r--pkgs/simple/cgit-about-filter/cgit-about-filter.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
index 1b37643..64e16fa 100644
--- a/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
+++ b/pkgs/simple/cgit-about-filter/cgit-about-filter.lua
@@ -73,12 +73,15 @@ function filter_close()
return string.format("[%s](%s)", text, path)
end
+ local fragment
+ path, fragment = path:match("^([^#]*)(.*)$")
+
path = resolve(current_dir, path)
if path:sub(-3) == ".md" then
- return string.format("[%s](/%s/about/%s)", text, repo, path)
+ return string.format("[%s](/%s/about/%s%s)", text, repo, path, fragment)
else
- return string.format("[%s](/%s/tree/%s)", text, repo, path)
+ return string.format("[%s](/%s/tree/%s%s)", text, repo, path, fragment)
end
end)