mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
Merge pull request #1510 from idlewan/xml_escape
Escape ' and / when using escape in xmltree
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user