Broadly speaking, there are 2 parts to generate pdfs:
-
cnxml -> single html
- module cnxml files -> module html files
- module html files -> epub -> one single html file
-
single html -> pdf
- single html -> cnx-recipes baked html
- cnx-recipes baked html -> baked html with svg / html math
- baked html with svg / html math -> pdf
We have a trigger called add_module_file
for when a file is added to the
database (a new entry in the module_files table):
This calls cnxarchive.database.add_module_file
:
The part we care about is transforming index.cnxml
to index.cnxml.html
, the
functions are cnxdb.triggers.transforms.converters.cnxml_to_full_html
:
and cnxdb.triggers.transforms.resolvers.CnxmlToHtmlReferenceResolver
(may not
be necessary):
cnxml_to_full_html
uses rhaptos.cnxmlutils to change CNXML to HTML by XSLT.
The single HTML script is in cnx-epub
:
This script takes an epub as input and outputs a single HTML file.
We need to create an epub from the module HTML files and COLLXML file (which
has the book structure) using the models in cnxepub
:
and create an epub with cnxepub.adapters.make_epub
:
Everything is already in place, Kevin and I have been working on getting the repos on docker so it is easier to install locally.
https://github.com/kevinburleigh75/docker-expers
and
https://github.com/karenc/docker-expers/tree/karen
We still need a script to control the different containers to get a PDF out.