Escape ' and / when using escape in xmltree

This commit is contained in:
Erwan Ameil
2014-08-30 22:21:38 +02:00
parent 3a00692ef8
commit 05c1fb060f

View File

@@ -151,6 +151,8 @@ proc addEscaped*(result: var string, s: string) =
of '>': result.add(">")
of '&': result.add("&")
of '"': result.add(""")
of '\'': result.add("'")
of '/': result.add("/")
else: result.add(c)
proc escape*(s: string): string =
@@ -164,6 +166,8 @@ proc escape*(s: string): string =
## ``>`` ``>``
## ``&`` ``&``
## ``"`` ``"``
## ``'`` ``'``
## ``/`` ``/``
## ------------ -------------------
result = newStringOfCap(s.len)
addEscaped(result, s)