Loading src/html.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -1622,9 +1622,15 @@ size_t libhtmlpp::TextElement::parseElement( std::vector<char> buf; buf.reserve(64); bool seen_nonws = false; bool last_was_space = false; // A whitespace run always collapses to exactly one space, whether it's // leading, internal, trailing, or the entire run -- never to zero. A // leading run is just as significant as an internal one: it's what // separates this text from whatever inline element preceded it (e.g. // "</span> next word", or two adjacent elements separated only by // whitespace like "<a>A</a> <a>B</a>"). Dropping it silently glues // words together in the rendered output. size_t i = start; while (i < in.size()) { char c = in[i]; Loading @@ -1633,18 +1639,15 @@ size_t libhtmlpp::TextElement::parseElement( } if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { if (seen_nonws) { if (!last_was_space) { buf.push_back(' '); last_was_space = true; } } ++i; continue; } buf.push_back(c); seen_nonws = true; last_was_space = false; ++i; } Loading Loading
src/html.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -1622,9 +1622,15 @@ size_t libhtmlpp::TextElement::parseElement( std::vector<char> buf; buf.reserve(64); bool seen_nonws = false; bool last_was_space = false; // A whitespace run always collapses to exactly one space, whether it's // leading, internal, trailing, or the entire run -- never to zero. A // leading run is just as significant as an internal one: it's what // separates this text from whatever inline element preceded it (e.g. // "</span> next word", or two adjacent elements separated only by // whitespace like "<a>A</a> <a>B</a>"). Dropping it silently glues // words together in the rendered output. size_t i = start; while (i < in.size()) { char c = in[i]; Loading @@ -1633,18 +1639,15 @@ size_t libhtmlpp::TextElement::parseElement( } if (c == ' ' || c == '\t' || c == '\r' || c == '\n') { if (seen_nonws) { if (!last_was_space) { buf.push_back(' '); last_was_space = true; } } ++i; continue; } buf.push_back(c); seen_nonws = true; last_was_space = false; ++i; } Loading