diff options
| author | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-05-10 23:23:04 +0500 |
|---|---|---|
| committer | Physick <96335032+DegustatorPonos@users.noreply.github.com> | 2026-05-10 23:23:04 +0500 |
| commit | 9ec645b5678f7bb15c26c52dd3abf7ed52e96667 (patch) | |
| tree | 2b29bcff84797fda7778241c4c33a320394e7189 | |
| parent | 600edb6b68173ae931aaa88d74573964d5306224 (diff) | |
added HTML tag remover from CDATA tag
| -rwxr-xr-x | news | bin | 702152 -> 702152 bytes | |||
| -rw-r--r-- | src/RSS.hpp | 10 |
2 files changed, 7 insertions, 3 deletions
| Binary files differ diff --git a/src/RSS.hpp b/src/RSS.hpp index 5dd8376..c4a5b2c 100644 --- a/src/RSS.hpp +++ b/src/RSS.hpp @@ -95,7 +95,7 @@ class XML_leaf { std::string GetValue() { if (isCDATA(Value)) - return getCDATA(Value); + return getCDATA(Value, true); return Value; } @@ -146,11 +146,15 @@ class XML_leaf { } // Assumes the string is CDATA - static std::string getCDATA(std::string token) { + static std::string getCDATA(std::string token, bool toRawString = false) { // 9 = "<!CDATA[".length // 3 = "]]>".length if (token.length() < 9 + 3) return token; - return token.substr(9, token.length() - (9+3)); + auto data = token.substr(9, token.length() - (9+3)); + if (toRawString) { + data = std::regex_replace(data, std::regex("<[a-zA-Z/]+>"), ""); + } + return data; } static bool isClosingTagOf(std::string token, std::string opening_tag){ |
