-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(classes): Redo class tests with Penlight class model
- Loading branch information
Showing
2 changed files
with
17 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
local plain = SILE.require("plain", "classes") | ||
local testsidenote = plain { id = "testsidenote" } | ||
local plain = require("classes.plain") | ||
local testsidenote = pl.class(plain) | ||
testsidenote._name = "testsidenote" | ||
|
||
local gutterWidth = "3%pw" | ||
|
||
function testsidenote:init () | ||
function testsidenote:_init (options) | ||
plain._init(self, options) | ||
self:declareFrame("contentA", {left = "left(content)", right = "left(gutter)", top = "top(content)", bottom = "bottom(content)" }) | ||
self:declareFrame("sidenotes", {left = "right(gutter)", width="width(contentA) * 2 / 3", right = "right(content)", top = "top(content)", bottom = "bottom(content)", balanced = true }) | ||
self:declareFrame("gutter", {left = "right(contentA)", right = "left(sidenotes)", width = gutterWidth }) | ||
self.pageTemplate.firstContentFrame = self.pageTemplate.frames["contentA"] | ||
local insertions = SILE.require("packages/insertions") | ||
SILE.require("packages/footnotes") | ||
insertions.exports:initInsertionClass("footnote", { | ||
self:loadPackage("insertions") | ||
self:loadPackage("footnotes") | ||
self:initInsertionClass("footnote", { | ||
maxHeight = SILE.length("75%ph"):absolute(), | ||
topBox = SILE.nodefactory.zerovglue(), | ||
interInsertionSkip = SILE.length("1ex"), | ||
insertInto = { frame = "sidenotes", ratio = 0 }, | ||
stealFrom = { }, | ||
}) | ||
return plain.init(self) | ||
self:post_init() | ||
return self | ||
end | ||
|
||
return testsidenote |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
local plain = SILE.require("plain", "classes") | ||
local testtwocols = plain { id = "testtwocols" } | ||
local plain = require("classes.plain") | ||
local testtwocols = pl.class(plain) | ||
testtwocols._name = "testtwocols" | ||
|
||
local gutterWidth = "3%pw" | ||
|
||
testtwocols.defaultFrameset = {} | ||
testtwocols.firstContentFrame = "contentA" | ||
|
||
testtwocols.init = function(self) | ||
function testtwocols:_init (options) | ||
plain._init(self, options) | ||
self:declareFrame("contentA", {left = "left(content)", right = "left(gutter)", top = "5%ph", bottom = "83.3%ph", next = "contentB", balanced = true }) | ||
self:declareFrame("contentB", {left = "right(gutter)", width="width(contentA) * 2 / 3", right = "right(content)", top = "5%ph", bottom = "top(footnotes)", balanced = true }) | ||
self:declareFrame("gutter", {left = "right(contentA)", right = "left(contentB)", width = gutterWidth }) | ||
self:declareFrame("footnotes", { left="left(contentB)", right = "right(contentB)", height = "0", bottom="83.3%ph"}) | ||
self:loadPackage("footnotes", { insertInto = "footnotes", stealFrom = { contentB = 1 } } ) | ||
return plain.init(self) | ||
self:post_init() | ||
return self | ||
end | ||
|
||
return testtwocols |