commit c85d220ed80b3b35c5f64af98cfbc56c038e06aa
parent 654c586bc7eaad78a17fbef50a5f40ca3f569a58
Author: parazyd <parazyd@dyne.org>
Date: Fri, 1 Jul 2016 19:05:02 +0200
support markdown titles; fast clean
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mars.sh b/mars.sh
@@ -62,7 +62,7 @@ generate() {
}
clean() {
- countdown "cleaning" && \
+ [[ "$1" == "-f" ]] || { countdown "cleaning" }
for dir in $tree; do
print "${fg[blue]} -- /$dir --${reset_color}"
pushd $dir && pages=($(ls *.$pageformat)) && {
@@ -90,10 +90,10 @@ process-page() {
cat $i >> $name.html
done }
- local pagetitle=`grep '^##+ ' $page | cut -c 5- -`
+ local pagetitle=`grep '^##+TITLE ' $page | cut -c 10- -`
sed -i -e 's/DEFAULT_TITLE/'$pagetitle'/' $name.html
tmpage=`mktemp` && cp $page $tmpage
- sed -i -e 's/##+ .*//' $tmpage
+ sed -i -e 's/##+TITLE .*//' $tmpage
python -m markdown $tmpage >> $name.html \
&& print "$(msgokay) $name.$pageformat -> $name.html" \
@@ -120,6 +120,7 @@ skip-page() {
push() {
countdown "rsyncing" && \
rsync -P -e 'ssh' -avul --delete --stats \
+ #-n \
--size-only \
--exclude-from 'rsync-exclude' \
. $WEBHOST:$WEBROOT
@@ -127,7 +128,7 @@ push() {
case "$1" in
generate) generate;;
- clean) clean;;
+ clean) clean "$2";;
push) push;;
*) print "usage: `basename $0` {generate|clean|push}";;
esac