From 9fb57c48d1e89c09c646dbe328f92b6924c24bb7 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Tue, 31 Jan 2023 15:02:14 +0300 Subject: [PATCH] fix(cabook): Only attempt to run numbering :pre & :post hooks if they exist --- packages/cabook-block-styles.lua | 4 ++-- packages/cabook-commands.lua | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cabook-block-styles.lua b/packages/cabook-block-styles.lua index 1ddf43d4..537daebb 100644 --- a/packages/cabook-block-styles.lua +++ b/packages/cabook-block-styles.lua @@ -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) diff --git a/packages/cabook-commands.lua b/packages/cabook-commands.lua index 4160e146..d320f3fa 100644 --- a/packages/cabook-commands.lua +++ b/packages/cabook-commands.lua @@ -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] })