Skip to content

Commit

Permalink
Rename default document class to allow override later
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jan 23, 2017
1 parent 3a150a6 commit c63a84c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions vc.lua → cabook.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
publisher = "viachristus"
local book = SILE.require("classes/book")
local plain = SILE.require("classes/plain")
local vc = book { id = "vc" }
local cabook = book { id = "cabook" }

vc:declareOption("crop", "true")
vc:declareOption("background", "true")
cabook:declareOption("crop", "true")
cabook:declareOption("background", "true")

vc.endPage = function (self)
vc:moveTocNodes()
cabook.endPage = function (self)
cabook:moveTocNodes()

if not SILE.scratch.headers.skipthispage then
SILE.settings.pushState()
SILE.settings.reset()
if vc:oddPage() then
if cabook:oddPage() then
SILE.call("output-right-running-head")
else
SILE.call("output-left-running-head")
Expand All @@ -21,17 +21,17 @@ vc.endPage = function (self)
end
SILE.scratch.headers.skipthispage = false

return plain.endPage(vc)
return plain.endPage(cabook)
end

-- VC books sometimes have sections, sometimes don't.
-- CaSILE books sometimes have sections, sometimes don't.
-- Initialize some sectioning levels to work either way
SILE.scratch.counters["sectioning"] = {
value = { 0, 0 },
display = { "ORDINAL", "STRING" }
}

-- I can't figure out how or where, but book.endPage() gets run on the last page
book.endPage = vc.endPage
book.endPage = cabook.endPage

return vc
return cabook
4 changes: 3 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ M4MACROS ?=
# List of exta YAML meta data files to splice into each book
METADATA ?=

# Set default document class
DOCUMENTCLASS ?= cabook

# Utility variables for later, http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html
, := ,
Expand Down Expand Up @@ -225,7 +227,7 @@ ONPAPERSILS = $(foreach PAPERSIZE,$(PAPERSIZES),%-$(PAPERSIZE).sil)
$(ONPAPERSILS): %-processed.md %-merged.yml %-url.png $(CASILEDIR)/template.sil | $$(wildcard $$*.lua) $$(wildcard $(PROJECT).lua) $(CASILEDIR)/layout-$$(call parse_layout,$$@).lua $(CASILEDIR)/viachristus.lua
$(PANDOC) --standalone \
--wrap=preserve \
-V documentclass="vc" \
-V documentclass="$(DOCUMENTCLASS)" \
-V metadatafile="$(word 2,$^)" \
-V versioninfo="$(call versioninfo,$*)" \
-V urlinfo="$(call urlinfo,$*)" \
Expand Down

0 comments on commit c63a84c

Please sign in to comment.