-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (29 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
all: gemtext images gallery
gallery: gemtext
@echo "Making Gallery"
@grep -E -h '^!\[' Posts/*.md > output/gallery.md
@printf '# Image Gallery\n\n' > output/gallery.gmi
@perl -pe 's/!\[(.+)?\s\\\[\d+\\]\]\(([^\)]+)\)/=> $$2 $$1/' output/gallery.md >> output/gallery.gmi
# catch and convert the few images that don't have a footnote in the description
@perl -i -pe 's/!\[(.+)?(?:\s\\\[\d+\\])?\]\(([^\)]+)\)/=> $$2 $$1/' output/gallery.gmi
#remove footnotes from output
@perl -i -pe 's/\s\[\d+\]\s//' output/gallery.gmi
@rm -f output/gallery.md
gemtext: images
@echo "Converting to Gemtext"
@md2gemini --write --dir output/ --frontmatter --img-tag='' --links images-only output/*.md
@rm output/*.md
# md2gemini annoyingly adds CRLF, regardless of platform
@dos2unix -q output/*.gmi
# generate index and add navigation links to the bottom of the posts
@dotnet run --project ../ContentIndexer/ output/ "Apple II History"
images: output
@echo "Optimizing images"
@mogrify -strip -quality 80 -resize 800x800\> output/images/*
output: clean
@echo "Creating 'output/'"
@mkdir output
@cp -R Posts/* output/.
clean:
@echo "Cleaning"
@rm -rf output