diff options
Diffstat (limited to 'Master/texmf-dist/scripts/make4ht/extensions')
3 files changed, 27 insertions, 71 deletions
diff --git a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-build_changed.lua b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-build_changed.lua deleted file mode 100644 index e0fc5ec6eb2..00000000000 --- a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-build_changed.lua +++ /dev/null @@ -1,68 +0,0 @@ --- this make4ht build file tries to recompile modified blog article sources --- - --- disable any compilation -Make.build_seq = {} -Make:add("tex4ht", "") -Make:add("t4ht", "") - -local log = logging.new "compile newest" - - - --- construct the name of the generated HTML file from the .published file -local function get_generated_html_name(published_file, directory, file_pattern) - local f = io.open(directory .. "/" .. published_file, "r") - local content = f:read("*all") - f:close() - local timestamp = tonumber(content) - local basename = mkutils.remove_extension(published_file) - local tex_file = basename .. ".tex" - -- expand fillename in the file_pattern - local expanded = file_pattern % {input = basename} - -- expand date in the file_pattern - expanded = os.date(expanded, timestamp) - log:status("found source files :", directory, basename, expanded) - return {directory = directory, tex_file = tex_file, generated = expanded .. ".html"} -end - --- process subdirectories of the basedir and look for the filename.published files -local function find_published(basedir, file_pattern) - local published = {} - for f in lfs.dir(basedir) do - local fullname = basedir .. "/" .. f - local attributes = lfs.attributes(fullname) - -- process directories, but ignore . and .. - if attributes.mode == "directory" and f ~= "." and f~= ".." then - for name in lfs.dir(fullname) do - if name:match("published$") then - published[#published + 1] = get_generated_html_name(name, fullname, file_pattern) - end - - end - end - end - return published -end - --- find tex files that were modified later than the generated HTML files -local function find_changed(published, site_root) - local keep = {} - for _, entry in ipairs(published) do - local source_attributes = lfs.attributes(entry.directory .. "/" .. entry.tex_file) - local dest_attributes = lfs.attributes(site_root .. "/" .. entry.generated) - -- - print(entry.tex_file, entry.generated, source_attributes.change < dest_attributes.change) - end -end - - -Make:add("rebuild", function(par) - local config = get_filter_settings "staticsite" - -- how the generated HTML files are named - local file_pattern = config.file_pattern or "%Y-%m-%d-${input}" - local published = find_published(par.tex_dir, file_pattern) - local changed = find_changed(published, config.site_root) -end) - -Make:rebuild{tex_dir = "posts"} diff --git a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua index 802902d48d7..6219c95fbd2 100644 --- a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua +++ b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-common_domfilters.lua @@ -26,7 +26,7 @@ function M.modify_build(make) make:match("4om$", process, {charclasses= charclasses}) count = 2 else - local process = filter {"fixinlines", "idcolons", "joincharacters", "mathmlfixes", "tablerows","booktabs"} + local process = filter {"fixinlines", "idcolons", "joincharacters", "mathmlfixes", "tablerows","booktabs", "sectionid", "itemparagraphs"} make:match("html?$", process) count = 1 end diff --git a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-staticsite.lua b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-staticsite.lua index 5704959970a..a9a5bcece7c 100644 --- a/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-staticsite.lua +++ b/Master/texmf-dist/scripts/make4ht/extensions/make4ht-ext-staticsite.lua @@ -16,7 +16,7 @@ local function get_slug(settings) local f = io.open(published_name, "r") local readtime = f:read("*line") time = tonumber(readtime) - log:info("Already pubslished", slug) + log:info("Already pubslished", os.date("%Y-%m-%d %H:%M", time)) f:close() else -- escape @@ -76,6 +76,22 @@ local function insert_filter(make, pattern, fn) }) end +local function remove_maketitle(make) + -- use DOM filter to remove \maketitle block + local domfilter = require "make4ht-domfilter" + local process = domfilter { + function(dom) + local maketitles = dom:query_selector(".maketitle") + for _, el in ipairs(maketitles) do + log:debug("removing maketitle") + el:remove_node() + end + return dom + end + } + make:match("html$", process) +end + local function copy_files(filename, par) local function prepare_path(dir, subdir) @@ -84,7 +100,7 @@ local function copy_files(filename, par) end -- get extension settings local site_settings = get_filter_settings "staticsite" - local site_root = site_settings.site_root + local site_root = site_settings.site_root or "./" local map = site_settings.map or {} -- default path without subdir, will be used if the file is not matched -- by any pattern in the map @@ -107,6 +123,14 @@ function M.modify_build(make) local process = filter { "staticsite" } + + -- detect if we should remove maketitle + local site_settings = get_filter_settings "staticsite" + -- \maketitle is removed by default, set `remove_maketitle=false` setting to disable that + if site_settings.remove_maketitle ~= false then + remove_maketitle(make) + end + local settings = make.params -- get the published file name local slug = get_slug(settings) |