]> git.plutz.net Git - cgilite/commitdiff
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 4af3933d889ef8292271592ded40c39133b0039f..1f988b3965d0eefc9c620eaa23de2c8350c86668 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;