From 45156263e781e740f02a5aec14e4cb9949820124 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 29 Aug 2012 22:31:16 +0200 Subject: [PATCH] Add script to produce a PDF version of the docs --- doc/make-pdf.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 doc/make-pdf.sh diff --git a/doc/make-pdf.sh b/doc/make-pdf.sh new file mode 100755 index 000000000..aa3991b01 --- /dev/null +++ b/doc/make-pdf.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Generate PDF from composer documentation. +# dependencies: +# * pandoc +# * latex + +for file in $(find . -type f -name '*.md') +do + pandoc -o $(dirname $file)/$(basename $file .md).tex $file +done + +> book.tex +cat >> book.tex <> book.tex + +# apply only to main part of book +sed -i.bak 's/\\section{/\\chapter{/g' book.tex +sed -i.bak 's/\\subsection{/\\section{/g' book.tex +sed -i.bak 's/\\subsubsection{/\\subsection{/g' book.tex +sed -i.bak '/←/d' book.tex +sed -i.bak '/→/d' book.tex +sed -i.bak 's/\\chapter{composer.json}/\\chapter[Schema]{composer.json}/g' book.tex + +echo "\chapter{Articles}" >> book.tex +cat articles/*.tex >> book.tex +echo "\chapter{FAQs}" >> book.tex +cat faqs/*.tex >> book.tex +echo >> book.tex +echo "\end{document}" >> book.tex + +# apply to whole book +sed -i.bak 's/\\begin{verbatim}/\\vspace{1em} \\begin{lstlisting}/g' book.tex +sed -i.bak 's/\\end{verbatim}/\\end{lstlisting}/g' book.tex +rm book.tex.bak + +pdflatex book.tex +pdflatex book.tex + +rm *.tex articles/*.tex dev/*.tex faqs/*.tex +rm book.{aux,log,out,toc}