diff options
| author | tv <tv@krebsco.de> | 2026-11-12 17:51:42 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-12 18:55:35 +0100 |
| commit | 17105dc54db3f6e28ce8e987eb0d870304669bb9 (patch) | |
| tree | 7e6ef9edb24b9e15c996463417250df659093ae3 /pkgs/simple/cgit-about-filter/cgit-about-filter.lua | |
| parent | b79ea5f9615e0fdaa654fb07d4e6f2f88e1d93fe (diff) | |
cgit-about-filter: keep fragments out of the path
Diffstat (limited to 'pkgs/simple/cgit-about-filter/cgit-about-filter.lua')
| -rw-r--r-- | pkgs/simple/cgit-about-filter/cgit-about-filter.lua | 7 |
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) |
