Make html parser use case insensitive unordered_map for attributes

This commit is contained in:
2026-09-25 16:17:11 -05:00
parent 95442f8acc
commit 15f08f474f
6 changed files with 37 additions and 21 deletions
+3 -7
View File
@@ -9,14 +9,10 @@ Json::JToken Html2JToken(std::shared_ptr<Html::HtmlNode> node) {
} else {
Json::JObject obj;
obj.SetValue("Tag", node->text_or_tag);
Json::JArray attrs;
Json::JObject attrs;
for (auto &item : node->attributes) {
if (item.second)
attrs.Add(Json::JObject(
{{"Key", item.first}, {"Value", item.second.value()}}));
else
attrs.Add(
Json::JObject({{"Key", item.first}, {"Value", nullptr}}));
attrs.SetValue(item.first,
item.second.value_or<Json::JToken>(nullptr));
}
obj.SetValue("Attributes", attrs);