From 9ec645b5678f7bb15c26c52dd3abf7ed52e96667 Mon Sep 17 00:00:00 2001 From: Physick <96335032+DegustatorPonos@users.noreply.github.com> Date: Sun, 10 May 2026 23:23:04 +0500 Subject: added HTML tag remover from CDATA tag --- news | Bin 702152 -> 702152 bytes src/RSS.hpp | 10 +++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/news b/news index a0eabba..85246a8 100755 Binary files a/news and b/news 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 = "".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){ -- cgit v1.3