fixes #7500
This commit is contained in:
parent
539fc5d58b
commit
a0914eff5d
1 changed files with 26 additions and 2 deletions
|
|
@ -363,6 +363,12 @@ proc addNodes(n: PRstNode): string =
|
||||||
addNodesAux(n, result)
|
addNodesAux(n, result)
|
||||||
|
|
||||||
proc rstnodeToRefnameAux(n: PRstNode, r: var string, b: var bool) =
|
proc rstnodeToRefnameAux(n: PRstNode, r: var string, b: var bool) =
|
||||||
|
template special(s) =
|
||||||
|
if b:
|
||||||
|
add(r, '-')
|
||||||
|
b = false
|
||||||
|
add(r, s)
|
||||||
|
|
||||||
if n == nil: return
|
if n == nil: return
|
||||||
if n.kind == rnLeaf:
|
if n.kind == rnLeaf:
|
||||||
for i in countup(0, len(n.text) - 1):
|
for i in countup(0, len(n.text) - 1):
|
||||||
|
|
@ -373,7 +379,7 @@ proc rstnodeToRefnameAux(n: PRstNode, r: var string, b: var bool) =
|
||||||
b = false
|
b = false
|
||||||
if len(r) == 0: add(r, 'Z')
|
if len(r) == 0: add(r, 'Z')
|
||||||
add(r, n.text[i])
|
add(r, n.text[i])
|
||||||
of 'a'..'z':
|
of 'a'..'z', '\128'..'\255':
|
||||||
if b:
|
if b:
|
||||||
add(r, '-')
|
add(r, '-')
|
||||||
b = false
|
b = false
|
||||||
|
|
@ -383,8 +389,26 @@ proc rstnodeToRefnameAux(n: PRstNode, r: var string, b: var bool) =
|
||||||
add(r, '-')
|
add(r, '-')
|
||||||
b = false
|
b = false
|
||||||
add(r, chr(ord(n.text[i]) - ord('A') + ord('a')))
|
add(r, chr(ord(n.text[i]) - ord('A') + ord('a')))
|
||||||
|
of '$': special "dollar"
|
||||||
|
of '%': special "percent"
|
||||||
|
of '&': special "amp"
|
||||||
|
of '^': special "roof"
|
||||||
|
of '!': special "emark"
|
||||||
|
of '?': special "qmark"
|
||||||
|
of '*': special "star"
|
||||||
|
of '+': special "plus"
|
||||||
|
of '-': special "minus"
|
||||||
|
of '/': special "slash"
|
||||||
|
of '=': special "eq"
|
||||||
|
of '<': special "lt"
|
||||||
|
of '>': special "gt"
|
||||||
|
of '~': special "tilde"
|
||||||
|
of ':': special "colon"
|
||||||
|
of '.': special "dot"
|
||||||
|
of '@': special "at"
|
||||||
|
of '|': special "bar"
|
||||||
else:
|
else:
|
||||||
if (len(r) > 0): b = true
|
if len(r) > 0: b = true
|
||||||
else:
|
else:
|
||||||
for i in countup(0, len(n) - 1): rstnodeToRefnameAux(n.sons[i], r, b)
|
for i in countup(0, len(n) - 1): rstnodeToRefnameAux(n.sons[i], r, b)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue