diff options
Diffstat (limited to 'hwrap')
-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 |