summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-10 22:21:14 +0000
committerKarl Berry <karl@freefriends.org>2019-01-10 22:21:14 +0000
commit8368bb1a1e80c128b441a121a8fda08f0e32d5ae (patch)
treefb96d623f66cd3bd555c48c0874af9c5ec85fc07 /Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua
parent59da7b9e7d480f0bc7e89000998103cd707436e7 (diff)
make4ht (10jan19)
git-svn-id: svn://tug.org/texlive/trunk@49664 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua')
-rw-r--r--Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua b/Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua
index f93e776717f..fb921a631a3 100644
--- a/Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua
+++ b/Master/texmf-dist/scripts/make4ht/filters/make4ht-entities-to-unicode.lua
@@ -1,13 +1,15 @@
-- convert Unicode characters encoded as XML entities back to Unicode
--- list of disabled characters
-local disabled = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;" }
local utfchar = unicode.utf8.char
+-- list of disabled characters
+local disabled = { ["&"] = "&amp;", ["<"] = "&lt;", [">"] = "&gt;"}
return function(content)
- return content:gsub("%&%#x([A-Fa-f0-9]+);", function(entity)
+ local content = content:gsub("%&%#x([A-Fa-f0-9]+);", function(entity)
-- convert hexadecimal entity to Unicode
local newchar = utfchar(tonumber(entity, 16))
-- we don't want to break XML validity with forbidden characters
return disabled[newchar] or newchar
end)
+ -- the non-breaking space character cause issues in the ODT opening
+ return content:gsub(string.char(160), "&#xA0;")
end