-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
54 lines (41 loc) · 1.2 KB
/
build.sh
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
53
54
#!/bin/bash
set -eu pipefail
setup() {
rm -rf out
mkdir out
rm -rf tinted-vim
git clone --depth=1 https://github.com/tinted-theming/tinted-vim
rm -rf schemes
git clone --depth=1 https://github.com/tinted-theming/schemes
}
main() {
setup
colorschemes=($(ls schemes/base16/ | grep yaml | sed 's/\..*$//'))
tmpfile="$0.html"
vim -es -u NORC -N \
-c 'silent! set termguicolors' \
-c 'silent! set runtimepath+=base16-vim' \
-c 'silent! syntax on' \
-c "silent! colorscheme base16-${colorschemes[0]}" \
-c 'silent! TOhtml' \
-c 'silent! wqa!' \
$0 > /dev/null 2>&1
awk "/<pre id='vimCodeElement'>/{flag=1; next} /<\/pre>/{flag=0} flag" $tmpfile > out/shell.html
for colorscheme in ${colorschemes[@]}; do
echo $colorscheme
vim -es -u NORC -N \
-c 'set termguicolors' \
-c 'set runtimepath+=tinted-vim' \
-c 'syntax on' \
-c "colorscheme base16-$colorscheme" \
-c 'TOhtml' \
-c 'wqall' \
$0 > /dev/null 2>&1
grep -Pzo '(?s)<style>.*</style>' $tmpfile \
| sed "3,14!d;s/body/pre/;s/^/#base16-$colorscheme /" \
> out/$colorscheme.css
rm -f $tmpfile
done
erb template.erb > out/index.html
}
main