her.esy.fun/dup-for-themes.sh

29 lines
742 B
Bash
Raw Normal View History

2019-11-22 03:23:04 +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
for fic in $filelist; do
2019-11-27 16:07:25 +00:00
if echo $fic|egrep -- '-(mk|min|sci|modern).html$'>/dev/null; then
2019-11-22 03:23:04 +00:00
continue
fi
print -n -- "$fic "
2019-11-27 23:28:10 +00:00
cat $fic | perl -p -e 's#href="?/css/mk.css"?#href=/css/sci.css#' > ${fic:r}-sci.html
cat $fic | perl -p -e 's#href="?/css/mk.css"?#href=/css/min.css#' > ${fic:r}-min.html
cat $fic | perl -p -e 's#href="?/css/mk.css"?#href=/css/modern.css#' > ${fic:r}-modern.html
2019-11-22 03:23:04 +00:00
print "[OK]"
done