Skip to content

Commit

Permalink
attempt to fix cysouw#15 to maintain beamer frame attributes
Browse files Browse the repository at this point in the history
add "restart" class instead of overwriting other classes
only remove inserted "restart" class
  • Loading branch information
somelinguist authored Dec 12, 2023
1 parent a9eae71 commit d721c80
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pandoc-ling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function addDivToHeader (head)
and head.level == 1
and head.classes[1] ~= "unnumbered"
then
head.attr = {id = head.identifier, class = "restart"}
head.classes:extend({"restart"})
return pandoc.Div(head)
end
end
Expand All @@ -229,10 +229,16 @@ function processDiv (div)

-- keep track of chapters (header == 1)
-- included in this loop by trick "addDivToHeader"
if div.content[1].tag == "Header" and div.content[1].classes[1] == "restart" then
if div.content[1].tag == "Header" then
chapter = chapter + 1
counterInChapter = 0
div.content[1].attr = {id = div.content[1].identifier, class = ""}
classes = {}
for _,cls in ipairs(div.content[1].classes) do
if cls ~= "restart" then
table.insert(classes, cls)
end
end
div.content[1].classes = classes
-- remove div
return div.content
end
Expand Down

0 comments on commit d721c80

Please sign in to comment.