bibi/make.sh

54 行
978 B
Bash
Raw 通常表示 履歴

2023-03-24 23:28:36 +09:00
#!/bin/sh
2023-09-09 09:39:26 +09:00
# usage:
# - production:
# ./make.sh
# - for local reading:
# ./make.sh -local
2024-01-02 02:27:38 +09:00
arg1=$1
2023-09-09 09:39:26 +09:00
2024-01-02 02:27:38 +09:00
# 静的ファイル
static="
src/*.css
src/*.js
src/favicon.ico
src/robots.txt
src/images
src/styles
"
make_html() {
name=`basename $1`
out=www/$name
cat include/header.html $path >> $out
# ライセンス表示
if [ $name = publicdomain.html ]; then
show_license >> $out
# 目次以外にはフッターあり
elif [ $name != index.html ]; then
cat include/footer.html >> $out
2023-03-24 23:28:36 +09:00
fi
2024-01-02 02:27:38 +09:00
# localでない場合: "./index.html" -> "./"
if [ "$arg1" != '-local' ]; then
sed -i -e's/href=".\/index.html"/href=".\/"/g' $out
fi
echo "$path -> $out"
}
show_license() {
echo '<blockquote cite="https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt"><pre>'
sed -e's/"/\&quot;/g' -e"s/'/\&#39;/g" LICENSE.txt
echo '</pre></blockquote>'
echo '<p>以上</p>'
}
2023-03-24 23:28:36 +09:00
2024-01-02 02:27:38 +09:00
mkdir -p www
rm -rf www/*
cp -rpv $static www
for path in src/*.html; do
make_html $path
done