Don't prevent ',' from getting escaped in theindex.html
- Enable escaping of links in theindex.html - Fixes https://github.com/nim-lang/Nim/issues/9107. - Second part of the fix for https://github.com/nim-lang/Nim/issues/9097.
This commit is contained in:
parent
de8cb0a1cf
commit
903886396d
3 changed files with 12 additions and 7 deletions
|
|
@ -424,11 +424,15 @@ proc sortIndex(a: var openArray[IndexEntry]) =
|
|||
if h == 1: break
|
||||
|
||||
proc escapeLink(s: string): string =
|
||||
## This proc is mostly copied from uri/encodeUrl except that
|
||||
## these chars are also left unencoded: '#', '/'.
|
||||
result = newStringOfCap(s.len + s.len shr 2)
|
||||
for c in items(s):
|
||||
case c
|
||||
of 'a'..'z', '_', 'A'..'Z', '0'..'9', '.', '#', ',', '/':
|
||||
result.add c
|
||||
of 'a'..'z', 'A'..'Z', '0'..'9', '-', '.', '_', '~': # same as that in uri/encodeUrl
|
||||
add(result, c)
|
||||
of '#', '/': # example.com/foo/#bar (don't escape the '/' and '#' in such links)
|
||||
add(result, c)
|
||||
else:
|
||||
add(result, "%")
|
||||
add(result, toHex(ord(c), 2))
|
||||
|
|
@ -444,7 +448,7 @@ proc generateSymbolIndex(symbols: seq[IndexEntry]): string =
|
|||
var j = i
|
||||
while j < symbols.len and keyword == symbols[j].keyword:
|
||||
let
|
||||
url = symbols[j].link #.escapeLink
|
||||
url = symbols[j].link.escapeLink
|
||||
text = if symbols[j].linkTitle.len > 0: symbols[j].linkTitle else: url
|
||||
desc = if symbols[j].linkDesc.len > 0: symbols[j].linkDesc else: ""
|
||||
if desc.len > 0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue