Skip to content

Commit

Permalink
fix(layouts): Set non-bound page formats to get regular covers not fr…
Browse files Browse the repository at this point in the history
…ont-back ones
  • Loading branch information
alerque committed Apr 25, 2024
1 parent 02fcb54 commit 5ec9c76
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion classes/cabinding.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 7 additions & 5 deletions classes/cabook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion cover.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<sile class="cabinding" crop="false" background="false">
<sile class="cabinding" binding="print" crop="false" background="false">
<nofolios />
<frontcover />
</sile>
3 changes: 3 additions & 0 deletions rules/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ec9c76

Please sign in to comment.