mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Dictionary: fix missing images (#12877)
Pass the dictionary's res directory to Mupdf.openDocumentFromText to allow MuPDF to display images referenced by HTML dictionaries. Depends on: https://github.com/koreader/koreader-base/pull/2002 Fixes: https://github.com/koreader/koreader/issues/12628
This commit is contained in:
@@ -641,10 +641,10 @@ local function tidyMarkup(results)
|
||||
result.ifo_lang = ifo.lang
|
||||
end
|
||||
if ifo and ifo.is_html then
|
||||
local dict_path = util.splitFilePathName(ifo.file)
|
||||
result.is_html = ifo.is_html
|
||||
result.css = ifo.css
|
||||
if ifo.fix_html_func then
|
||||
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
|
||||
@@ -652,6 +652,11 @@ local function tidyMarkup(results)
|
||||
logger.warn("Dict's user provided function failed:", fixed_definition)
|
||||
end
|
||||
end
|
||||
|
||||
local res_dir = dict_path .. "res"
|
||||
if lfs.attributes(res_dir, "mode") == "directory" then
|
||||
result.dictionary_resource_directory = res_dir
|
||||
end
|
||||
else
|
||||
local def = result.definition
|
||||
-- preserve the <br> tag for line break
|
||||
|
||||
Reference in New Issue
Block a user