Fix: bad escape \P at position 374 (line 18, column 23) when using th… (#7909)
…e graph feature (#1727) ### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
243ed4bc35
commit
1239f5afc8
1 changed files with 4 additions and 1 deletions
|
|
@ -119,7 +119,10 @@ class Template(ComponentBase):
|
|||
v = json.dumps(v, ensure_ascii=False)
|
||||
except Exception:
|
||||
pass
|
||||
content = re.sub(r"\{%s\}" % re.escape(n), v, content)
|
||||
# Process backslashes in strings, Use Lambda function to avoid escape issues
|
||||
if isinstance(v, str):
|
||||
v = v.replace("\\", "\\\\")
|
||||
content = re.sub(r"\{%s\}" % re.escape(n), lambda match: v, content)
|
||||
content = re.sub(r"(#+)", r" \1 ", content)
|
||||
|
||||
return Template.be_output(content)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue