* fix #16364 * add comments * Update tools/dochack/dochack.nim Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
parent
e1e069dd6c
commit
5d8f862bc6
1 changed files with 2 additions and 4 deletions
|
|
@ -268,15 +268,13 @@ var
|
|||
template normalize(x: cstring): cstring = x.toLower.replace("_", "")
|
||||
|
||||
proc escapeCString(x: var cstring) =
|
||||
# Original strings are already escaped except HTML tags, so
|
||||
# we only escape `<` and `>`.
|
||||
var s = ""
|
||||
for c in x:
|
||||
case c
|
||||
of '&': s.add("&")
|
||||
of '<': s.add("<")
|
||||
of '>': s.add(">")
|
||||
of '"': s.add(""")
|
||||
of '\'': s.add("'")
|
||||
of '/': s.add("/")
|
||||
else: s.add(c)
|
||||
x = s.cstring
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue