Ignore last linebreak in pre tag

feature/develop-atys
Nimetu 4 years ago
parent cc44eaf935
commit 04b4ae5333

@ -182,6 +182,16 @@ namespace NLGUI
{ {
parseNode(node->children, elm, styles, links); parseNode(node->children, elm, styles, links);
if (!elm.Children.empty() && elm.ID == HTML_PRE && elm.Children.back().Type == CHtmlElement::TEXT_NODE)
{
std::string::size_type size = elm.Children.back().Value.size();
// strip last '\n' from non-empty line
if (size > 1 && elm.Children.back().Value[size-1] == '\n')
{
elm.Children.back().Value = elm.Children.back().Value.substr(0, size - 1);
}
}
// must cleanup nested tags that libxml2 does not fix // must cleanup nested tags that libxml2 does not fix
// dt without end tag: <dl><dt><dt></dl> // dt without end tag: <dl><dt><dt></dl>
// dd without end tag: <dl><dd><dd></dl> // dd without end tag: <dl><dd><dd></dl>

Loading…
Cancel
Save