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:
- boolean Whether the object is valid as per the schema
- string or nil Error message if not valid
- insertPdfMetadata (content, metadata)
-
Insert PDF metadata into SILE AST
Parameters:
- 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:
- doDivisionContent (content, entry, shiftHeadings, metaopts)
-
Process division content (frontmatter, mainmatter, backmatter)
Parameters:
- doDivision (content, entry, shiftHeadings, metaopts)
-
Process divisions (frontmatter, mainmatter, backmatter)
Parameters:
- doBackCoverContent (entry, metaopts)
-
Process back cover content (text included in the back cover)
Parameters:
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:
- doc string Document content