diff options
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" |