Created
August 23, 2018 08:50
-
-
Save davidkelley/867e89f6b622717b1e295cd984e56808 to your computer and use it in GitHub Desktop.
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
# remove make output directory | |
rm -rf out && mkdir -p out | |
render_diagrams() { | |
for filename in $1; do | |
if [ -f $filename ]; then | |
name=${filename%%.*} | |
type=${filename##*.} | |
diagrams $type $filename $name.svg | |
svg2png $name.svg --output $name.png --width 1024 --height 768 | |
rm $name.svg | |
echo "Rendered: '$filename'" | |
fi | |
done | |
} | |
render_sequence_diagrams() { | |
for filename in $1; do | |
if [ -f $filename ]; then | |
name=${filename%%.*} | |
npx websequencediagrams -o $name.png -f png -s napkin $filename | |
echo "Rendered: '$filename'" | |
fi | |
done | |
} | |
render_diagrams "diagrams/*.dot" | |
render_diagrams "diagrams/*.flowchart" | |
render_diagrams "diagrams/*.railroad" | |
render_sequence_diagrams "diagrams/*.sequence" | |
sleep 5 | |
latex -output-directory=$OUTPUT_DIR -interaction=nonstopmode -output-format=pdf doc.tex | |
mv diagrams/*.png out/ |
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
\documentclass{article} | |
\usepackage{graphicx} | |
\usepackage{import} | |
\graphicspath{ {./diagrams/} } | |
\begin{document} | |
\title{Example} | |
\author{David Kelley} | |
\maketitle | |
\begin{abstract} | |
An example abstract | |
\end{abstract} | |
\newpage | |
\import{./sections/}{introduction.tex} | |
\import{./sections/}{why.tex} | |
\import{./sections/}{user.tex} | |
\includegraphics[width=\textwidth]{user_registration} | |
\includegraphics[width=\textwidth]{test} | |
\import{./sections/}{footer.tex} | |
\end{document} |
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
version: '3' | |
services: | |
builder: | |
build: | |
context: . | |
args: | |
LATEX_VERSION: latest | |
volumes: | |
- ".:/docs:rw" |
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
ARG LATEX_VERSION=latest | |
FROM tianon/latex:$LATEX_VERSION | |
USER root | |
RUN apt-get update && apt-get install -y build-essential curl gnupg && \ | |
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \ | |
apt-get install -y nodejs && \ | |
npm install -g diagrams svg2png --unsafe-perm=true | |
VOLUME /docs | |
WORKDIR /docs | |
ENV OUTPUT_DIR=./out/ | |
ENTRYPOINT ./build.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment