summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua')
-rw-r--r--Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua29
1 files changed, 19 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua b/Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua
index 7c9a2dfaea4..9399492d907 100644
--- a/Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua
+++ b/Master/texmf-dist/scripts/make4ht/extensions/common_domfilters.lua
@@ -1,25 +1,34 @@
local M = {}
+-- this variable will hold the output format name
+local current_format
+
local filter = require "make4ht-domfilter"
-- local process = filter {"fixinlines", "idcolons", "joincharacters" }
-- filters support only html formats
function M.test(format)
- if format == "odt" then return false end
+ current_format = format
+ -- if format == "odt" then return false end
return true
end
function M.modify_build(make)
- local process = filter {"fixinlines", "idcolons", "joincharacters"}
- make:match("html$", process)
- local matches = make.matches
- -- the filters should be first match to be executed, especially if tidy
- -- should be executed as well
- if #matches > 1 then
- local last = matches[#matches]
- table.insert(matches, 1, last)
- matches[#matches] = nil
+ -- number of filters that should be moved to the beginning
+ local count = 0
+ if current_format == "odt" then
+ -- some formats doesn't make sense in the ODT format
+ local process = filter {"joincharacters"}
+ local charclasses = {mn = true, ["text:span"] = true}
+ make:match("4oo$", process, {charclasses= charclasses})
+ -- match math documents
+ make:match("4om$", process, {charclasses= charclasses})
+ count = 2
+ else
+ local process = filter {"fixinlines", "idcolons", "joincharacters", "tablerows"}
+ make:match("html$", process)
+ count = 1
end
return make
end