Omikhleia / resilient.sile

Advanced book classes and packages for the SILE typesetting system
MIT License
21 stars 4 forks source link

Master documents #18

Closed Omikhleia closed 1 year ago

Omikhleia commented 1 year ago

(WIP draft description - Check PR #51 for the actual implementation)

Say you have a collection of individual chapters (or any other division scheme) in Djot, Markdown or even SIL, and you want to gather these into a book, with all bells and whistles.

Seasoned users experience with the SILE packages and the SIL language surely know how to write a "wrapper" document in that language, invoking all required commands and including their content files. All the low-level constructs are there to do so. There's some things however that they will end up doing all the time, repetitively: at the very least, pick up a font, set a main language, load fairly standard packages, set PDF metadata... Moreover, if your content, or most of it, was authored in Djot or Markdown[^metadata-blocks], it feels quite cumbersome to have to write such a wrapper in SIL syntax, doesn't it ?

[^metadata-blocks]: Several Markdown processors, such as the Pandoc converter and some static website generators, support metadata blocks as a special construct in Markdown files, with a varying syntax and often ad hoc conventions. We are trying, here, to be more general and consistent, regardless of the input format.

The resilient collection introduces a new type of document, a "master document" format which aims at simplifying and streamlining the process, abstracting and taking care of most of the usual needs. Master documents usually have the .silm extension and can be processed as shown below.

sile -u inputters.silm mybook.silm

The format consists in a simple description of the book properties and contents, expressed in YAML, a lightweight human-readable data-representation language.

masterfile: 0.0
metadata:
  # title, authors, subject and keywords will be used as PDF metadata.
  # title may be used in running headers (depending on the class)
  # all fields may eventually be used in the cover or other places,
  #   e.g. maybe as Djot symbol variables for templating?
  title: Les Chats d’Ulthar
  subtitle: Une "nouvelle" fantastique
  subject: Nouvelle
  keywords:
    - Cats
    - Tale
  authors: H. P. Lovecraft
  translators: Wikisource 
  publisher: Silex Éditions
  pubdate: 2023-07-14
  ISBN: 978-2-490-87500-0
  url: https://github.com/Omikhleia/resilient.sile
  copyright: © 2023, Silex Éditions pour la présente édition.
  legal: |
    Ce texte est dans le domaine public.
  # Or any other "legalese" text you want to add, beside the copyright.
font:
  # main (default) font
  # Note: if we were sure to use a resilient class, we could have used a style
  # definition, but we may want to be able to support other classes...
  family: [EB Garamond, Libertinus Serif] # string or list, in which case the other fonts are declared as font fallbacks
  size: 12pt
language: fr # main default language
sile:
  # when processing the master file with SILE...
  options:
    # These are class options, so can be overridden via the CLI
    # class: resilient.book # optional (default)
    papersize: 6in x 9in
    layout: ateliers demiluxe
    resolution: 300
  settings:
    # (optional) global settings we may want to set
    textsubsuper.fake: false
    # typesetter.italicCorrection: true
  packages:
    # (optional) list of extra packages to load if needed (e.g. not loaded by the class, etc.)
    - dropcaps
    - couyards
content:
  # Ordered list of other content files to include in markdown or djot (or sil).
  - chats_d_ulthar.dj
  - memoire.dj