aboutsummaryrefslogtreecommitdiff
path: root/hwrap
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-01 00:16:11 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-01 00:16:11 +0100
commit18d7985f0a6dbc2032a05c10395e3e7d6fd511ee (patch)
treece8f8f037001d5ebc4f11276c3dd862485f2499a /hwrap
parent1511fba8e989df3dcdb4f6253e6c696a2e1944b7 (diff)
downloadmht-18d7985f0a6dbc2032a05c10395e3e7d6fd511ee.tar.gz
Add 'hwrap' tool
hwrap is a simple shell script that wraps the text read on standard input in an <html> tag. This could be built into the mh script, but I think it's more UNIX-like this way.
Diffstat (limited to 'hwrap')
-rwxr-xr-xhwrap21
1 files changed, 21 insertions, 0 deletions
diff --git a/hwrap b/hwrap
new file mode 100755
index 0000000..7dcfae0
--- /dev/null
+++ b/hwrap
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+# hwrap -- wrap in <html> tag
+
+l=
+while getopts l: o; do
+ case $o in
+ l) l=$OPTARG ;;
+ ?) echo usage: $0 [-l LANG] 1>&2; exit 1 ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if test -z "$l"
+then echo '<html>'
+else echo "<html lang=\"$l\">"
+fi
+
+cat
+
+echo '</html>'