Skip to content

Commit

Permalink
recognize inline math and comments as inline content
Browse files Browse the repository at this point in the history
  • Loading branch information
michal-h21 committed Dec 5, 2024
1 parent 8bf64a3 commit 3392b16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
7 changes: 4 additions & 3 deletions domfilters/make4ht-fixinlines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,6 +67,7 @@ local function fix_inlines(obj)
new = nil
end
else
print("else", jej._type)
new = nil
end
end)
Expand Down

0 comments on commit 3392b16

Please # to comment.