summaryrefslogtreecommitdiff
path: root/support/make4ht/extensions/make4ht-ext-common_filters.lua
diff options
context:
space:
mode:
Diffstat (limited to 'support/make4ht/extensions/make4ht-ext-common_filters.lua')
-rw-r--r--support/make4ht/extensions/make4ht-ext-common_filters.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/support/make4ht/extensions/make4ht-ext-common_filters.lua b/support/make4ht/extensions/make4ht-ext-common_filters.lua
new file mode 100644
index 0000000000..513fbed34e
--- /dev/null
+++ b/support/make4ht/extensions/make4ht-ext-common_filters.lua
@@ -0,0 +1,26 @@
+local M = {}
+
+
+local filter = require "make4ht-filter"
+local process = filter {"cleanspan-nat", "fixligatures", "hruletohr", "entities", "fix-links"}
+
+-- filters support only html formats
+function M.test(format)
+ if format == "odt" then return false end
+ return true
+end
+
+function M.modify_build(make)
+ 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
+ end
+ return make
+end
+
+return M