Local boost::smatch , MP-482
[metaproxy-moved-to-github.git] / src / html_parser.cpp
index abbdeba..3f1a4f4 100644 (file)
@@ -264,20 +264,21 @@ void mp::HTMLParser::Rep::parse_str(HTMLParserEvent &event, const char *cp)
         else if (*cp == '/' && isAlpha(cp[1]))
         {
             int i;
-            tagText(event, text_start, cp - 1);
-
             i = skipName(++cp);
 
             if (!nest)
             {
                 if (i == 6 && !yaz_strncasecmp(cp, "script", i))
-                    nest = true;
-                else
                 {
-                    text_start = cp - 1; // points to '/'
-                    continue;
+                    int ws = skipSpace(cp + 6);
+                    if (cp[ws + 6] == '>')
+                        nest = true; /* really terminated */
                 }
+                if (!nest)
+                    continue;
             }
+            tagText(event, text_start, cp - 2);
             event.closeTag(cp, i);
             if (m_verbose)
                 printf("------ tag close %.*s\n", i, cp);