From 97106ae9313f56715ee9a7dd39d708158c1bedb9 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 4 Nov 2019 03:00:32 +0000 Subject: CTAN sync 201911040300 --- .../extensions/make4ht-ext-latexmk_build.lua | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 support/make4ht/extensions/make4ht-ext-latexmk_build.lua (limited to 'support/make4ht/extensions/make4ht-ext-latexmk_build.lua') diff --git a/support/make4ht/extensions/make4ht-ext-latexmk_build.lua b/support/make4ht/extensions/make4ht-ext-latexmk_build.lua new file mode 100644 index 0000000000..bf4dcdde5a --- /dev/null +++ b/support/make4ht/extensions/make4ht-ext-latexmk_build.lua @@ -0,0 +1,31 @@ +-- use Latexmk in first LaTeX call +-- only in the first call, because we don't need to execute biber, etc. in the subsequent +-- LaTeX calls, these are only for resolving the cross-references +local M = {} +function M.modify_build(make) + local used = false + local first + local build_seq = make.build_seq + -- find first htlatex call in the build sequence + for pos,v in ipairs(build_seq) do + if v.name == "htlatex" and not first then + first = pos + end + end + -- if htlatex was found + if first then + -- add dummy latexmk call to the build sequence + make:latexmk {} + -- replace name, command and type in the first htlatex + -- call with values from the dummy latexmk call + local replaced = build_seq[first] + local latexmk = build_seq[#build_seq] + replaced.name = latexmk.name + replaced.command = latexmk.command + replaced.type = latexmk.type + -- remove the dummy latexmk + table.remove(build_seq) + end + return make +end +return M -- cgit v1.2.3