After writing gobs of documents over the past year with AsciiDoc, I was strongly motivated to make that work as I embark on writing Learning Spring Boot.
Writing a book with a word processor is one thing if you’re talking about a trade novel. That format is nothing but words, words, and more words. But for a technical book, we have a different medium. There are words, code listings, inline code fragments, console outputs, screen shots and more. This is more like a reference manual or blog posting that is targeted for print. And that is something AsciiDoc was made for.
I googled around and found a nifty backend that let you output from AsciiDoc straight into ODT. The gulf I needed to bridge was incorporating Packt’s styles. Packt has a template document that has all their styles. Thankfully they support OpenOffice. I was able to open their stylesheet and save it a Flat ODT (i.e. flat XML document). Then I wrote a Spring Boot CLI script to extract all of their styles (but not the sample text) and dump them into an AsiiiDoc format file. With some tweaks to packt.conf, I managed to crank out a nicely formatted OpenOffice doc from my raw manuscript!
Click on the images on this blog post, and you can see the original AsciiDoc as well the auto-generated LibreOffice document. (Note how the ODT document is in the middle of a bullet point listing, and the type in the top left corner reads Bullet [PACKT].)
If you’re interested, you can experiment with it as well! Just visit https://github.com/gregturn/asciidoc-packt. If you have tips on how to improve this, feel free to submit pull requests.
NOTE: This is at the bottom of my list of things to manage, so unless your patch is super simple or solves an immediate problem I’m having, don’t assume instant response.
Very nice. This sure beats the workflow I used when I wrote a book for Packt (http://www.packtpub.com/gnuplot-visual-guide-with-plotting-software-cookbook/book), which mostly involved writing in Vim and copy-pasting into LibreOffice, then doing global search-and-replace to transform my ad-hoc tags into Packt styles, plus a lot of cursing.
Hey Greg, another Greg here, one of the editors at Packt. This looks awesome – I’m always looking for ways to make life easier for our authors, so I might well take a look at this 🙂