summaryrefslogtreecommitdiff
path: root/support/make4ht/filters/make4ht-fixligatures.lua
blob: 01b31ed3067c1f6b233ac3a2ea84023cf99e99a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- fix ligatures
-- replace ligatures produced by tex4ht with their components
-- this prevents problems with some readers
local gsub = unicode.utf8.gsub
function filter(s)
	local replaces = {
		["fi"] = "fi",
		["ffi"] = "ffi",
		["fl"] = "fl",
		["ffl"] = "ffl",
		["ff"] = "ff"
	}
	return gsub(s, "([fiffiflfflff])",function (x) return replaces[x] or x end)
end

return filter