From 93abbf2b97b0c102de67586c3db8f87b845b43f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 30 Jan 2021 16:06:41 +0000 Subject: Add htwrap --- htwrap | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 htwrap (limited to 'htwrap') diff --git a/htwrap b/htwrap new file mode 100755 index 0000000..4b7de46 --- /dev/null +++ b/htwrap @@ -0,0 +1,56 @@ +#!/bin/rc -e + +# htwrap -- create standalone HTML document + +flagfmt='t, c charset, d dir, l lang, v doctype' +args='[file ...]' + +if(! ifs=() eval `{aux/getflags $*}){ + aux/usage + exit usage +} + +switch($flagv){ +case 5 + echo '' +case 4 + echo '' +case 4s + echo '' +case x xhtml + echo '' +case xs xhtmls + echo '' +case '' + echo '' +case * + echo error: unknown doctype $flagv >[1=2] + aux/usage + exit usage +} + +echo -n '' + +if(! ~ $#flagc 0) + echo '' + +fn source{ + if(! ~ $#* 0) + cat $* + if not + cat +} + +if(! ~ $#flagt 0) # try to retrieve title from

on first line + source $* | sed '1s/^

(.*)<\/h1>/\1<\/title>\n&/' +if not + source $* + +echo '</html>' -- cgit v1.2.3