diff options
author | John Ankarström <john@ankarstrom.se> | 2020-12-01 01:39:12 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-12-01 01:39:12 +0100 |
commit | 0eed74928168dcdaaa5bced1522acbb6072d13b2 (patch) | |
tree | 909d76ae43e9e16682ff39c55495b92244ff5b11 | |
parent | c644d3c21911294c0b8a9ef18d19b575d9b8f90e (diff) | |
download | mht-0eed74928168dcdaaa5bced1522acbb6072d13b2.tar.gz |
hwrap: Add -d (dir), -t (doctype) options
-rwxr-xr-x | hwrap | 36 |
1 files changed, 30 insertions, 6 deletions
@@ -2,19 +2,43 @@ # hwrap -- wrap in <html> tag +d= l= -while getopts l: o; do +t=5 +while getopts d:l:t: o; do case $o in + d) d=$OPTARG ;; l) l=$OPTARG ;; - ?) echo usage: $0 [-l LANG] 1>&2; exit 1 ;; + t) t=$OPTARG ;; + ?) echo usage: $0 [-d DIR] [-l LANG] [-t DOCTYPE] 1>&2; exit 1 ;; esac done shift $((OPTIND-1)) -if test -z "$l" -then echo '<html>' -else echo "<html lang=\"$l\">" -fi +case "$t" in +5) echo '<!DOCTYPE html>' ;; +4) echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd">' ;; +4t) echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd">' ;; +4f) echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" + "http://www.w3.org/TR/html4/frameset.dtd">' ;; +x1) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ;; +x1t) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ;; +x1f) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' ;; +x11) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' ;; +xb11) echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" + "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">' ;; +esac + +printf '<html' +test ! -z "$d" && printf ' dir="%s"' "$d" +test ! -z "$l" && printf ' lang="%s"' "$l" +echo '>' cat |