Merge branch 'develop' into develop-atys

feature/develop-atys
Nimetu 3 years ago
commit 78478e32cd

@ -79,13 +79,13 @@ namespace NLGUI
std::string htmlEscape(const std::string &val) const;
// serialize element attributes as string
std::string serializeAttributes() const;
std::string serializeAttributes(bool escape = true) const;
// serialize child elements as html string
std::string serializeChilds() const;
std::string serializeChilds(bool escape = true) const;
// serialize itself and children as html string
std::string serialize() const;
std::string serialize(bool escape = true) const;
// debug
std::string toString(bool tree = false, uint depth = 0) const;

@ -6793,7 +6793,7 @@ namespace NLGUI
_TextAreaTemplate = !templateName.empty() ? templateName : DefaultFormTextAreaGroup;
std::string content = strFindReplaceAll(elm.serializeChilds(), std::string("\r"), std::string(""));
std::string content = strFindReplaceAll(elm.serializeChilds(false), std::string("\r"), std::string(""));
CInterfaceGroup *textArea = addTextArea (_TextAreaTemplate, _TextAreaName.c_str (), _TextAreaRow, _TextAreaCols, true, content, _TextAreaMaxLength);
if (textArea)
@ -6826,7 +6826,7 @@ namespace NLGUI
// if (!_ReadingHeadTag) return;
// consume all child elements
_TitleString = strFindReplaceAll(elm.serializeChilds(), std::string("\t"), std::string(" "));
_TitleString = strFindReplaceAll(elm.serializeChilds(false), std::string("\t"), std::string(" "));
_TitleString = strFindReplaceAll(_TitleString, std::string("\n"), std::string(" "));
setTitle(_TitleString);
}

@ -155,7 +155,7 @@ namespace NLGUI
switch(val[pos])
{
case '"': ret.append("""); break;
case '\'': ret.append("'"); break;
case '\'': ret.append("'"); break;
case '&': ret.append("&"); break;
case '<': ret.append("&lt;"); break;
case '>': ret.append("&gt;"); break;
@ -168,7 +168,7 @@ namespace NLGUI
}
// ***************************************************************************
std::string CHtmlElement::serializeAttributes() const
std::string CHtmlElement::serializeAttributes(bool escape) const
{
std::string result;
for(std::map<std::string, std::string>::const_iterator it = Attributes.begin(); it != Attributes.end(); ++it)
@ -182,30 +182,30 @@ namespace NLGUI
{
result += " ";
}
result += htmlEscape(*it2);
result += (escape ? htmlEscape(*it2) : *it2);
}
result += "\"";
}
else
{
result += " " + it->first + "=\"" + htmlEscape(it->second) + "\"";
result += " " + it->first + "=\"" + (escape ? htmlEscape(it->second) : it->second) + "\"";
}
}
return result;
}
// ***************************************************************************
std::string CHtmlElement::serializeChilds() const
std::string CHtmlElement::serializeChilds(bool escape) const
{
std::string result;
for(std::list<CHtmlElement>::const_iterator it = Children.begin(); it != Children.end(); ++it)
result += it->serialize();
result += it->serialize(escape);
return result;
}
// ***************************************************************************
std::string CHtmlElement::serialize() const
std::string CHtmlElement::serialize(bool escape) const
{
if (Type == TEXT_NODE)
{
@ -214,12 +214,14 @@ namespace NLGUI
parent->ID == HTML_NOSCRIPT))
{
return Value;
} else {
} else if (escape) {
return htmlEscape(Value);
} else {
return Value;
}
}
std::string result = "<" + Value + serializeAttributes() + ">";
std::string result = "<" + Value + serializeAttributes(escape) + ">";
if (ID == HTML_AREA || ID == HTML_BASE || ID == HTML_BR ||
ID == HTML_COL || ID == HTML_EMBED || ID == HTML_HR ||
@ -234,7 +236,7 @@ namespace NLGUI
result += "\n";
if (!Children.empty())
result += serializeChilds();
result += serializeChilds(escape);
result += "</" + Value + ">";

Loading…
Cancel
Save