From 5ec9c76613a19afb286bc7372106881f830b5240 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 25 Apr 2024 21:39:01 +0300 Subject: [PATCH] fix(layouts): Set non-bound page formats to get regular covers not front-back ones --- classes/cabinding.lua | 2 +- classes/cabook.lua | 12 +++++++----- cover.xml | 2 +- rules/rules.mk | 3 +++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/classes/cabinding.lua b/classes/cabinding.lua index aa6c49c5..9126734f 100644 --- a/classes/cabinding.lua +++ b/classes/cabinding.lua @@ -89,7 +89,7 @@ function class:declareOptions () if size then self.papersize = size local parsed = SILE.papersize(size) - if binding == "print" or CASILE.layout == "print" then + if binding == "print" or CASILE.binding == "print" then self.defaultFrameset = posterFrameset SILE.documentState.paperSize = { parsed[1], parsed[2] } else diff --git a/classes/cabook.lua b/classes/cabook.lua index 077ae706..fb2df003 100644 --- a/classes/cabook.lua +++ b/classes/cabook.lua @@ -103,17 +103,19 @@ function class:declareOptions () end function class:setOptions (options) - options.binding = options.binding or "print" -- print, paperback, hardcover, coil, stapled + options.binding = options.binding or CASILE.binding or "print" -- print, paperback, hardcover, coil, stapled + -- Set binding first if we have it so that the layout can adapt the papersize based on the binding + self.options.binding = options.binding options.crop = options.crop or (options.binding ~= "print") - options.background = options.background or true - options.verseindex = options.verseindex or false - options.layout = options.layout or CASILE.layout or "a4" - -- Set layout first because it resets paper size. If we don't a random race + -- Set layout next because it resets paper size. If we don't a random race -- condition picks the default papersize *or* our layout to be set first. + options.layout = options.layout or CASILE.layout or "a4" self.options.layout = options.layout -- Now set the rest but with the papersize reset to whatever layout wanted options.papersize = self.options.papersize options.layout = nil + options.background = options.background or true + options.verseindex = options.verseindex or false book.setOptions(self, options) end diff --git a/cover.xml b/cover.xml index 2e9f7ff6..fc159544 100644 --- a/cover.xml +++ b/cover.xml @@ -1,4 +1,4 @@ - + diff --git a/rules/rules.mk b/rules/rules.mk index ae24b9ac..a7c0b6e4 100644 --- a/rules/rules.mk +++ b/rules/rules.mk @@ -727,6 +727,7 @@ $(BINDINGFRAGMENTS): $(BUILDDIR)/%-$(_binding)-$(_text).pdf: local metadatafile = "$(filter %-manifest.yml,$^)" CASILE.metadata = require("readmeta").load(metadatafile) CASILE.layout = "$(or $(__$(call parse_papersize,$@)),$(call parse_papersize,$@))" + CASILE.binding = "$(or $(__$(call parse_binding,$@)),$(call parse_binding,$@))" CASILE.language = "$(LANGUAGE)" CASILE.spine = "$(call spinemm,$(filter %.pdf,$^))mm" return { _name = "$*", type = "casile" } @@ -788,6 +789,7 @@ $(COVERFRAGMENTS): $(BUILDDIR)/%-$(_text).pdf: local metadatafile = "$(filter %-manifest.yml,$^)" CASILE.metadata = require("readmeta").load(metadatafile) CASILE.layout = "$(or $(__$(call parse_papersize,$@)),$(call parse_papersize,$@))" + CASILE.binding = "$(or $(__$(call parse_binding,$@)),$(call parse_binding,$@))" CASILE.language = "$(LANGUAGE)" return { _name = "casile", type = "casile" } EOF @@ -899,6 +901,7 @@ $(EMPTYGEOMETRIES): $(BUILDDIR)/$(_geometry)-%.pdf: $(CASILEDIR)/geometry.xml | cat <<- EOF > $(BUILDDIR)/$*.lua CASILE.versioninfo = "$(call versioninfo,$@)" CASILE.layout = "$(or $(__$(call parse_papersize,$@)),$(call parse_papersize,$@))" + CASILE.binding = "$(or $(__$(call parse_binding,$@)),$(call parse_binding,$@))" CASILE.language = "$(LANGUAGE)" return { _name = "$*", type = "casile" } EOF