2019-11-27 18:06:42 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i zsh
|
|
|
|
#!nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/19.09.tar.gz"
|
|
|
|
|
|
|
|
webdir="_site"
|
|
|
|
|
|
|
|
debug () {
|
|
|
|
print -- $* >/dev/null
|
|
|
|
}
|
|
|
|
|
|
|
|
type -a filelist
|
|
|
|
setopt extendedglob
|
|
|
|
if (($#>0)); then
|
|
|
|
filelist=( $* )
|
|
|
|
else
|
|
|
|
filelist=( $webdir/**/*.html(.) )
|
|
|
|
fi
|
|
|
|
|
|
|
|
tmp=$(mktemp)
|
|
|
|
|
|
|
|
for fic in $filelist; do
|
|
|
|
if echo $fic|egrep -- '-(mk|min|sci|modern).html$'>/dev/null; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
print -n -- "$fic "
|
2019-12-05 13:55:51 +00:00
|
|
|
cp $fic $tmp
|
2019-12-06 23:58:57 +00:00
|
|
|
perl -pi -e 's#<div id="outline-container-[^"]*"([^>]*)>#<div$1>#g;s# id="org[a-f0-9]{7}"##g' $tmp
|
2019-12-05 13:55:51 +00:00
|
|
|
minify --mime text/html $tmp > $fic
|
2019-11-27 18:06:42 +00:00
|
|
|
print "[OK]"
|
|
|
|
done
|