From 4feb59d831d395369aa21d77e9b9d293125421d1 Mon Sep 17 00:00:00 2001 From: mattkae Date: Fri, 23 Jun 2023 10:25:52 -0400 Subject: Able to parse double quoted HTML attributes --- src/html_token.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/html_token.cpp') diff --git a/src/html_token.cpp b/src/html_token.cpp index 1d0952d..1eabaa8 100644 --- a/src/html_token.cpp +++ b/src/html_token.cpp @@ -5,7 +5,6 @@ const char* TOKEN_TO_NAME_MAP[HtmlTokenType_Length] = { "Text", "Start Tag", "End Tag", - "Attribute", "EOF", "Character" }; @@ -18,7 +17,12 @@ void HtmlToken::print() { break; case HtmlTokenType_StartTag: case HtmlTokenType_EndTag: - logger_info("%s, %S", name, tag_name.c_str()); + logger_info("%s, %S, attributes: %lu", name, tag_name.c_str(), attributes.size()); + + for (auto i = 0; i < attributes.size(); i++) { + HtmlAttribute& attribute = attributes[i]; + printf("\tattribute: %S=%S\n", attribute.name.c_str(), attribute.value.c_str()); + } break; default: logger_info("%s", name); @@ -29,4 +33,5 @@ void HtmlToken::reset() { type = HtmlTokenType_None; tag_name.clear(); code_entity.clear(); + attributes.clear(); } -- cgit v1.2.1