Extend xml escape with enter and tabulator
This commit is contained in:
parent
7a3b220f0a
commit
4c416bc747
@ -911,7 +911,7 @@ std::string xml_escape(std::string text, bool is_marked/* = false*/)
|
||||
std::string::size_type pos = 0;
|
||||
for (;;)
|
||||
{
|
||||
pos = text.find_first_of("\"\'&<>", pos);
|
||||
pos = text.find_first_of("\"\'&<>\n\t", pos);
|
||||
if (pos == std::string::npos)
|
||||
break;
|
||||
|
||||
@ -922,7 +922,9 @@ std::string xml_escape(std::string text, bool is_marked/* = false*/)
|
||||
case '\'': replacement = "'"; break;
|
||||
case '&': replacement = "&"; break;
|
||||
case '<': replacement = is_marked ? "<" :"<"; break;
|
||||
case '>': replacement = is_marked ? ">" :">"; break;
|
||||
case '>': replacement = is_marked ? ">" : ">"; break;
|
||||
case '\n': replacement = "
"; break;
|
||||
case '\t': replacement = "	"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user