From 4537a7eb38bb46ce114620591ee64859568ffaec Mon Sep 17 00:00:00 2001
From: Leandro Melo
Paragraphs similar to this. Example:
- index = html->lastIndexOf(QLatin1Char('.'), index); - if (index > 0) { - html->truncate(index); - html->append(QLatin1String(".")); + // Try to get the entire first paragraph, but if one is not found or if its opening + // tag is not in the very beginning (using an empirical value as the limit) the html + // is cleared to avoid too much content. + int index = html->indexOf(QLatin1String("")); + if (index != -1 && index < 400) { + index = html->indexOf(QLatin1String("
"), index + 2); + if (index != -1) { + if (html->at(index - 1) == QLatin1Char('.')) { + html->truncate(index + 4); + } else { + //Paragraphs similar to this. Example:
+ index = html->lastIndexOf(QLatin1Char('.'), index); + if (index != -1) { + html->truncate(index); + html->append(QLatin1String(".")); + } } + } else { + html->clear(); } } else { - // Some enumerations don't have paragraphs and just a table with the items. In such - // cases the the html is cleared to avoid showing more that desired. html->clear(); - return; } } - if (m_formatContents) { + if (!html->isEmpty() && m_formatContents) { stripBold(html); replaceNonStyledHeadingsForBold(html); replaceTablesForSimpleLines(html);