diff options
author | eudoxia <uplink@distress.network> | 2020-12-31 04:52:57 -0500 |
---|---|---|
committer | eudoxia <uplink@distress.network> | 2020-12-31 04:52:57 -0500 |
commit | 491032b297a6c9fdcc336152ff0b198ea2031d9f (patch) | |
tree | d33747d327650f16e5c4689cb9b71ea7c4f89bee /plain.sh | |
parent | b3be75dbef55ebb4b18ba36d8be5a262d34f3569 (diff) |
plain.sh: misc fixes
Diffstat (limited to 'plain.sh')
-rwxr-xr-x | plain.sh | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -19,12 +19,9 @@ set -e # along with this program. If not, see <http://www.gnu.org/licenses/>. -IN="$1" -OUT="$2" - [ "$1" ] || { echo "usage: ./plain.sh <input txt> <output html>" ; exit 1 ; } -[ -f $IN ] || { printf "%s \tFATAL: %s not found\n" "[->]" "$IN" ; exit 1 ; } +[ -f $1 ] || { printf "%s \tFATAL: %s not found\n" "[->]" "$1" ; exit 1 ; } [ -f plain-header ] || { printf "%s \tFATAL: plain-header not found\n" "[->]" ; exit 1 ; } @@ -45,8 +42,8 @@ TITLE=$(grep -e '^<!--title: ' -m 1 $1 | cut -f 2- -d ' ' | sedesc) sed -e "/^<!--title:/d" -e "s;<title>#;<title>${TITLE};1" -i'' $2 printf "[ok] \ttitle: %s\n" "$TITLE" -MDATE=$(stat -c '%y' $1 | sed -e 's/\.[0-9]* //' -e 's/\(..\)\(..\)$/\1:\2/') # ISO 8601 format: "yyyy-mm-dd hh:mm:ss±zz:zz" -sed "/^<\/head>/i <meta http-equiv=\"last-modified\" content=\"${MDATE}\" />" -i'' $2 +MDATE=$(stat -c '%y' $1 | sed -e 's/\.[0-9]* //' -e 's/\(..\)\(..\)$/\1:\2/') # format: "yyyy-mm-dd hh:mm:ss±zz:zz" (ISO 8601) +sed "s;<meta http-equiv=\"last-modified\" content=\";&${MDATE};1" -i'' $2 printf "[ok] \tdate: %s\n" "$MDATE" |