From 90ca54342273f5e21161417909bcb43a4b5f9733 Mon Sep 17 00:00:00 2001 From: eudoxia Date: Wed, 10 Nov 2021 17:41:38 -0500 Subject: md.sh: fixed various formatting inconsistencies --- md.sh | 77 ++++++++++++++++++++++++++++++------------------------------------- 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/md.sh b/md.sh index 79cc580..a102e42 100755 --- a/md.sh +++ b/md.sh @@ -32,10 +32,10 @@ OUT="$1/index.html" [ "$1" ] || { echo "$usage" ; exit 1 ; } -[ -f $IN ] || { printf "%s \tFATAL: %s not found\n" "[->]" "$IN"; exit 1 ; } -[ -f md-header ] || { printf "%s \tFATAL: md-header not found\n" "[->]" ; exit 1 ; } -[ -f md-footer ] || { printf "%s \tFATAL: md-footer not found\n" "[->]" ; exit 1 ; } -[ $(which lowdown) ] || { printf "%s \tFATAL: lowdown not found\n" "[->]" ; exit 1 ; } +[ -f $IN ] || { printf "%s \tFATAL: %s not found\n" "[->]" "$IN" ; exit 1 ; } +[ -f md-header ] || { printf "%s \tFATAL: md-header not found\n" "[->]" ; exit 1 ; } +[ -f md-footer ] || { printf "%s \tFATAL: md-footer not found\n" "[->]" ; exit 1 ; } +[ $(which lowdown) ] || { printf "%s \tFATAL: lowdown not found\n" "[->]" ; exit 1 ; } cat md-header > $OUT lowdown -Thtml --html-no-owasp $IN >> $OUT @@ -68,8 +68,10 @@ BOMBER=$(grep -e '^bomber: ' -m 1 $IN | cut -f 2- -d ' ' | sedesc) sed "s/
/&${BOMBER}/1" -i'' $OUT printf "[ok] \tbomber: %s\n" "$(echo "$BOMBER" | unesc)" -MDATE=$(stat -c '%y' $IN | sed -e 's/\.[0-9]* //' -e 's/\(..\)\(..\)$/\1:\2/') # format: "yyyy-mm-dd hh:mm:ss±zz:zz" (ISO 8601) -DATE=$(echo $MDATE | cut -f 1 -d ' ' | sed -e 's/-//g' -e 's/^..//') # format: "yymmdd" (for humans) +# format: "yyyy-mm-dd hh:mm:ss±zz:zz" (ISO 8601) +MDATE=$(stat -c '%y' $IN | sed -e 's/\.[0-9]* //' -e 's/\(..\)\(..\)$/\1:\2/') +# format: "yymmdd" (for humans) +DATE=$(echo $MDATE | cut -f 1 -d ' ' | sed -e 's/-//g' -e 's/^..//') sed -e "s;