Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI:DOCS] Preprocess files in UTF-8 mode #17015

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions hack/markdown-preprocess
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Preprocessor():
outfile = os.path.splitext(infile)[0]
outfile_tmp = outfile + '.tmp.' + str(os.getpid())

with open(infile, 'r') as fh_in, open(outfile_tmp, 'w') as fh_out:
with open(infile, 'r', encoding='utf-8') as fh_in, open(outfile_tmp, 'w', encoding='utf-8') as fh_out:
for line in fh_in:
# '@@option foo' -> include file options/foo.md
if line.startswith('@@option '):
Expand Down Expand Up @@ -71,7 +71,7 @@ class Preprocessor():
"""
for optionfile in self.used_by:
tmpfile = optionfile + '.tmp'
with open(optionfile, 'r') as fh_in, open(tmpfile, 'w') as fh_out:
with open(optionfile, 'r', encoding='utf-8') as fh_in, open(tmpfile, 'w', encoding='utf-8') as fh_out:
fh_out.write("####> This option file is used in:\n")
used_by = ', '.join(x for x in self.used_by[optionfile])
fh_out.write(f"####> podman {used_by}\n")
Expand All @@ -96,7 +96,7 @@ class Preprocessor():
# treats them as one line and will unwantedly render the
# comment in its output.
fh_out.write("\n[//]: # (BEGIN included file " + path + ")\n")
with open(path, 'r') as fh_included:
with open(path, 'r', encoding='utf-8') as fh_included:
for opt_line in fh_included:
if opt_line.startswith('####>'):
continue
Expand Down