cleaned up make script a ton
This commit is contained in:
parent
ffe219765f
commit
9a7de5e192
26
make.sh
26
make.sh
@ -4,24 +4,21 @@ targetDir='post/'
|
||||
source .creds
|
||||
url="https://$user:$pass@neocities.org/api/upload"
|
||||
|
||||
# auto tools should be able to fix this
|
||||
post() {
|
||||
tmp=".swap"
|
||||
full=".fullswap"
|
||||
base=$(basename $1)
|
||||
base=`basename $1`
|
||||
# First build the content of the site
|
||||
pandoc $1 | sed '3i </div>' >> $tmp
|
||||
sed -i '1i <div class="header">' $tmp
|
||||
# next we glue together the header and footer
|
||||
cat ./templates/post-header.html $tmp ./templates/post-footer.html > $full
|
||||
rm -f $tmp
|
||||
pandoc $1 > $tmp
|
||||
# Title, images and tables get added/fixed here
|
||||
sed -i "5i <title>${base%.*}</title>" $full
|
||||
sed -i "s/<img/<img class=\"pure-img\"/g" $full
|
||||
sed -i 's/<table>/<table class="pure-table">/g' $full
|
||||
sed "s/{TITLE}/<title>${base%.*}<\/title>/g" ./templates/post-header.html > $full
|
||||
cat $tmp ./templates/post-footer.html >> $full
|
||||
sed -i 's/<img/<img class="pure-img"/g;s/<table>/<table class="pure-table">/g' $full
|
||||
|
||||
# finally move this post to its proper location in the _rootDir
|
||||
# Move things to proper directory and cleanup
|
||||
mv $full "$rootDir/$targetDir/${base%.*}.html"
|
||||
rm -f $full
|
||||
rm -f $tmp
|
||||
}
|
||||
|
||||
upload() {
|
||||
@ -39,6 +36,11 @@ _help() {
|
||||
}
|
||||
mkdir -p "$rootDir/post"
|
||||
|
||||
if [ -z $1 ]
|
||||
then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while getopts ":srhup:" opt;do
|
||||
case "$opt" in
|
||||
s)
|
||||
@ -61,7 +63,7 @@ while getopts ":srhup:" opt;do
|
||||
done
|
||||
;;
|
||||
u)
|
||||
upload;;
|
||||
upload;; # this needs a proper fix according to api
|
||||
h)
|
||||
_help;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user