Module typesetters.mixins.liners

Liner support mixin for the typesetter.

Some code in this file comes from SILE's core typesetter.

License: MIT. Copyright (c) The SILE Organization / Simon Cozens et al.

This file is part of re·sil·ient, a set of extensions to SILE.

License: MIT. Copyright (c) 2025 Omikhkeia / Didier Willis

Pre-requisites:

  • The typesetter has a state.liners table, initially empty, used as a stack.

Class typesetter

typesetter:_repeatEnterLiners (slice) Repeat any unclosed liner at the start of the current line.
typesetter:_reboxLiners (slice) Rebox liners in a line slice.
typesetter:_processIfLiner (node) Check if a node is a liner, and process it if so, in a stack.
typesetter:_repeatLeaveLiners (slice, insertIndex) Repeat any unclosed liner at some index in the current line slice.
typesetter:liner (name, content, outputYourself) Build a liner around some content.


Class typesetter

typesetter:_repeatEnterLiners (slice)
Repeat any unclosed liner at the start of the current line. Any unclosed liner is reopened on the current line, so we clone and repeat it. An assumption is that the inserts are done after the current slice content, supposed to be just before meaningful (visible) content.

Parameters:

  • slice table Flat nodes from current line

Returns:

    boolean Whether a liner was reopened
typesetter:_reboxLiners (slice)
Rebox liners in a line slice. All pairs of liners are rebuilt as hboxes wrapping their content. Migrating content, however, must be kept outside the hboxes at top slice level.

Parameters:

  • slice table Flat nodes from current line

Returns:

    table New reboxed slice
typesetter:_processIfLiner (node)
Check if a node is a liner, and process it if so, in a stack.

Parameters:

  • node SILE.types.node.xxx Current node (of any type)

Returns:

    boolean Whether a liner was opened
typesetter:_repeatLeaveLiners (slice, insertIndex)
Repeat any unclosed liner at some index in the current line slice.

Parameters:

  • slice table Flat nodes from current line
  • insertIndex integer Index where to insert the leave liners
typesetter:liner (name, content, outputYourself)
Build a liner around some content. This is the user-facing method for creating such liners in packages. The content may be line-broken, and each bit on each line will be wrapped into a box. These boxes will be formatted according to some output logic. The output method has the same signature as the outputYourself method of a box, and is responsible for outputting the liner inner content with its outputContent() method, possibly surrounded by some additional effects. If we are already in horizontal-restricted mode, the liner is processed immediately, since line breaking won't occur then.

Parameters:

  • name string Name of the liner (useful for debugging)
  • content table SILE AST to process
  • outputYourself function Output method for wrapped boxes
generated by LDoc 1.5.0 Last updated 2025-09-14 22:28:52