From 04b4ae5333b11f27b864ffa4272b32a97b05627a Mon Sep 17 00:00:00 2001 From: Nimetu Date: Sun, 25 Apr 2021 13:07:04 +0300 Subject: [PATCH] Ignore last linebreak in pre tag --- nel/src/gui/html_parser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nel/src/gui/html_parser.cpp b/nel/src/gui/html_parser.cpp index 80725552e..b8eb0176b 100644 --- a/nel/src/gui/html_parser.cpp +++ b/nel/src/gui/html_parser.cpp @@ -182,6 +182,16 @@ namespace NLGUI { 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 // dt without end tag:
// dd without end tag: