Skip to content

Commit

Permalink
refactor(classes): Move SILE.baseClass to SILE.classes.base
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Sep 22, 2020
1 parent f9bdf77 commit 7cb1453
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions classes/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ return std.object {
if type(pack) == "table" then
if pack.exports then self:mapfields(pack.exports) end
if pack.init then
table.insert(SILE.baseClass.deferredInit, function () pack.init(self, args) end)
table.insert(SILE.classes.base.deferredInit, function () pack.init(self, args) end)
end
end
end,
Expand All @@ -114,7 +114,7 @@ return std.object {
SILE.outputter:init(self)
self:registerCommands()
-- Call all stored package init routines
for i = 1, #(SILE.baseClass.deferredInit) do (SILE.baseClass.deferredInit[i])() end
for i = 1, #(SILE.classes.base.deferredInit) do (SILE.classes.base.deferredInit[i])() end
SILE.typesetter:registerPageEndHook(function ()
if SU.debugging("frames") then
for _, v in pairs(SILE.frames) do SILE.outputter:debugFrame(v) end
Expand Down
2 changes: 1 addition & 1 deletion classes/plain.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local base = SILE.baseClass
local base = SILE.classes.base
local plain = base { id = "plain" }

local classopts = {}
Expand Down
4 changes: 3 additions & 1 deletion core/classes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,6 @@ SILE.registerCommand("process", function ()
SU.error("Encountered unsubstituted \\process.")
end, "Within a macro definition, processes the contents of the macro body.")

return require("classes/base")
return {
base = require("classes/base")
}
2 changes: 1 addition & 1 deletion core/sile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ SILE.units = require("core/units")
SILE.measurement = require("core/measurement")
SILE.length = require("core/length")
SILE.papersize = require("core/papersize")
SILE.baseClass = require("core/classes")
SILE.classes = require("core/classes")
SILE.nodefactory = require("core/nodefactory")
require("core/settings")
require("core/inputs-texlike")
Expand Down
6 changes: 3 additions & 3 deletions documentation/c12-tricks.sil
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ that each typesetter is linked to the appropriate frame:
diglot.init = function(self)
diglot.leftTypesetter:init(SILE.getFrame("a"))
diglot.rightTypesetter:init(SILE.getFrame("b"))
return SILE.baseClass.init(self)
return SILE.classes.base.init(self)
end
\end{verbatim}

Expand Down Expand Up @@ -291,7 +291,7 @@ discovery.init = function()
SILE.getFrame("rGutter") or SILE.getFrame("lGutter")
discovery.innerTypesetter:init(gutter)
...
return SILE.baseClass:init()
return SILE.classes.base:init()
end

discovery.newPage = function ()
Expand All @@ -301,7 +301,7 @@ discovery.newPage = function ()
SILE.getFrame("rGutter") or SILE.getFrame("lGutter")
discovery.innerTypesetter:init(gutter)
...
return SILE.baseClass.newPage(discovery);
return SILE.classes.base.newPage(discovery);
end
\line
\end{verbatim}
Expand Down
2 changes: 1 addition & 1 deletion packages/parallel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ local setupParallel = function (klass, options)
allTypesetters(function (frame, _)
calculations[frame] = { mark = 0 }
end)
SILE.baseClass:newPage()
SILE.classes.base:newPage()
SILE.call("sync")
end
allTypesetters(function (frame, _) calculations[frame] = { mark = 0 } end)
Expand Down
4 changes: 2 additions & 2 deletions packages/rules.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SILE.baseClass:loadPackage("raiselower")
SILE.baseClass:loadPackage("rebox")
SILE.classes.base:loadPackage("raiselower")
SILE.classes.base:loadPackage("rebox")

SILE.registerCommand("hrule", function (options, _)
local width = SU.cast("length", options.width)
Expand Down
2 changes: 1 addition & 1 deletion spec/complex_frame_spec.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SILE = require("core/sile")

local tClass = SILE.baseClass {}
local tClass = SILE.classes.base {}
tClass:declareFrame("a", { left = "1pt", right = "12pt", top = "1pt", bottom = "top(b)" })
tClass:declareFrame("b", { left = "1pt", right = "12pt", bottom = "12pt", height="4pt" })

Expand Down
2 changes: 1 addition & 1 deletion tests/letter.sil
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Anytown}
\begin{letter}
Hello.
\end{letter}
\end{document}
\end{document}

0 comments on commit 7cb1453

Please sign in to comment.