Skip to content

Commit

Permalink
feat(classes): Add edition handler as class option
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Feb 16, 2023
1 parent 364bfbe commit 5821e3d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion classes/cabook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end

function class:declareOptions ()
book.declareOptions(self)
local binding, crop, background, verseindex, layout
local binding, crop, edition, background, verseindex, layout
self:declareOption("binding", function (_, value)
if value then binding = value end
return binding
Expand All @@ -77,6 +77,10 @@ function class:declareOptions ()
if value then crop = SU.cast("boolean", value) end
return crop
end)
self:declareOption("edition", function (_, value)
if value then edition = value end
return edition
end)
self:declareOption("background", function (_, value)
if value then background = SU.cast("boolean", value) end
return background
Expand All @@ -96,6 +100,7 @@ end

function class:setOptions (options)
options.binding = options.binding or "print" -- print, paperback, hardcover, coil, stapled
options.edition = options.edition
options.crop = options.crop or (options.binding ~= "print")
options.background = options.background or true
options.verseindex = options.verseindex or false
Expand Down

0 comments on commit 5821e3d

Please sign in to comment.