summaryrefslogtreecommitdiff
path: root/filters/toc.lua
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2023-04-03 23:27:59 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2023-04-03 23:27:59 +0200
commit266c01f30c6e5cb099d255fa8c58f5da1638d88d (patch)
tree02f3b35cd856c01cf9d72c870226d144bc4b3024 /filters/toc.lua
parent8ee01ecf42136344a095805a68485a99f2a59c29 (diff)
WIP: Prepare for newer Pandoc versions
- It fails to build the book.pdf using LaTeX for several reasons I'm to lazy to note here. - The rest of the things build perfectly (need more extensive testing but looks ok)
Diffstat (limited to 'filters/toc.lua')
-rw-r--r--filters/toc.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/filters/toc.lua b/filters/toc.lua
index 102ac83..a1bc33e 100644
--- a/filters/toc.lua
+++ b/filters/toc.lua
@@ -48,7 +48,7 @@ if FORMAT:match 'html' then
end
i = i + 1
end
- else
+ else
-- toc_depth not set so get the max_level from the contents
for i, v in ipairs(links) do
if v[1] > max_level then max_level = v[1] end
@@ -60,7 +60,7 @@ if FORMAT:match 'html' then
local i = 1
local tmp = {}
while i <= #links do
- local level = links[i][1] -- Element's level
+ local level = links[i][1] -- Element's level
if level == max_level then -- Found group
-- If group is found, it usually has a parent
local parent = links[i-1]
@@ -110,9 +110,10 @@ if FORMAT:match 'html' then
end
function Meta(m)
- local toc_depth
+ local toc_depth = -1
+
if m["toc-depth"] ~= nil then
- toc_depth = tonumber(m["toc-depth"][1]["c"])
+ toc_depth = tonumber(m["toc-depth"][1].text)
else
toc_depth = -1
end