summaryrefslogtreecommitdiff
path: root/support/make4ht/filters/make4ht-entities.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/make4ht/filters/make4ht-entities.lua
Initial commit
Diffstat (limited to 'support/make4ht/filters/make4ht-entities.lua')
-rw-r--r--support/make4ht/filters/make4ht-entities.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/support/make4ht/filters/make4ht-entities.lua b/support/make4ht/filters/make4ht-entities.lua
new file mode 100644
index 0000000000..f9f6c883d1
--- /dev/null
+++ b/support/make4ht/filters/make4ht-entities.lua
@@ -0,0 +1,14 @@
+-- Fix bad entities
+-- Sometimes, tex4ht produce named xml entities, which are prohobited in epub
+-- &nbsp;, for example
+function filter(s)
+ local replaces = {
+ nbsp = "#160"
+ }
+ return s:gsub("&(%w+);",function(x)
+ local m = replaces[x] or x
+ return "&"..m..";"
+ end)
+end
+
+return filter