]> sjero.net Git - wget/commitdiff
[svn] Support XML-style empty tags.
authorhniksic <devnull@localhost>
Fri, 16 Nov 2001 16:44:34 +0000 (08:44 -0800)
committerhniksic <devnull@localhost>
Fri, 16 Nov 2001 16:44:34 +0000 (08:44 -0800)
src/ChangeLog
src/html-parse.c

index de743a8f5f9aad92e8f671841193c366bcb74e0c..29edda04e4ade366809a3c2e53e50c67c4b70296 100644 (file)
@@ -1,3 +1,7 @@
+2001-11-16  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * html-parse.c (map_html_tags): Support XML-style empty tags.
+
 2001-06-26  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * wget.h (DO_REALLOC_FROM_ALLOCA): Check for do_realloc_newsize in
index f9a5b0f5379129fcf7fe3e54baf65dee1a48293e..4ae7afe77ac93d7cacb4c728865338993db68ee2 100644 (file)
@@ -638,6 +638,19 @@ map_html_tags (const char *text, int size,
 
        SKIP_WS (p);
 
+       if (*p == '/')
+         {
+           /* A slash at this point means the tag is about to be
+              closed.  This is legal in XML and has been popularized
+              in HTML via XHTML.  */
+           /* <foo a=b c=d /> */
+           /*              ^  */
+           ADVANCE (p);
+           SKIP_WS (p);
+           if (*p != '>')
+             goto backout_tag;
+         }
+
        /* Check for end of tag definition. */
        if (*p == '>')
          break;
@@ -654,7 +667,7 @@ map_html_tags (const char *text, int size,
 
        /* Establish bounds of attribute value. */
        SKIP_WS (p);
-       if (NAME_CHAR_P (*p) || *p == '>')
+       if (NAME_CHAR_P (*p) || *p == '/' || *p == '>')
          {
            /* Minimized attribute syntax allows `=' to be omitted.
                For example, <UL COMPACT> is a valid shorthand for <UL
@@ -735,7 +748,7 @@ map_html_tags (const char *text, int size,
            /* We skipped the whitespace and found something that is
               neither `=' nor the beginning of the next attribute's
               name.  Back out.  */
-           goto backout_tag;   /* <foo bar /... */
+           goto backout_tag;   /* <foo bar [... */
                                /*          ^    */
          }