aboutsummaryrefslogtreecommitdiff
path: root/lua/muwiki/links.lua
diff options
context:
space:
mode:
authormoxie <moxie@3kgcat.fi>2026-03-16 02:21:16 +0200
committermoxie <moxie@3kgcat.fi>2026-03-16 02:30:19 +0200
commitc566653a645c8317f336043117766745304b7887 (patch)
tree2014fc5f94dd7b0c7f820f0ba92cc064abf2988e /lua/muwiki/links.lua
parent379e5af690c8ab298ef5d32fcaddae070c4ff8a5 (diff)
refactor: normalize text_extensions at config time
Diffstat (limited to 'lua/muwiki/links.lua')
-rw-r--r--lua/muwiki/links.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/lua/muwiki/links.lua b/lua/muwiki/links.lua
index 2972973..2213dae 100644
--- a/lua/muwiki/links.lua
+++ b/lua/muwiki/links.lua
@@ -13,12 +13,11 @@ local M = {}
---@field cmd string|function Command or function to handle the URL
---@field exts string[]? Optional list of file extensions this handler supports
+-- TODO: Support compound extensions like "tar.gz" or "min.js"
local function is_text_extension(ext)
- local text_exts = config.options.text_extensions or {}
- ext = ext:gsub("^%.", "")
- for _, text_ext in ipairs(text_exts) do
- local normalized = text_ext:gsub("^%.", "")
- if normalized == ext then
+ local target = ext:gsub("^%.", "")
+ for _, cfg_ext in ipairs(config.options.text_extensions or {}) do
+ if cfg_ext == target then
return true
end
end