Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed May 1, 2024
2 parents 0da75b8 + 969c4a5 commit c55e9f8
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 133 deletions.
233 changes: 125 additions & 108 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ futures = "0.3"
itertools = "0.12"
lazy_static = "1.4"
num_cpus = "1.16"
rayon = "1.8"
rayon = "1.10"
rust-embed = "8.3"
rustc-hash = "1.1"
subprocess = "0.2"
Expand Down
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>
33 changes: 20 additions & 13 deletions layouts/cep.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,39 @@ return function (class)

if class._name == "cabook" then

class:loadPackage("masters", {{
id = "right",
firstContentFrame = "content",
frames = {
content = {
class.defaultFrameset = {
content = {
left = "left(page) + 20mm",
right = "right(page) - 10mm",
top = "top(page) + 20mm",
bottom = "top(footnotes)"
},
runningHead = {
},
runningHead = {
left = "left(content)",
right = "right(content)",
top = "top(content) - 10mm",
bottom = "top(content) - 2mm"
},
footnotes = {
},
footnotes = {
left = "left(content)",
right = "right(content)",
height = "0",
bottom = "bottom(page) - 15mm"
}
}
}})
},
}

SILE.setCommandDefaults("imprint:font", { size = "7pt" })
class:registerPostinit(function (_)
SILE.setCommandDefaults("imprint:font", { size = "7pt" })
end)

-- Hack to avoid SILE bug in print editions
-- See https://github.com/simoncozens/sile/issues/355
class:registerCommand("href", function (options, content)
if class.options.verseindex then
SILE.call("markverse", options, content)
end
SILE.process(content)
end)

end

Expand Down
1 change: 1 addition & 0 deletions layouts/square.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
return function (class)

class.options.binding = "print"
class.options.papersize = 1024 / 300 .. "in x " .. 1024 / 300 .. "in"

end
14 changes: 12 additions & 2 deletions packages/cabook-commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ local spreadHook = function ()
spread_counter = spread_counter + 1
end

local _requireSpaceSamePage
local function _abortRequireSpace ()
_requireSpaceSamePage = false
end

function package:_init ()
base._init(self)
self.class:registerHook("newpage", spreadHook)
self.class:registerHook("newpage", _abortRequireSpace)
end

function package:registerCommands ()
Expand Down Expand Up @@ -599,14 +605,18 @@ function package:registerCommands ()
end, "Output publication dates in proper format for imprint page")

self:registerCommand("requireSpace", function (options, content)
_requireSpaceSamePage = true
local required = SILE.length(options.height or 0)
SILE.typesetter:leaveHmode()
SILE.call("hbox", {}, content) -- push content we want to fit
local heightOfPageSoFar = SILE.pagebuilder:collateVboxes(SILE.typesetter.state.outputQueue).height
local heightOfFrame = SU.cast("length", SILE.typesetter.frame:height())
local heightOfPageSoFar = SILE.pagebuilder:collateVboxes(SILE.typesetter.state.outputQueue).height
table.remove(SILE.typesetter.state.nodes) -- steal it back
SILE.typesetter:leaveHmode()
if heightOfFrame - heightOfPageSoFar < required then
SILE.call("supereject")
if _requireSpaceSamePage then
SILE.call("supereject")
end
end
end)

Expand Down
2 changes: 1 addition & 1 deletion rules/functions.mk
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ define magick_crease ?=
-blur 0x$(call scale,$(call mmtopx,0.2)) \
-level "0x40%!" \
\) \
-compose Divide -composite
-compose Difference -composite
endef

define magick_fray ?=
Expand Down
13 changes: 12 additions & 1 deletion rules/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ MOCKUPFACTOR ?= 1
FIGURES ?=

# Default output formats and parameters (often overridden)
FORMATS ?= pdfs epub mobi odt docx mdbook zola $(and $(ISBNS),play) app html
FORMATS ?= manifest pdfs epub mobi odt docx mdbook zola $(and $(ISBNS),play) app html
BLEED ?= 3
TRIM ?= 10
NOBLEED ?= 0
Expand Down Expand Up @@ -275,6 +275,10 @@ endef

$(foreach FORMAT,$(FORMATS),$(eval $(call format_template,$(FORMAT),$(TARGETS))))

VIRTUALMANIFESTS := $(call pattern_list,$(SOURCES),.manifest)
.PHONY: $(VIRTUALMANIFESTS)
$(VIRTUALMANIFESTS): %.manifest: %-manifest.yml

VIRTUALPDFS := $(call pattern_list,$(SOURCES),.pdfs)
VIRTUALEDITPDFS := $(and $(EDITS),$(call pattern_list,$(SOURCES),$(EDITS),.pdfs))
.PHONY: $(VIRTUALPDFS) $(VIRTUALEDITPDFS)
Expand Down Expand Up @@ -314,8 +318,12 @@ $(VIRTUALPROMOTIONALS): %.promotionals: $(call pattern_list,$$*,$(PLACARDS),-$(_
ifneq ($(words $(TARGETS)),1)
promotionals: series_promotionals
renderings: series_renderings
manifest: series_manifest
endif

.PHONY: series_manifest
series_manifest: $(call pattern_list,$(PROJECT),manifest,.yml)

.PHONY: series_promotionals
series_promotionals: $(PROJECT)-epub-$(_poster)-$(_montage).jpg $(PROJECT)-$(_square)-$(_poster)-$(_montage).jpg

Expand Down Expand Up @@ -727,6 +735,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 +797,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 +909,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 c55e9f8

Please sign in to comment.