Fix snip generator (#15501)

This commit is contained in:
Craig Box 2024-08-02 05:26:13 +12:00 committed by GitHub
parent c5a9cf7f11
commit af56db4727
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ with open(markdown, 'rt', encoding='utf-8') as mdfile:
if kind == "bash":
script = "\n%s() {\n" % id
else:
script = "\n! IFS=$'\\n' read -r -d '' %s <<\ENDSNIP\n" % id
script = "\n! IFS=$'\\n' read -r -d '' %s <<\\ENDSNIP\n" % id
current_snip = {"start": linenum, "id": id, "kind": kind, "indent": indent, "script": ["", script]}
snippets.append(current_snip)
continue
@ -165,7 +165,7 @@ with open(markdown, 'rt', encoding='utf-8') as mdfile:
elif not current_snip["script"][-1].endswith("\\\n"):
# command output
if not output_started:
current_snip["script"].append("}\n\n! IFS=$'\\n' read -r -d '' %s_out <<\ENDSNIP\n" % id)
current_snip["script"].append("}\n\n! IFS=$'\\n' read -r -d '' %s_out <<\\ENDSNIP\n" % id)
output_started = True
while True:
match = githubfile.match(line)