mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
mdx close tag is not necessary.
dictionary marker should make sure the dictionary is ok. If not ,the modern browser is the last protection
This commit is contained in:
parent
ab1b525f12
commit
c0eae69aec
38
mdx.cc
38
mdx.cc
|
@ -1009,26 +1009,26 @@ void MdxDictionary::loadArticle( uint32_t offset, string & articleText, bool noF
|
|||
if( !noFilter )
|
||||
article = filterResource( articleId, article );
|
||||
|
||||
// Check for unclosed <span> and <div>
|
||||
QRegularExpression openTagsRx( "<\\s*span\\b", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
int openTags = article.count( openTagsRx );
|
||||
QRegularExpression closeTagRx( "<\\s*/span\\s*>", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
int closedTags = article.count( closeTagRx );
|
||||
while( openTags > closedTags )
|
||||
{
|
||||
article += "</span>";
|
||||
closedTags += 1;
|
||||
}
|
||||
//// Check for unclosed <span> and <div>
|
||||
//QRegularExpression openTagsRx( "<\\s*span\\b", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
//int openTags = article.count( openTagsRx );
|
||||
//QRegularExpression closeTagRx( "<\\s*/span\\s*>", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
//int closedTags = article.count( closeTagRx );
|
||||
//while( openTags > closedTags )
|
||||
//{
|
||||
// article += "</span>";
|
||||
// closedTags += 1;
|
||||
//}
|
||||
|
||||
QRegularExpression openDivRx( "<\\s*div\\b", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
openTags = article.count( openDivRx );
|
||||
QRegularExpression closeDivRx( "<\\s*/div\\s*>", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
closedTags = article.count( closeDivRx );
|
||||
while( openTags > closedTags )
|
||||
{
|
||||
article += "</div>";
|
||||
closedTags += 1;
|
||||
}
|
||||
//QRegularExpression openDivRx( "<\\s*div\\b", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
//openTags = article.count( openDivRx );
|
||||
//QRegularExpression closeDivRx( "<\\s*/div\\s*>", QRegularExpression::PatternOption::CaseInsensitiveOption );
|
||||
//closedTags = article.count( closeDivRx );
|
||||
//while( openTags > closedTags )
|
||||
//{
|
||||
// article += "</div>";
|
||||
// closedTags += 1;
|
||||
//}
|
||||
|
||||
articleText = string( article.toUtf8().constData() );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue