summaryrefslogtreecommitdiff
path: root/support/make4ht/extensions/make4ht-ext-common_domfilters.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-11-04 03:00:32 +0000
committerNorbert Preining <norbert@preining.info>2019-11-04 03:00:32 +0000
commit97106ae9313f56715ee9a7dd39d708158c1bedb9 (patch)
tree971af8a9f54fd1edc86349c5726a3fc7682cb1e5 /support/make4ht/extensions/make4ht-ext-common_domfilters.lua
parentaa26106a9b77529d1eae806729d8076378ced64b (diff)
CTAN sync 201911040300
Diffstat (limited to 'support/make4ht/extensions/make4ht-ext-common_domfilters.lua')
-rw-r--r--support/make4ht/extensions/make4ht-ext-common_domfilters.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/support/make4ht/extensions/make4ht-ext-common_domfilters.lua b/support/make4ht/extensions/make4ht-ext-common_domfilters.lua
new file mode 100644
index 0000000000..9399492d90
--- /dev/null
+++ b/support/make4ht/extensions/make4ht-ext-common_domfilters.lua
@@ -0,0 +1,36 @@
+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)
+ current_format = format
+ -- if format == "odt" then return false end
+ return true
+end
+
+function M.modify_build(make)
+ -- 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
+
+return M