diff options
| author | tv <tv@krebsco.de> | 2026-11-12 17:51:42 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-12 17:51:42 +0000 |
| commit | 5781afff2d031034858019dd0c2de364e8126843 (patch) | |
| tree | 41b7ed8ac1dfab94f190a556f04fe7bb749fa260 /pkgs/simple/cgit-about-filter/cgit-about-filter.lua | |
| parent | e13147269cfc8201f2d7e0de1e5aea751585b11e (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) |
