From b8bed49a610a73c2268d75ba246a65e24c25d833 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sat, 26 Dec 2020 18:30:19 +0100 Subject: [PATCH] Pass dict_path to dictionary fix_html_func (#7057) That way images can be made to work in a more generic, portable manner, such as: ``` return function(html, dict_path) html = html:gsub(']*>([^<]*%.jpg)', '') return html end ``` Cf. . --- frontend/apps/reader/modules/readerdictionary.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerdictionary.lua b/frontend/apps/reader/modules/readerdictionary.lua index 604feef72..c588407cd 100644 --- a/frontend/apps/reader/modules/readerdictionary.lua +++ b/frontend/apps/reader/modules/readerdictionary.lua @@ -577,7 +577,8 @@ local function tidyMarkup(results) result.is_html = ifo.is_html result.css = ifo.css if ifo.fix_html_func then - local ok, fixed_definition = pcall(ifo.fix_html_func, result.definition) + local dict_path = util.splitFilePathName(ifo.file) + local ok, fixed_definition = pcall(ifo.fix_html_func, result.definition, dict_path) if ok then result.definition = fixed_definition else