mars

superminimal static website framework
git clone git://parazyd.org/mars.git
Log | Files | Refs | README | LICENSE

commit 833a986f31fe7408d6b68bc4a05ac3b551dde87c
parent 7a02b971da1299d95fe6c6b50b8cc1e14e9f2d7a
Author: parazyd <parazyd@dyne.org>
Date:   Fri,  1 Jul 2016 09:22:59 +0200

add countdown to allow clean abort; add md includes

Diffstat:
Mmars.sh | 29++++++++++++++++++++++++++---
Mwebtree | 2+-
2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/mars.sh b/mars.sh @@ -44,7 +44,15 @@ process-page() { ;; md) - python -m markdown $page > $name.html \ + # here we try to check for includes (lazy) + local includes=`awk '/^##+/ {print $2}'` + [[ -n $includes ]] && { + for file in $includes; do + python -m markdown $file > $name.html + done + } + + python -m markdown $page >> $name.html \ && print "[ ${fg[green]}OK${reset_color} ] $name.$pageformat -> $name.html" \ || print "[${fg[red]}NOPE${reset_color}] $name.$pageformat -> $name.html" ;; @@ -75,14 +83,29 @@ clean() { } push() { - print "${fg[green]}(*) rsyncing website...${reset_color}" - + countdown rsyncing rsync -P -e 'ssh' -avul --delete --stats \ --size-only \ --exclude-from 'rsync-exclude' \ . $WEBHOST:$WEBROOT } +countdown() { + watdo="$*" + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} 5 4 3 2 1... ${reset_color}(hit ^C to abort)" && sleep 1 && \ + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} 4 3 2 1... ${reset_color}(hit ^C to abort)" && sleep 1 && \ + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} 3 2 1... ${reset_color}(hit ^C to abort)" && sleep 1 && \ + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} 2 1... ${reset_color}(hit ^C to abort)" && sleep 1 && \ + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} 1... ${reset_color}(hit ^C to abort)" && sleep 1 && \ + printf " ${fg[white]}>>>${reset_color} $watdo in: ${fg[red]} ${reset_color}(hit ^C to abort)\n" +} + +trapctrlc() { + echo "\n\n${fg[yellow]}(*) aborting...${reset_color}" + exit 2 +} + +trap "trapctrlc" 2 case "$1" in generate) generate;; clean) clean;; diff --git a/webtree b/webtree @@ -4,7 +4,7 @@ WEBROOT="/var/www/public_html/" # Set the format of your pages (php or markdown) pageformat=php -# pageformat=md +#pageformat=md # Here add the tree of your website, ex: #