From c566653a645c8317f336043117766745304b7887 Mon Sep 17 00:00:00 2001 From: moxie Date: Mon, 16 Mar 2026 02:21:16 +0200 Subject: refactor: normalize text_extensions at config time --- lua/muwiki/links.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lua/muwiki/links.lua') 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 -- cgit v1.2.3