After nearly burning myself out to finish 10k words before the end of the month, I decided to switch back over to working on my publishing business and getting ready to release my own books but also the next book I'm publishing.
With some recent realizations, I found out my current incarnation of generating EPUB, MOBI, and PDF files was fragile. In specific, it required my laptop to be set up properly. If I lost it—not an unreasonable suggestion given that it has a hernia and a cracked shell—then I would be significantly impacted.
To fix that, I decided to rewrite the system (again) using TypeScript and NodeJS. This time, the packages are pushed up to shared servers which means others can contribute (yeah, right) but I also can rebuild the entire environment without having my specific machine.
This also means that I can set up my GitLab installation to automatically build the EPUB, MOBI, and PDF files whenever I check files in. This also means the authors who have access to their own books can also make small corrections and see the results. In the end, it should reduce the work it takes for me to publish which helps more than just myself.
To simplify the logic, I'm building everything with HTML (EPUB's native format and MOBI's second language). However, there is not a good XeLaTeX conversion from HTML so I decided to try out wkhtmltopdf which I use for BTP's monthly statements. That worked out pretty well… up to the point I found out I couldn't do inner and outer margins.
Those are kind of important for books.
When one thing creates a block, try a different one. After a while, I found a nice library called WeasyPrint. This handled inner and outer margins but… it couldn't handle recto chapter pages (chapters opening on the right side) nor could it handle chapter-specific leading pages (no headers).
So I have two ways of getting past this. I figured I could either hack the code by assembling the book and doing a bit of magic with the WeasyPrint code or do the "right" thing and teach that system how to handle recto and page numbers. I don't know which one is "easier" but I'm pretty sure there is a good chance I won't have time, but I'm willing to attempt it.
I can always go back to XeLaTeX, I know how to convert that relatively quickly.
Which… leads me to my 974 Problem. I wanted to do a quick blog post about the stuff above. However, I didn't want to spent twenty minutes looking for an image to tag the post. My alternative was to create a "generic" image for posts that I didn't find an image. My novel posts will still probably have appropriate images.
Instead of spending twenty minutes for an image, I spent two days writing a generic system including properly documented and tested library to integrate into my build system. Because ten hours verses twenty minutes is somehow better when I get lost in the forest.