Module resilient.adapters.frameset
Lightweight frameset parser/solver.
Aimed at resolving a master frameset so as to render it graphically, etc.
The logic is mostly taken from SILE's core frame.
MIT licensed (c) Simon Cozens / The SILE Organization.
But the frames and frameParser in that implementation rely on several side effects and global variables. I extracted and refactored the minimal code for solving frame specifications independently, so as to be able to resolve a full master layout and draw it.
Info:
- Copyright: (c) 2023-2025 Omikhkeia / Didier Willis
- License: MIT
Class frameAdapter
frameAdapter:_init (spec, frameParser) | (Constructor) Create a new frameAdapter instance. |
frameAdapter:constrain (method, dimension) | Constrain a dimension of the frame. |
frameAdapter:reifyConstraint (solver, method, stay) | Reify a constraint into the solver. |
frameAdapter:addWidthHeightDefinitions (solver) | Add width and height definitions to the solver. |
Class framesetAdapter
framesetAdapter:_init (frames) | (Constructor) Create a new framesetAdapter instance. |
framesetAdapter:initFrameParser () | Initialize the frame parser. |
framesetAdapter:solve () | Solve the frameset. |
Class frameAdapter
Adapted from SILE core.frame
.
Lightweight re-implementation of a frame.
- frameAdapter:_init (spec, frameParser)
-
(Constructor) Create a new frameAdapter instance.
Parameters:
- spec table Frame specification
- frameParser Frame parser instance
- frameAdapter:constrain (method, dimension)
-
Constrain a dimension of the frame.
Parameters:
- frameAdapter:reifyConstraint (solver, method, stay)
-
Reify a constraint into the solver.
Parameters:
- solver cassowary.SimplexSolver Cassowary solver instance
- method string The dimension to reify
- stay boolean Whether to add a "stay" constraint
- frameAdapter:addWidthHeightDefinitions (solver)
-
Add width and height definitions to the solver.
Parameters:
- solver cassowary.SimplexSolver Cassowary solver instance
Class framesetAdapter
It provides methodes for parsing and solving a frameset specification.
Adapted from SILE core.frameparser
.
Lightweight re-implementation of a "master" frameset.
- framesetAdapter:_init (frames)
-
(Constructor) Create a new framesetAdapter instance.
Parameters:
- frames table Frameset specification
- framesetAdapter:initFrameParser ()
- Initialize the frame parser.
- framesetAdapter:solve ()
-
Solve the frameset.
Adapted from the constrain solver in
SILE core.frame
.Returns:
-
table
Table of resolved frames