summaryrefslogtreecommitdiff
path: root/support/make4ht/formats
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-11-02 03:01:48 +0000
committerNorbert Preining <norbert@preining.info>2019-11-02 03:01:48 +0000
commit3479a92321ed7fe7e2133d3daec2d4f5fd53fbc6 (patch)
treef81c77e1742124279f68e41484d9e53ad40248ff /support/make4ht/formats
parent61b8d58232b999b6cc966aee9152fb86bbb759cd (diff)
CTAN sync 201911020301
Diffstat (limited to 'support/make4ht/formats')
-rw-r--r--support/make4ht/formats/docbook.lua3
-rw-r--r--support/make4ht/formats/odt.lua23
2 files changed, 14 insertions, 12 deletions
diff --git a/support/make4ht/formats/docbook.lua b/support/make4ht/formats/docbook.lua
index 9e5ffe9488..3bd79eb83e 100644
--- a/support/make4ht/formats/docbook.lua
+++ b/support/make4ht/formats/docbook.lua
@@ -6,6 +6,7 @@ local kpse = require "kpse"
local filter = require "make4ht-filter"
local domfilter = require "make4ht-domfilter"
local xtpipeslib = require "make4ht-xtpipes"
+local log = logging.new "docbook"
function M.prepare_parameters(settings, extensions)
settings.tex4ht_sty_par = settings.tex4ht_sty_par ..",docbook"
@@ -25,7 +26,7 @@ local function call_xtpipes(make)
make:match("xml$", matchfunction)
move_matches(make)
else
- print "Cannot locate xtpipes. Try to set TEXMFROOT variable to a root directory of your TeX distribution"
+ log:warning "Cannot locate xtpipes. Try to set TEXMFROOT variable to a root directory of your TeX distribution"
end
end
diff --git a/support/make4ht/formats/odt.lua b/support/make4ht/formats/odt.lua
index 64b8793e2a..c515a154a1 100644
--- a/support/make4ht/formats/odt.lua
+++ b/support/make4ht/formats/odt.lua
@@ -6,6 +6,7 @@ local kpse = require "kpse"
local filter = require "make4ht-filter"
local domfilter = require "make4ht-domfilter"
local xtpipeslib = require "make4ht-xtpipes"
+local log = logging.new "odt"
function M.prepare_parameters(settings, extensions)
@@ -23,9 +24,12 @@ Odtfile.__index = Odtfile
Odtfile.new = function(archivename)
local self = setmetatable({}, Odtfile)
- -- create temporary directory
+ -- create a temporary file
local tmpname = os.tmpname()
- tmpname = tmpname:match("([a-zA-Z0-9_%-]+)$")
+ -- remove a temporary file, we are interested only in the unique file name
+ os.remove(tmpname)
+ -- get the unique dir name
+ tmpname = tmpname:match("([a-zA-Z0-9_%-%.]+)$")
local status, msg = lfs.mkdir(tmpname)
if not status then return nil, msg end
-- make picture dir
@@ -68,10 +72,10 @@ function Odtfile:pack()
lfs.chdir(self.archivelocation)
-- make temporary mime type file
self:make_mimetype()
- os.execute(zip_command .. " -q0X " .. self.name .. " " .. self.mimetypename)
+ mkutils.execute(zip_command .. " -q0X " .. self.name .. " " .. self.mimetypename)
-- remove it, so the next command doesn't overwrite it
self:remove_mimetype()
- os.execute(zip_command .." -r " .. self.name .. " *")
+ mkutils.execute(zip_command .." -r " .. self.name .. " *")
lfs.chdir(currentdir)
mkutils.cp(self.archivelocation .. "/" .. self.name, self.name)
mkutils.delete_dir(self.archivelocation)
@@ -99,7 +103,7 @@ local function call_xtpipes(make)
move_matches(make)
move_matches(make)
else
- print "Cannot locate xtpipes. Try to set TEXMFROOT variable to a root directory of your TeX distribution"
+ log:warning "Cannot locate xtpipes. Try to set TEXMFROOT variable to a root directory of your TeX distribution"
end
end
@@ -111,7 +115,7 @@ local function prepare_output_files(lgfiles)
local group = groups[extension] or {}
table.insert(group, basename)
groups[extension] = group
- print(basename, extension)
+ log:debug("prepare output file", basename, extension)
end
return groups
end
@@ -130,7 +134,7 @@ function M.modify_build(make)
-- expanded in tex4ht.env in Miktex or Debian
call_xtpipes(make)
-- fix the image dimensions wrongly set by xtpipes
- local domfilters = domfilter {"t4htlinks"}
+ local domfilters = domfilter {"t4htlinks", "odtpartable"}
make:match("4oo$", domfilters)
-- execute it before xtpipes, because we don't want xtpipes to mess with t4htlink elements
move_matches(make)
@@ -138,9 +142,6 @@ function M.modify_build(make)
local fixentities = filter {"entities-to-unicode"}
make:match("4oo", fixentities)
make:match("4om", fixentities)
- -- execute fixentities as first
- move_matches(make)
- move_matches(make)
-- build the ODT file. This match must be executed as a last one
-- this will be executed as a first match, just to find the last filename
@@ -161,7 +162,7 @@ function M.modify_build(make)
local odtname = basename .. ".odt"
local odt,msg = Odtfile.new(odtname)
if not odt then
- print("Cannot create ODT file: " .. msg)
+ log:error("Cannot create ODT file: " .. msg)
end
-- helper function for simple file moving
local function move_file(group, dest)