Few more bugs fixed

This commit is contained in:
2023-07-12 22:47:19 -07:00
parent 9aaaa94406
commit d4101f3446
2 changed files with 30 additions and 1 deletions

View File

@@ -22,8 +22,19 @@ int32_t VNTextParser::onParse(
struct VNText *out,
std::string *error
) {
std::string innerXml = node->innerXml;
// Split by newlines, then trim each line.
std::vector<std::string> lines = stringSplit(innerXml, "\n");
std::vector<std::string> finalLines;
for(auto it = lines.begin(); it != lines.end(); ++it) {
auto newLine = stringTrim(*it);
if(newLine.length() > 0) finalLines.push_back(newLine);
}
std::string finalXml = stringJoin(finalLines, "\n");
out->language = values["lang"];
out->text = stringParser(node->innerXml, error);
out->text = stringParser(finalXml, error);
return error->length() == 0 ? 0 : -1;
}