Skip to content

Commit

Permalink
fix(cabook): Only attempt to run numbering :pre & :post hooks if they…
Browse files Browse the repository at this point in the history
… exist
  • Loading branch information
alerque committed Jan 31, 2023
1 parent e1c57b3 commit 9fb57c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/cabook-block-styles.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function package:registerCommands ()
level = 2,
reset = false,
display = options.display,
prenumber = "book:chapter:pre",
postnumber = "book:chapter:post"
prenumber = "cabook:chapter:pre",
postnumber = "cabook:chapter:post"
}, content)
end)
SILE.call("cabook:font:chaptertitle", {}, content)
Expand Down
4 changes: 2 additions & 2 deletions packages/cabook-commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ function package:registerCommands ()
local val = self.class.packages.counters:formatCounter({ display = "arabic", value = counters.value[level] })
toc_content[1] = val .. ". " .. SU.contentToString(content[1])
end
if options.prenumber then
if options.prenumber and SILE.Commands[options.prenumber] then
if SILE.Commands["book:chapter:precounter"] then SILE.call("book:chapter:precounter") end
SILE.call(options.prenumber)
end
SILE.call("show-multilevel-counter", { id = "sectioning", display = options.display, minlevel = level, level = level })
if options.postnumber then
if options.postnumber and SILE.Commands[options.postnumber] then
SILE.call(options.postnumber)
end
local number = self.class.packages.counters:formatCounter({ display = "arabic", value = counters.value[level] })
Expand Down

0 comments on commit 9fb57c4

Please sign in to comment.