-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdir-make
More file actions
executable file
·52 lines (48 loc) · 1.19 KB
/
dir-make
File metadata and controls
executable file
·52 lines (48 loc) · 1.19 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh -e
md2html() {
grep -v '^:' "$1" |
lowdown -M css:./style.css -s -Thtml > "$2"
}
tex2html() {
base="$(echo "$1" | cut -d'.' -f1)"
make4ht -x "$1" > /dev/null
sed "s/$base.css/style.css/" "$base.html" > _
mv -f _ "$base.html"
find . -type f -name "$base*" |
grep -vE "(tex|html)" |
xargs rm
}
org2html() {
emacs --batch --eval "(require 'org)" \
"$1" --funcall org-html-export-to-html
}
case "$1" in
clean)
if ls | grep -E -q '.html$'; then
rm -v -- *.html
fi
;;
*)
if ls | grep -E -q ".tex$"; then
for a in *.tex; do
tex2html "$a"
done
fi
if ls | grep -E -q ".org$"; then
for a in *.org; do
org2html "$a"
done
fi
if ls | grep -v about.md | grep -E -q '.md'; then
for a in *.md; do
case "$a" in
about.md) ;;
*)
base=$(echo "$a" | cut -d'.' -f1)
md2html "$a" "$base.html"
;;
esac
done
fi
;;
esac