X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=html-sh.sed;h=8d7b61c076b93d3de8b59683e67d9b161ffc8075;hb=b65a5aecf5675a87f47f0888e90ceea5dbfb219c;hp=1f988b3965d0eefc9c620eaa23de2c8350c86668;hpb=d45f9673ac73e57aa307db2514e6233dd673b7db;p=cgilite
diff --git a/html-sh.sed b/html-sh.sed
index 1f988b3..8d7b61c 100755
--- a/html-sh.sed
+++ b/html-sh.sed
@@ -1,4 +1,12 @@
-#!/bin/sed -nrf
+#!/bin/sed -nEf
+
+:Escapes
+s,\\\\,\\,g; s,\\&,\&,g;
+s,\\<,\<,g; s,\\>,\>,g;
+s,\\",\",g; s,\\',\',g;
+s,\\\[,\[,g; s,\\\],\],g;
+s,\\\.,\.,g; s,\\#,\#,g;
+s,\\,,g;
:CommentHandle
x; /^<\/!-->/{
@@ -40,18 +48,21 @@ t tagopen;
G; h; s;^[^\n]*\n+;;; x; s;\n.*$;;;
:attribs
-s;class="([^>]+)>[ \t]+\.([^< \t]+);class="\2 \1>;g; t attribs;
-s;>[ \t]+\.([^< \t]+); class="\1">;g;
-s;>[ \t]+#([^< \t]+); id="\1">;g;
-s;>[ \t]+([^ \t=<]+=("[^"]*"|'[^']*'|[^< \t]*)); \1>;g;
+s;class="([^>]+)>[ \t]*\.([^< \t]+);class="\2 \1>;g; t attribs;
+s;(<[^/][^>]*)>[ \t]*\.([^< \t]+);\1 class="\2">;g;
+s;(<[^/][^>]*)>[ \t]*#([^< \t]+);\1 id="\2">;g;
+s;(<[^/][^>]*)>[ \t]*([^ \t=<]+=("[^"]*"|'[^']*'|[^< \t]*));\1 \2>;g;
t attribs;
-s;(]+ )?type=(radio|"radio"|'radio')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
-s;(]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
-s;(