Skip to content

Commit

Permalink
fix(packages): Make \script command properly initialize packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jul 15, 2022
1 parent 3d5a18c commit 9ded7e1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions classes/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 280,9 @@ end
function base:registerCommands ()

SILE.registerCommand("script", function (options, content)
if (options["src"]) then
local script, _ = require(options["src"])
if type(script) == "table" then
if type(script.declareSettings) == "function" then script.declareSettings(self) end
if type(script.registerCommands) == "function" then script.registerCommands(self) end
if type(script.init) == "function" then script.init(self, options) end
end
if options.src then
local pack, _ = require(options.src)
self:initPackage(pack)
else
local func, err = load(content[1])
if not func then SU.error(err) end
Expand Down

0 comments on commit 9ded7e1

Please sign in to comment.