|
|
|
@ -224,6 +224,15 @@ std::shared_ptr<Node> HTMLParser::parse(const std::string &html) const {
@@ -224,6 +224,15 @@ std::shared_ptr<Node> HTMLParser::parse(const std::string &html) const {
|
|
|
|
|
} |
|
|
|
|
else if (state == 3) { // End text node
|
|
|
|
|
if (html[cursor + 1] == '<') { |
|
|
|
|
// find next space
|
|
|
|
|
std::string left = html.substr(cursor); |
|
|
|
|
size_t end = std::min(left.find(" "), left.find(">")); |
|
|
|
|
if (end != std::string::npos) { |
|
|
|
|
if (end > 14) { |
|
|
|
|
//std::cout << "Tag Distance [" << end << "] [" << html.substr(cursor, end) << "]\n";
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
dynamic_cast<TextNode*>(currentNode.get())->text = (prependWhiteSpace?" ":"") + html.substr(starts.back(), cursor - starts.back() + 1); |
|
|
|
|
//std::cout << "HTMLParser::parse - end text node: " << html.substr(starts.back(), cursor - starts.back() + 1) << std::endl;
|
|
|
|
|
starts.pop_back(); |
|
|
|
|