snootgame.xyz/make-site.sh

25 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
tomlq -r '.languages|keys_unsorted[]' definition.toml | while IFS= read -r lang;
do
mkdir public/"$lang"/
cp -vr static/* public/"$lang"/
cp -v template/index.html public/"$lang"/
cp -v template/download.html public/"$lang"/
cp -v template/characters.html public/"$lang"/
sed -i -e "s/;LANG;/$lang/g" public/"$lang"/*.html
sed -i -e "s/;VERSION;/$(tomlq -r '.VERSION' definition.toml)/g" public/"$lang"/*.html
sed -i -e "s/;EMAIL;/$(tomlq -r '.EMAIL' definition.toml)/g" public/"$lang"/*.html
tomlq -r '.languages.en|keys_unsorted[]' definition.toml | while IFS= read -r replacable;
do
replacingtext=$(tomlq -r ".languages.$lang.$replacable|@html" definition.toml)
replacementorder="s/;$replacable;/$replacingtext/g"
echo "replacing ;$replacable; with $replacingtext"
#echo sed -i -e $replacementorder public/"$lang"/index.html
sed -i -e "$replacementorder" public/"$lang"/index.html
sed -i -e "$replacementorder" public/"$lang"/download.html
sed -i -e "$replacementorder" public/"$lang"/characters.html
done
done