support for "selected" keyword, improved handling of "checked"
authorPaul Hänsch <paul@plutz.net>
Mon, 16 Jul 2018 22:59:51 +0000 (00:59 +0200)
committerPaul Hänsch <paul@plutz.net>
Mon, 16 Jul 2018 22:59:51 +0000 (00:59 +0200)
html-sh.sed

index 4af3933..1f988b3 100755 (executable)
@@ -44,7 +44,10 @@ 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;(<input type="(checkbox|radio)" [^>]+)>[ \t]+checked;\1 checked="checked">;g;
+t attribs;
+s;(<input ([^>]+ )?type=(radio|"radio"|'radio')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
+s;(<input ([^>]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]+checked;\1 checked="checked">;g;
+s;(<option( [^>]+))>[ \t]+(checked|selected);\1 selected="selected">;g;
 t attribs;
 
 s;(<[^/][^>]*>)[ \t]*;\1;g;