From e978d87b16ac27887d7b17acbcf281e663d0839f Mon Sep 17 00:00:00 2001 From: King_DuckZ Date: Sun, 18 Jun 2017 01:33:44 +0100 Subject: [PATCH] Temporary hack to remove html tags that are causing problems. I will add the comment back in as as separate mustache token. And I will make this code look a bit nicer. --- src/kamokan_impl/pastie_response.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kamokan_impl/pastie_response.cpp b/src/kamokan_impl/pastie_response.cpp index a23508b..9bd5bb2 100644 --- a/src/kamokan_impl/pastie_response.cpp +++ b/src/kamokan_impl/pastie_response.cpp @@ -36,6 +36,13 @@ namespace kamokan { //TODO: make sure the file exists or throw or do something return parSettings.as("highlight_css"); } + + std::string strip_tags_from_highlighted (const std::string& parPastie) { + boost::string_view pastie(parPastie); + auto beg_stripped = pastie.substr(pastie.find("") + 4); + auto end_stripped = beg_stripped.substr(0, beg_stripped.size() - 11); + return std::string(end_stripped); + } } //unnamed namespace PastieResponse::PastieResponse ( @@ -100,7 +107,7 @@ namespace kamokan { std::istringstream iss(std::move(processed_pastie)); std::ostringstream oss; highlighter.highlight(iss, oss, m_lang_file); - processed_pastie = oss.str(); + processed_pastie = strip_tags_from_highlighted(oss.str()); } return processed_pastie;