Skip to content

Commit

Permalink
fix(classes): Make document state available during class's post init
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Aug 24, 2024
1 parent 317a9ec commit 71336b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ function class:_init (options)
end

function class:_post_init ()
SILE.documentState.documentClass = self
self._initialized = true
for i, func in ipairs(self.deferredInit) do
func(self)
Expand Down
3 changes: 2 additions & 1 deletion inputters/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function inputter:classInit (options)
if constructor.id then
SU.deprecated("std.object", "pl.class", "0.13.0", "0.14.0", string.format(_deprecated, constructor.id))
end
SILE.documentState.documentClass = constructor(options)
-- Note SILE.documentState.documentClass is set by the instance's own :_post_init()
constructor(options)
end

function inputter:requireClass (tree)
Expand Down

0 comments on commit 71336b9

Please sign in to comment.