chore: added a simple script to create the ebook

This commit is contained in:
Dave Kerr
2020-06-10 13:48:09 +08:00
parent 9eb0294610
commit f51990e911
2 changed files with 37 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
---
title: "Hacker Laws"
author: "Dave Kerr, github.com/dwmkerr/hacker-laws"
subtitle: "Laws, Theories, Principles and Patterns that developers will find useful."
---
# 💻📖 hacker-laws
Laws, Theories, Principles and Patterns that developers will find useful.

31
assets/ebook.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Requirements:
# - pandoc
# - xelatex
# brew install
# brew cask install basictex
# First, we need to make a copy of the README, which we will modify slighty.
cp README.md hacker-laws.md
# Remove the title - we have it in the front-matter of the doc, so it will
# automatically be added to the PDF.
sed -i '' '/💻📖.*/d' hacker-laws.md
# We can't have emojis in the final content with the PDF generator we're using.
sed -i '' 's/❗/Warning/' hacker-laws.md
# Now rip out the translations line.
sed -i '' '/^\[Translations.*/d' hacker-laws.md
# # Now rip out any table of contents items.
sed -i '' '/\*.*/d' hacker-laws.md
sed -i '' '/ \*.*/d' hacker-laws.md
# Delete everything from 'Translations' onwards (we don't need the translations
# lists, related projects, etc).
sed -i ' ' '/## Translations/,$d' hacker-laws.md
# Now build the e-book as a PDF.
pandoc -V toc-title:"Table Of Contents" --toc --pdf-engine=pdflatex -s -o hacker-laws.pdf hacker-laws.md