You might have heard of this project called baked styles, or baked pdf, generating pdfs for openstax books on cnx.org. It takes books in cnxml format, transform them to html, assemble the whole book into one html file, apply a recipe to collate the book, convert the math elements to svg, and finally, feed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/var/cnx/venvs/archive/bin/python | |
""" | |
This script attempts to dump a book from the server and load it into a | |
development database. | |
1. You need to download this script onto the server, e.g. staging08.cnx.org, | |
that runs archive. | |
2. Use `./dump_book.py dump_book caa57dab-41c7-455e-bd6f-f443cda5519c@19.3` to | |
dump the prealgebra book. |
-
Clone cnx-recipes with the default
master
branch:git clone https://github.com/openstax/cnx-recipes.git # which copies the repository to a new directory called cnx-recipes cd cnx-recipes # switch to the cnx-recipes directory
Or, to clone cnx-recipes with a specific branch, e.g.
cli-master
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT BAKED PDF (updated on April 25, 2019): | |
0. SETUP | |
Only prerequisite for the script baked pdf is that docker is installed. | |
This can be done by running ./script/install-docker | |
No need for ./script/setup or yarn | |
Remove any outdated images (this step is only necessary once in a while once the code is stable): |
The following are commands in neb in PRs right now. This is not how the textbook developers will create a pdf. The textbook developers will use scripts in cnx-recipes as they have been doing before. We will change the scripts to use neb under the hood.
-
Download the "Introduction to Business" book from production using
neb get
:neb get prod col25734 1.8.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
press/errors.py: | |
- Undo collection.xml change restriction | |
press/legacy_publishing/collection.py: | |
- Detect major/minor rev | |
- Undo collection.xml change restriction | |
- collxml parser | |
press/legacy_publishing/litezip.py: | |
- Undo collection.xml change restriction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keystone installed: | |
alabaster==0.7.9 | |
alembic==0.8.8 | |
amqp==1.4.9 | |
anyjson==0.3.3 | |
appdirs==1.4.0 | |
astroid==1.4.8 | |
Babel==2.3.4 | |
backports.functools-lru-cache==1.3 | |
boto==2.43.0 |
To create users in accounts using the users table in the cnx-archive database:
This assumes that you have accounts running and have created a oauth application for cnx (e.g. "OpenStax CNX").
- Download the sql file for exporting the cnx-archive users table to a csv file: