summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/make4ht/make4ht2
-rw-r--r--Master/texmf-dist/doc/support/make4ht/changelog.tex11
-rw-r--r--Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdfbin111304 -> 111789 bytes
-rw-r--r--Master/texmf-dist/scripts/make4ht/filters/make4ht-odttemplate.lua32
-rwxr-xr-xMaster/texmf-dist/scripts/make4ht/make4ht2
5 files changed, 44 insertions, 3 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/make4ht/make4ht b/Build/source/texk/texlive/linked_scripts/make4ht/make4ht
index 1d558e59579..44c3582134a 100755
--- a/Build/source/texk/texlive/linked_scripts/make4ht/make4ht
+++ b/Build/source/texk/texlive/linked_scripts/make4ht/make4ht
@@ -27,7 +27,7 @@ make4ht [options] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op"]
-- set version number. the template should be replaced by the
-- actual version number by the build script
-local version = "v0.2d"
+local version = "v0.2e"
mkparams.version_number = version
local args = mkparams.get_args()
diff --git a/Master/texmf-dist/doc/support/make4ht/changelog.tex b/Master/texmf-dist/doc/support/make4ht/changelog.tex
index 1467115b2c5..b8d6ea15a0b 100644
--- a/Master/texmf-dist/doc/support/make4ht/changelog.tex
+++ b/Master/texmf-dist/doc/support/make4ht/changelog.tex
@@ -3,6 +3,17 @@
\begin{itemize}
\item
+ 2019/01/22
+
+ \begin{itemize}
+ \tightlist
+ \item
+ updated the \texttt{odttemplate} filter. It will use styles from the
+ generated ODT file that haven't been present in the template file.
+ \item
+ version 0.2e released
+ \end{itemize}
+\item
2019/01/10
\begin{itemize}
diff --git a/Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdf b/Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdf
index e05e081ad12..9a767c9cc73 100644
--- a/Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdf
+++ b/Master/texmf-dist/doc/support/make4ht/make4ht-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/make4ht/filters/make4ht-odttemplate.lua b/Master/texmf-dist/scripts/make4ht/filters/make4ht-odttemplate.lua
index cadcbfcd478..c323d206c10 100644
--- a/Master/texmf-dist/scripts/make4ht/filters/make4ht-odttemplate.lua
+++ b/Master/texmf-dist/scripts/make4ht/filters/make4ht-odttemplate.lua
@@ -1,5 +1,6 @@
local mkutils = require "mkutils"
local zip = require "zip"
+local domobject = require "luaxml-domobject"
local function get_template_filename(settings)
@@ -12,6 +13,34 @@ local function get_template_filename(settings)
return settings.template or filtersettings.template
end
+local function join_styles(old, new)
+ local old_dom = domobject.parse(old)
+ local new_dom = domobject.parse(new)
+
+ local template_styles = {}
+ local template_obj -- <office:styles> element, we will add new styles from the generated ODT here
+
+ -- detect style names in the template file and save them in a table for easy accesss
+ for _, style in ipairs(new_dom:query_selector("office|styles *")) do
+ template_obj = template_obj or style:get_parent()
+ local name = style:get_attribute("style:name") -- get the <office:styles> element
+ if name then
+ template_styles[name] = true
+ end
+ end
+
+ -- process the generated styles and add ones not used in the template
+ for _, style in ipairs(old_dom:query_selector("office|styles *")) do
+ local name = style:get_attribute("style:name")
+ if name and not template_styles[name] then
+ template_obj:add_child_node(style)
+ end
+ end
+
+ -- return template with additional styles from the generated file
+ return new_dom:serialize()
+end
+
return function(content, settings)
-- use settings added from the Make:match, or default settings saved in Make object
local templatefile = get_template_filename(settings)
@@ -23,7 +52,8 @@ return function(content, settings)
-- just break if the styles cannot be found
if not stylesfile then return content end
local styles = stylesfile:read("*all")
- return styles
+ local newstyle = join_styles(content, styles)
+ return newstyle
end
-- just return content in the case of problems
return content
diff --git a/Master/texmf-dist/scripts/make4ht/make4ht b/Master/texmf-dist/scripts/make4ht/make4ht
index 1d558e59579..44c3582134a 100755
--- a/Master/texmf-dist/scripts/make4ht/make4ht
+++ b/Master/texmf-dist/scripts/make4ht/make4ht
@@ -27,7 +27,7 @@ make4ht [options] filename ["tex4ht.sty op." "tex4ht op." "t4ht op" "latex op"]
-- set version number. the template should be replaced by the
-- actual version number by the build script
-local version = "v0.2d"
+local version = "v0.2e"
mkparams.version_number = version
local args = mkparams.get_args()