introduce . as stop sign to prevent parsing text as attributes
authorPaul Hänsch <paul@plutz.net>
Mon, 9 Dec 2019 23:41:48 +0000 (00:41 +0100)
committerPaul Hänsch <paul@plutz.net>
Mon, 9 Dec 2019 23:41:48 +0000 (00:41 +0100)
html-sh.sed

index 976d42e..16aeb9a 100755 (executable)
@@ -48,6 +48,7 @@ t tagopen;
 G; h; s;^[^\n]*\n+;;; x; s;\n.*$;;;
 
 :attribs
+s;(<[^/][^>]*)>[ \t]*\.[ \t];\1>;g; t attEnd;
 s;class="([^>]+)>[ \t]*\.([^< \t]+);class="\2 \1>;g; t attribs;
 s;(<[^/][^>]*)>[ \t]*\.([^< \t]+);\1 class="\2">;g;
 s;(<[^/][^>]*)>[ \t]*#([^< \t]+);\1 id="\2">;g;
@@ -58,6 +59,7 @@ s;(<input ([^>]+ )?type=(checkbox|"checkbox"|'checkbox')( [^>]+)?)>[ \t]*(checke
 s;(<option( [^>]+)?)>[ \t]*(checked|selected);\1 selected="selected">;g;
 s;(<select( [^>]+)?)>[ \t]*multiple;\1 multiple="multiple">;g;
 t attribs;
+:attEnd
 
 s;(<[^/][^>]*>)[ \t]*;\1;g;
 # s;(<[^/][^>]*)>[ \t]*</[^>]+>;\1/>;g;