Module inputters.silm

A master file support module for re·sil·ient.

The master file document is a YAML file that describes the document structure, metadata, bibliography, book covers, title pages, endpapers, etc.

Info:

  • Copyright: (c) 2023-2025 Omikhleia / Didier Willis
  • License: MIT

Local Functions

validate (obj, schema[, context]) Naive recursive schema validation
insertPdfMetadata (content, metadata) Insert PDF metadata into SILE AST
handleDjotMetadata (metadata) Returned prepared Djot metadata
doLevel (content, entries, shiftHeadings, metaopts) Recursively process content sections
doDivisionContent (content, entry, shiftHeadings, metaopts) Process division content (frontmatter, mainmatter, backmatter)
doDivision (content, entry, shiftHeadings, metaopts) Process divisions (frontmatter, mainmatter, backmatter)
doBackCoverContent (entry, metaopts) Process back cover content (text included in the back cover)

Class inputters.silm

inputter.appropriate (round, filename, _) (Override) Whether this inputter is appropriate for the given file.
inputter:parse (doc) (Override) Parse the given document and return a SILE AST.


Local Functions

validate (obj, schema[, context])
Naive recursive schema validation

Parameters:

  • obj table Parsed YAML object
  • schema table Schema to validate against
  • context table Parent schema context for error messages (optional)

Returns:

  1. boolean Whether the object is valid as per the schema
  2. string or nil Error message if not valid
insertPdfMetadata (content, metadata)
Insert PDF metadata into SILE AST

Parameters:

  • content table SILE AST for insertion
  • metadata table Metadata (key, value) table
handleDjotMetadata (metadata)
Returned prepared Djot metadata

Parameters:

  • metadata table Metadata (key, value) table

Returns:

    table Prefixed metadata table (keys as expected by the Djot inputter)
doLevel (content, entries, shiftHeadings, metaopts)
Recursively process content sections

Parameters:

  • content table SILE AST for insertion
  • entries table Content entries to process (list of strings or tables)
  • shiftHeadings number Shift headings by this amount
  • metaopts table Metadata options
doDivisionContent (content, entry, shiftHeadings, metaopts)
Process division content (frontmatter, mainmatter, backmatter)

Parameters:

  • content table SILE AST for insertion
  • entry table Division content entry
  • shiftHeadings number Shift headings by this amount
  • metaopts table Metadata options
doDivision (content, entry, shiftHeadings, metaopts)
Process divisions (frontmatter, mainmatter, backmatter)

Parameters:

  • content table SILE AST for insertion
  • entry table Division content entry
  • shiftHeadings number Shift headings by this amount
  • metaopts table Metadata options
doBackCoverContent (entry, metaopts)
Process back cover content (text included in the back cover)

Parameters:

  • entry table or string Back cover content entry
  • metaopts table Metadata options

Returns:

    table SILE AST for insertion

Class inputters.silm

The "master file" inputter for re·sil·ient.

Extends SILE's inputters.base.

inputter.appropriate (round, filename, _)
(Override) Whether this inputter is appropriate for the given file.

Parameters:

  • round number Detection round (1 = by extension, etc.)
  • filename string Filename
  • _ string Document content (not used here)

Returns:

    boolean Whether this inputter is appropriate
inputter:parse (doc)
(Override) Parse the given document and return a SILE AST.

Parameters:

generated by LDoc 1.5.0 Last updated 2025-09-14 22:28:52