From 3392b166565f0512c7c61c7c917dd79faa30a339 Mon Sep 17 00:00:00 2001 From: Michal Hoftich Date: Thu, 5 Dec 2024 11:26:10 +0100 Subject: [PATCH] recognize inline math and comments as inline content --- CHANGELOG.md | 4 ++++ domfilters/make4ht-fixinlines.lua | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb7ebe9..af99b43 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +- 2024/12/05 + + - recognize inline math and comments as inline content in the `fixinlines` DOM filter. + - 2024/11/09 - fixed `tablerows` for longtables longer than 200 rows. diff --git a/domfilters/make4ht-fixinlines.lua b/domfilters/make4ht-fixinlines.lua index 0233850..e82da1a 100644 --- a/domfilters/make4ht-fixinlines.lua +++ b/domfilters/make4ht-fixinlines.lua @@ -42,11 +42,11 @@ local function fix_inlines(obj) local inline_elements = settings.inline_elements or inline_elements local nodes = obj:get_path("html body") local new = nil - obj:traverse_node_list(nodes, function(jej) - if jej._type == "ELEMENT" or jej._type == "TEXT" then + obj:traverse_node_list(nodes, function(jej) + if jej._type == "ELEMENT" or jej._type == "TEXT" or jej._type == "COMMENT" then local name = string.lower(jej._name or "") -- local parent = jej:get_parent_node() - if inline_elements[name] or jej._type == "TEXT" then + if inline_elements[name] or jej._type == "TEXT" or jej._type == "COMMENT" or (name:match(":?math") and jej:get_attribute("display") == "inline") then if not new then -- start new paragraph if jej._type == "TEXT" and jej._text:match("^%s+$") then @@ -67,6 +67,7 @@ local function fix_inlines(obj) new = nil end else + print("else", jej._type) new = nil end end)