syntaticly space is more reasonable than remove directly.

This commit is contained in:
Xiao YiFang 2022-06-10 20:44:59 +08:00
parent faa1ee480c
commit 3ed7ce5ccb

View file

@ -149,7 +149,7 @@ QString unescape( QString const & str, bool saveFormat )
{ {
tmp.replace( QRegularExpression( "<(?:\\s*/?(?:div|h[1-6r]|q|p(?![alr])|br|li(?![ns])|td|blockquote|[uo]l|pre|d[dl]|nav|address))[^>]{0,}>", tmp.replace( QRegularExpression( "<(?:\\s*/?(?:div|h[1-6r]|q|p(?![alr])|br|li(?![ns])|td|blockquote|[uo]l|pre|d[dl]|nav|address))[^>]{0,}>",
QRegularExpression::CaseInsensitiveOption ), " " ); QRegularExpression::CaseInsensitiveOption ), " " );
tmp.remove( QRegularExpression( "<[^>]*>" ) ); tmp.replace( QRegularExpression( "<[^>]*>"), " ");
} }
return QTextDocumentFragment::fromHtml( tmp.trimmed() ).toPlainText(); return QTextDocumentFragment::fromHtml( tmp.trimmed() ).toPlainText();