Skip to content

Commit

Permalink
strip_html deletes other tags
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteven4 committed Sep 15, 2024
1 parent 677da95 commit 40fe2ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,9 @@ QString strip_html(const QString& utfstring)
assert(trre.isValid());
static const QRegularExpression tdre("<td.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
assert(tdre.isValid());
static const QRegularExpression otherre("<.*?>", QRegularExpression::CaseInsensitiveOption | QRegularExpression::DotMatchesEverythingOption);
assert(otherre.isValid());


QString out(utfstring);

Expand All @@ -794,6 +797,7 @@ QString strip_html(const QString& utfstring)
out.replace(trre, "\n");
out.replace(tdre, " ");
out.replace("<img", "[IMG]", Qt::CaseInsensitive);
out.replace(otherre, "");

// Then entity replacement (entities are case sensitive)
out.replace("&amp;","&");
Expand Down

0 comments on commit 40fe2ef

Please sign in to comment.