1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-19 13:29:49 +00:00

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.
This commit is contained in:
King_DuckZ 2017-06-18 01:33:44 +01:00
parent 2bc671280e
commit e978d87b16

View file

@ -36,6 +36,13 @@ namespace kamokan {
//TODO: make sure the file exists or throw or do something //TODO: make sure the file exists or throw or do something
return parSettings.as<std::string>("highlight_css"); return parSettings.as<std::string>("highlight_css");
} }
std::string strip_tags_from_highlighted (const std::string& parPastie) {
boost::string_view pastie(parPastie);
auto beg_stripped = pastie.substr(pastie.find("<tt>") + 4);
auto end_stripped = beg_stripped.substr(0, beg_stripped.size() - 11);
return std::string(end_stripped);
}
} //unnamed namespace } //unnamed namespace
PastieResponse::PastieResponse ( PastieResponse::PastieResponse (
@ -100,7 +107,7 @@ namespace kamokan {
std::istringstream iss(std::move(processed_pastie)); std::istringstream iss(std::move(processed_pastie));
std::ostringstream oss; std::ostringstream oss;
highlighter.highlight(iss, oss, m_lang_file); highlighter.highlight(iss, oss, m_lang_file);
processed_pastie = oss.str(); processed_pastie = strip_tags_from_highlighted(oss.str());
} }
return processed_pastie; return processed_pastie;