skiqqy.xyz/build.sh

36 lines
724 B
Bash
Raw Normal View History

2020-10-23 23:08:10 +00:00
#!/bin/bash
# Auther: Skiqqy
HOST="https://github.com/"
conv () {
# Take a file and convert it to html by making substitutes.
# ^/name -> https://github.com/name
# */name.domain -> https://name.domain
2020-10-25 17:03:21 +00:00
# !/name.domain -> http://name.domain
2020-10-23 23:08:10 +00:00
sed -E "s|(\\^/)([^ \)]*)|^\/<a href=$HOST/\2>\2</a>|g" |
sed -E "s|(\\*/)([^ \)]*)|*\/<a href=https:\/\/\2/>\2</a>|g" |
2020-10-25 17:04:41 +00:00
sed -E "s|(\\!/)([^ \)]*)|!\/<a href=http:\/\/\2/>\2</a>|g" |
2020-10-23 23:08:10 +00:00
sed -E '/%%BODY%%/r /dev/stdin' raw/template.html |
sed -E '/%%BODY%%/d'
}
2020-10-23 23:10:05 +00:00
mkdir -p site
2020-10-23 23:08:10 +00:00
for file in raw/*.txt
do
case $file in
*index.txt)
path=index.html
;;
*)
path=${file/raw/site}
path=${path/txt/html}
;;
esac
echo "Building $file"
conv < "$file" > $path
done