summaryrefslogtreecommitdiff
path: root/support/make4ht/extensions/make4ht-ext-common_filters.lua
blob: 513fbed34eee0f2f75e75599b30ea0f53acd36b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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