summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreudoxia <uplink@distress.network>2020-12-31 04:52:57 -0500
committereudoxia <uplink@distress.network>2020-12-31 04:52:57 -0500
commit491032b297a6c9fdcc336152ff0b198ea2031d9f (patch)
treed33747d327650f16e5c4689cb9b71ea7c4f89bee
parentb3be75dbef55ebb4b18ba36d8be5a262d34f3569 (diff)
plain.sh: misc fixes
-rwxr-xr-xplain-header6
-rwxr-xr-xplain.sh9
2 files changed, 7 insertions, 8 deletions
diff --git a/plain-header b/plain-header
index 65cdda0..2c163f7 100755
--- a/plain-header
+++ b/plain-header
@@ -1,7 +1,8 @@
<!doctype html>
-<html>
+<html lang="en">
<head>
-<meta charset="UTF-8">
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/fonts/fonts.css">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
@@ -18,6 +19,7 @@ pre a:hover {text-decoration: none; color: #111; background-color: #ddd;}
pre a:active {text-decoration: none; color: #ddd;}
</style>
<title>#</title>
+<meta http-equiv="last-modified" content="" />
</head>
<body>
diff --git a/plain.sh b/plain.sh
index 79283be..153ae31 100755
--- a/plain.sh
+++ b/plain.sh
@@ -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"