Automation
Transforming the source files into the desired output (PDF and EPUB) is one of the key components of the Model-View-Controller approach of working with Git. These are programs that take the source, make it pretty, and generate the output.
Probably the best, first approach to transformations is a program called Pandoc. Over the years, I feel I have gone beyond that program do and wrote my own program, MfGames Writing. There are many others out there and I hope to document them, but originally I'm going to focus on the two main ones.
- Pandoc
- MfGames Writing
While I give typed commands for doing various things, it can be difficult to remember every single option. Nor should anyone have to recall such trivia. Instead, writing scripts or tools that do all the work makes a life a lot easier.
For example, say to build the files using MfGames Writing are:
mfgames-writing build pdf
mfgames-writing build epub
mfgames-writing build docx
With Just, I can create a file in //Justfile
with this content:
_default:
just --choose
build: build-epub build-pdf build-docx
build-epub:
mfgames-writing build epub
build-pdf:
mfgames-writing build pdf
build-docx:
mfgames-writing build docx
While this is more complicated, it is a one-time setup just so I can run the following command:
just build
If I only want the PDF? I just have to type: just build-pdf
.