more ideomatic makefile integration; do not build LaTeX (legacy)
This commit is contained in:
parent
e73d4ad50b
commit
f8f7cc347b
20
.drone.yml
20
.drone.yml
|
@ -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
|
||||
|
|
95
Makefile
95
Makefile
|
@ -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)
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
# presis
|
||||
# presentations
|
||||
|
||||
LaTeX content stays here for archiving reasons.
|
||||
|
|
27
compile.sh
27
compile.sh
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -13,65 +13,69 @@ 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
|
||||
if not os.path.isfile(os.path.join(directory, 'index.md')):
|
||||
print(f'{directory} is not valid: missing index.md')
|
||||
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))))
|
||||
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))))
|
||||
|
||||
config = {
|
||||
'theme': '../_assets/reveal.js/css/theme/black.css',
|
||||
'controls': True,
|
||||
'progress': True,
|
||||
'history': True,
|
||||
'center': True,
|
||||
'show_notes': False, # on print
|
||||
'width': 1280,
|
||||
'height': 800,
|
||||
'transition': 'slide', # none, fade, slide, convex, concave, zoom
|
||||
}
|
||||
content = ""
|
||||
config = {
|
||||
'theme': '../_assets/reveal.js/css/theme/black.css',
|
||||
'controls': True,
|
||||
'progress': True,
|
||||
'history': True,
|
||||
'center': True,
|
||||
'show_notes': False, # on print
|
||||
'width': 1280,
|
||||
'height': 800,
|
||||
'transition': 'slide', # none, fade, slide, convex, concave, zoom
|
||||
}
|
||||
content = ""
|
||||
|
||||
for idx, file in enumerate(files):
|
||||
with open(os.path.join(directory, file), 'r') as f:
|
||||
parts = f.read().split('---\n')
|
||||
for idx, file in enumerate(files):
|
||||
with open(os.path.join(directory, file), 'r') as f:
|
||||
parts = f.read().split('---\n')
|
||||
|
||||
if idx == 0:
|
||||
config = {**config, **yaml.load(parts[0])}
|
||||
parts = parts[1:]
|
||||
if idx == 0:
|
||||
config = {**config, **yaml.load(parts[0])}
|
||||
parts = parts[1:]
|
||||
|
||||
section_content = '<section>'
|
||||
section_content = '<section>'
|
||||
|
||||
for slide in parts:
|
||||
for r in template_replace:
|
||||
slide = slide.replace(r[0], r[1])
|
||||
for slide in parts:
|
||||
for r in template_replace:
|
||||
slide = slide.replace(r[0], r[1])
|
||||
|
||||
# parse config
|
||||
slide_config = slide.split('\n')[0]
|
||||
slide = '\n'.join(slide.split('\n')[1:])
|
||||
if slide_config != '':
|
||||
slide_config = re.split(' (?=(?:[^"]|"[^"]*")*$)', slide_config)
|
||||
slide_config = list(map(lambda x: x if re.match('^style=.*', x) else f'data-{x}', slide_config)) # data-
|
||||
slide_config = ' ' + ' '.join(slide_config)
|
||||
# parse config
|
||||
slide_config = slide.split('\n')[0]
|
||||
slide = '\n'.join(slide.split('\n')[1:])
|
||||
if slide_config != '':
|
||||
slide_config = re.split(' (?=(?:[^"]|"[^"]*")*$)', slide_config)
|
||||
slide_config = list(map(lambda x: x if re.match('^style=.*', x) else f'data-{x}', slide_config)) # data-
|
||||
slide_config = ' ' + ' '.join(slide_config)
|
||||
|
||||
slide_content = f'<section{slide_config}>'
|
||||
slide_content += commonmark(slide)
|
||||
slide_content += '</section>'
|
||||
slide_content = f'<section{slide_config}>'
|
||||
slide_content += commonmark(slide)
|
||||
slide_content += '</section>'
|
||||
|
||||
if slide_content != '<section></section>':
|
||||
section_content += slide_content
|
||||
if slide_content != '<section></section>':
|
||||
section_content += slide_content
|
||||
|
||||
section_content += '</section>'
|
||||
section_content += '</section>'
|
||||
|
||||
if section_content != '<section></section>':
|
||||
content += section_content
|
||||
if section_content != '<section></section>':
|
||||
content += section_content
|
||||
|
||||
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}')
|
||||
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'done')
|
||||
|
|
Reference in a new issue