Remove <style> and <script> snippets.

Closes: #8
This commit is contained in:
tastytea 2021-05-29 18:49:35 +02:00
parent 737d0a10b6
commit 37e868b3f2
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 7 additions and 1 deletions

View File

@ -134,7 +134,7 @@ void cleanup_text(string &text)
{
replacement = "</H>";
}
else if (text.substr(pos, 5) == "<span")
else if (text.substr(pos, 6) == "<span ")
{
auto endpos{text.find('>')};
boost::match_results<const char *> match;
@ -144,6 +144,12 @@ void cleanup_text(string &text)
replacement = "<PAGE " + match[2] + ">";
}
}
else if (text.substr(pos, 7) == "<style "
|| text.substr(pos, 8) == "<script ")
{
pos = text.find('>', pos) + 1;
}
text.replace(pos, text.find('>', pos) + 1 - pos, replacement);
pos += replacement.length();
}