X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=html-sh.sed;h=8d7b61c076b93d3de8b59683e67d9b161ffc8075;hb=887a68a142e6eb59aecd1757b591ab7ab37cd279;hp=4af3933d889ef8292271592ded40c39133b0039f;hpb=3a191154e3277ce6aa942348ad84be033269bbc5;p=cgilite
diff --git a/html-sh.sed b/html-sh.sed
index 4af3933..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,15 +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;(]+)>[ \t]+checked;\1 checked="checked">;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|selected);\1 checked="checked">;g;
+s;(]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]*(checked|selected);\1 checked="checked">;g;
+s;(