Escape ' and / when using escape in xmltree

This commit is contained in:
Erwan Ameil 2014-08-30 22:21:38 +02:00
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(""") of '"': result.add(""")
of '\'': result.add("'")
of '/': result.add("/")
else: result.add(c) else: result.add(c)
proc escape*(s: string): string = proc escape*(s: string): string =
@ -164,6 +166,8 @@ proc escape*(s: string): string =
## ``>`` ``>`` ## ``>`` ``>``
## ``&`` ``&`` ## ``&`` ``&``
## ``"`` ``"`` ## ``"`` ``"``
## ``'`` ``'``
## ``/`` ``/``
## ------------ ------------------- ## ------------ -------------------
result = newStringOfCap(s.len) result = newStringOfCap(s.len)
addEscaped(result, s) addEscaped(result, s)