actually replace "$$" with "$"
This commit is contained in:
parent
f2eba715b4
commit
cff1a55fe6
1 changed files with 4 additions and 0 deletions
|
@ -136,11 +136,15 @@ def format_tokens(s: str, names: typing.List[str], sigil: str="$"
|
|||
tokens.append((i-1, "%s%s" % (sigil, name)))
|
||||
i += len(name)
|
||||
break
|
||||
else:
|
||||
tokens.append((i, "$"))
|
||||
i += 1
|
||||
return tokens
|
||||
|
||||
def format_token_replace(s: str, vars: typing.Dict[str, str],
|
||||
sigil: str="$") -> str:
|
||||
vars = vars.copy()
|
||||
vars.update({"": ""})
|
||||
tokens = format_tokens(s, list(vars.keys()), sigil)
|
||||
tokens.sort(key=lambda x: x[0])
|
||||
tokens.reverse()
|
||||
|
|
Loading…
Reference in a new issue