GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(ansible): double escape all escape characters · getstackhead/stackhead@0878c78

This repository was archived by the owner on Feb 26, 2024. It is now read-only.

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ansible/plugins/filter
    • terraform.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ansible/plugins/filter/terraform.py‎

Copy file name to clipboardExpand all lines: ansible/plugins/filter/terraform.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ def tf_escape_double_quotes(self, text):
3434
if not isinstance(text, str):
3535
return text
3636

37-
# duplicate existing escapes \" => \\", \\" => \\\\"
38-
double_quotes = re.compile(r"((\\+)\")")
39-
text = double_quotes.sub("\\2\\1", text)
40-
41-
# all double quotes have to be escaped with one backslashes again
42-
text = text.replace('"', '\\"')
37+
# duplicate existing escapes \ => \\, \" => \\", \\" => \\\\"
38+
# and prepend one additional escape \\ => \\\, \\\\" => \\\\\", " => \"
39+
text = re.compile(r"((\\*)\"|(\\+))").sub("\\\\\\3\\2\\1", text)
4340

4441
return text

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.