commit a5a4dcc8d5c607c66641225167f6bf73ce5dc275
parent 0544bcf9a77afced6fe52c018fb1c4758ffde18c
Author: Robin <kroekerrobin@gmail.com>
Date: Sun, 13 Aug 2023 16:24:16 +0200
Fix parsing attr values
class="one two" would previously be parsed
as one attr value. Now two attrs will be
created.
Diffstat:
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/html.c b/html.c
@@ -424,6 +424,21 @@ struct tag *parseTag(char *text, size_t offset, enum state state, struct tag_lis
attrValueSyntax = AVS_NO;
state = STATE_ATTR_NAME;
}
+ else if (attrValueSyntax == AVS_QUOTATION_MARK || attrValueSyntax == AVS_APOSTROPHE)
+ {
+ char *tmpName = malloc((strlen(tag->attrs[a]->name)+1) * sizeof(char));
+ strcpy(tmpName, tag->attrs[a]->name);
+ tag->attrs = realloc(
+ tag->attrs,
+ (a+1) * sizeof(struct attr)
+ );
+ a++;
+ tag->attrs[a] = initAttr();
+ free(tag->attrs[a]->name);
+ tag->attrs[a]->name = tmpName;
+ tag->attrsLen++;
+ attrNameCount = a + 1;
+ }
break;
}
if (cp == QUOTATION_MARK)