Created
August 29, 2012 19:42
-
-
Save igorw/3517799 to your computer and use it in GitHub Desktop.
Generate PDF from composer documentation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate PDF from composer documentation. | |
# dependencies: | |
# * pandoc | |
# * latex | |
for file in $(find . -type f -name '*.md' -depth 1) | |
do | |
pandoc -o $(basename $file .md).tex $file | |
done | |
> book.tex | |
cat >> book.tex <<EOF | |
\documentclass{book} | |
\title{Composer} | |
\author{Igor and friends} | |
\usepackage{hyperref} | |
\usepackage{url} | |
\usepackage{enumerate} | |
\usepackage{listings} | |
\usepackage{microtype} | |
\usepackage[htt]{hyphenat} | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\usepackage{textcomp} | |
\usepackage{tgpagella} | |
\lstset{breaklines=true} | |
\begin{document} | |
\setlength{\parindent}{0cm} | |
\setlength{\parskip}{0.1cm} | |
\maketitle | |
\tableofcontents | |
\setlength{\parskip}{0.4cm} | |
EOF | |
cat *.tex >> book.tex | |
echo >> book.tex | |
echo "\end{document}" >> book.tex | |
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 's/\\begin{verbatim}/\\begin{lstlisting}/g' book.tex | |
sed -i.bak 's/\\end{verbatim}/\\end{lstlisting}/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 | |
rm book.tex.bak | |
pdflatex book.tex | |
pdflatex book.tex | |
rm *.tex | |
rm book.{aux,log,out,toc} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment