Skip to content

Commit

Permalink
fix #16364 (#16379) [backport]
Browse files Browse the repository at this point in the history
* fix #16364

* add comments

* Update tools/dochack/dochack.nim

Co-authored-by: Clyybber <darkmine956@gmail.com>

Co-authored-by: Clyybber <darkmine956@gmail.com>
  • Loading branch information
ringabout and Clyybber authored Dec 17, 2020
1 parent e1e069d commit 5d8f862
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/dochack/dochack.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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("&amp;")
of '<': s.add("&lt;")
of '>': s.add("&gt;")
of '"': s.add("&quot;")
of '\'': s.add("&#039;")
of '/': s.add("&#x2F;")
else: s.add(c)
x = s.cstring

Expand Down

0 comments on commit 5d8f862

Please sign in to comment.