more ideomatic makefile integration; do not build LaTeX (legacy)

This commit is contained in:
Simon Bruder 2018-08-30 12:48:18 +00:00
parent e73d4ad50b
commit f8f7cc347b
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
6 changed files with 66 additions and 180 deletions

View file

@ -1,18 +1,4 @@
pipeline:
misc:
group: prepare
image: alpine
commands:
- apk add --no-cache make wget
- make fonts
inkscape:
group: prepare
image: jess/inkscape
commands:
- apt-get update && apt-get -y install make
- ./compile.sh inkscape
libreoffice:
group: build
image: jess/libreoffice
@ -28,12 +14,6 @@ pipeline:
- pip install -r requirements.txt
- ./compile.sh revealjs
latex:
group: build
image: tianon/latex
commands:
- ./compile.sh latex
publish:
group: publish
image: sbruder/drone-netlify

View file

@ -1,99 +1,12 @@
.PHONY: clean fonts revealjs
.PHONY: clean
clean:
find latex \
-type f \
\( \
-iname "*.aux" \
-o -iname "*.nav" \
-o -iname "*.out" \
-o -iname "*.toc" \
-o -iname "*.snm" \
-o -iname "*.log" \
-o -iname "*.eps" \
\) \
-delete
find latex revealjs -iname "*.pdf" -type f -delete
rm -rf latex/fonts revealjs/node_modules
rm -f revealjs/*/index.html revealjs/*/index.pdf */*/handout.pdf
latex/fonts:
mkdir $@
fonts: latex/fonts
wget -P latex/fonts -c -q \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Black.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-BlackItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Bold.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-BoldItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Light.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-LightItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Medium.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-MediumItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Regular.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-RegularItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-Thin.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto/Roboto-ThinItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto-slab/Roboto-Slab-Bold.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto-slab/Roboto-Slab-Light.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto-slab/Roboto-Slab-Regular.ttf \
https://cdn.jsdelivr.net/npm/roboto-fontface/fonts/roboto-slab/Roboto-Slab-Thin.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Bold.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-BoldItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Italic.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Light.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-LightItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Medium.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-MediumItalic.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Regular.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-Thin.ttf \
https://cdn.jsdelivr.net/npm/roboto-mono-webfont/fonts/RobotoMono-ThinItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraMono-Bold.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraMono-Medium.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraMono-Regular.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Bold.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-BoldItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Book.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-BookItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Eight.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-EightItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-ExtraBold.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-ExtraBoldItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-ExtraLight.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-ExtraLightItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Four.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-FourItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Hair.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-HairItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Heavy.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-HeavyItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Light.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Italic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-LightItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Medium.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-MediumItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Regular.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-SemiBold.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-SemiBoldItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Thin.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-ThinItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Two.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-TwoItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-Ultra.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-UltraItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-UltraLightItalic.ttf \
https://cdn.jsdelivr.net/npm/mozilla-fira-pack/Fira/ttf/FiraSans-UltraLight.ttf
revealjs:
(cd revealjs && python3 build.py)
revealjs/%/index.html: revealjs/%/*.md
python3 revealjs/build.py $@
revealjs/%/index.pdf: revealjs/%/index.html
decktape --no-sandbox -s 1920x1200 $< $@
latex/%/index.pdf: latex/%/index.tex
(cd $(@D) && latexmk -lualatex index.tex)
%.pdf: %.svg
inkscape -D -z --file="$<" --export-pdf="$@"
%/handout.pdf: %/handout.odt
libreoffice --headless --convert-to pdf "$<" --outdir $(@D)

View file

@ -1,2 +1,3 @@
# presis
# presentations
LaTeX content stays here for archiving reasons.

View file

@ -2,33 +2,22 @@
set -e
case "$1" in
"inkscape")
for presi in latex/*;do
for file in $presi/*.svg;do
[ -e "$file" ] && make "${file%.svg}".pdf || true
done
done
;;
"latex")
for presi in latex/*;do
[ -e "$presi/index.tex" ] && make "$presi/index.pdf" || true
done
;;
"libreoffice")
for presi in latex/* revealjs/*;do
[ -e "$presi/handout.odt" ] && make "$presi/handout.pdf" || true
for presi in revealjs/*/handout.odt; do
make "$(dirname $presi)/handout.pdf"
done
;;
"revealjs")
make revealjs
for presi in revealjs/*/index.md; do
make "$(dirname $presi)/index.html"
done
;;
"decktape")
for presi in revealjs/*;do
[ -e "$presi/index.html" ] && make "$presi/index.pdf" || true
for presi in revealjs/*/index.html; do
make "$(dirname $presi)/index.pdf"
done
;;
*)
echo "USAGE: $0 [MODE]"
echo "modes: inkscape latex libreoffice revealjs"
echo "unknown mode"
;;
esac

View file

@ -10,7 +10,6 @@
<body>
<h1>Präsentationen</h1>
<table>
<tr><td></td><td><a href="latex/brom/index.pdf">Element: Brom (Br)</a></td></tr>
<tr><td></td><td><a href="revealjs/snowden/">Snowden</a></td></tr>
<tr><td></td><td><a href="revealjs/snowden/handout.pdf">Snowden (handout)</a></td></tr>
<tr><td></td><td><a href="revealjs/alternative_energy/">Alternative Energie</a></td></tr>

View file

@ -13,14 +13,18 @@ template_replace = [
('</notes>', '\n</aside>'),
]
template_env = Environment(loader=FileSystemLoader('_templates'))
try:
directory = os.path.dirname(sys.argv[1])
print(f'Processing {directory}')
except IndexError:
print(f'USAGE: {sys.argv[0]} path/to/index.html', file=sys.stderr)
sys.exit(1)
directories = filter(lambda x: os.path.isdir(x) and not re.match('^_', x), os.listdir('.'))
template_env = Environment(loader=FileSystemLoader(os.path.join(directory, '../_templates')))
for directory in directories:
if not os.path.isfile(os.path.join(directory, 'index.md')):
print(f'{directory} is not valid: missing index.md')
continue
sys.exit(1)
files = ['index.md']
files.extend(sorted(filter(lambda x: os.path.isfile(os.path.join(directory, x)) and re.match('.*\.md$', x) and x != 'index.md', os.listdir(directory))))
@ -74,4 +78,4 @@ for directory in directories:
with open(os.path.join(directory, 'index.html'), 'w') as f:
f.write(template_env.get_template('index.html.j2').render(config, content=content))
print(f'Processed {directory}')
print(f'done')