Make html parser use case insensitive unordered_map for attributes
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-riscv64:latest, riscv64-linux-gnu, riscv64, asrock) (push) Failing after 30s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x86:latest, i386-linux-gnu, 386, asrock) (push) Failing after 33s
Build and Deploy on Tag / 🔨 Build for PowerPC (push) Failing after 35s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm:latest, arm-linux-gnueabihf, arm7, fw13-ubuntu-latest) (push) Failing after 38s
Build and Deploy on Tag / 🔨 Build win32 and update the tap 🍺 (push) Failing after 43s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x64:latest, x86_64-linux-gnu, amd64, msi-walmart) (push) Failing after 43s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm64:latest, aarch64-linux-gnu, arm64, msi-walmart) (push) Failing after 46s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-riscv64:latest, riscv64-linux-gnu, riscv64, asrock) (push) Failing after 30s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x86:latest, i386-linux-gnu, 386, asrock) (push) Failing after 33s
Build and Deploy on Tag / 🔨 Build for PowerPC (push) Failing after 35s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm:latest, arm-linux-gnueabihf, arm7, fw13-ubuntu-latest) (push) Failing after 38s
Build and Deploy on Tag / 🔨 Build win32 and update the tap 🍺 (push) Failing after 43s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-x64:latest, x86_64-linux-gnu, amd64, msi-walmart) (push) Failing after 43s
Build and Deploy on Tag / 🔨 Build for everything else (git.tesses.org/tesses50/linux-arm64:latest, aarch64-linux-gnu, arm64, msi-walmart) (push) Failing after 46s
This commit is contained in:
@@ -21,13 +21,31 @@
|
||||
|
||||
#pragma once
|
||||
#include "../TextStreams/TextReader.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
namespace Tesses::Framework::Serialization::Html {
|
||||
|
||||
struct CaseInsensitiveHash {
|
||||
size_t operator()(const std::string &s) const {
|
||||
std::string lower = s;
|
||||
std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
|
||||
return std::hash<std::string>{}(lower);
|
||||
}
|
||||
};
|
||||
|
||||
struct CaseInsensitiveEqual {
|
||||
bool operator()(const std::string &a, const std::string &b) const {
|
||||
return strcasecmp(a.c_str(), b.c_str()) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct HtmlNode;
|
||||
struct HtmlNode : public std::enable_shared_from_this<HtmlNode> {
|
||||
|
||||
std::string text_or_tag;
|
||||
std::vector<std::pair<std::string, std::optional<std::string>>> attributes;
|
||||
std::unordered_map<std::string, std::optional<std::string>,
|
||||
CaseInsensitiveHash, CaseInsensitiveEqual>
|
||||
attributes;
|
||||
std::vector<std::shared_ptr<HtmlNode>> children;
|
||||
bool isText = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user