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

bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file #30768

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions Doc/tools/extensions/escape4chm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
https://bugs.python.org/issue32174
"""

import pathlib
import re
from html.entities import codepoint2name

Expand Down Expand Up @@ -39,12 +40,12 @@ def fixup_keywords(app, exception):
return

getLogger(__name__).info('fixing HTML escapes in keywords file...')
outdir = app.builder.outdir
outdir = pathlib.Path(app.builder.outdir)
outname = app.builder.config.htmlhelp_basename
with app.builder.open_file(outdir, outname + '.hhk', 'r') as f:
with open(outdir / (outname + '.hhk'), 'rb') as f:
index = f.read()
with app.builder.open_file(outdir, outname + '.hhk', 'w') as f:
f.write(index.replace(''', '''))
with open(outdir / (outname + '.hhk'), 'wb') as f:
f.write(index.replace(b''', b'''))

def setup(app):
# `html-page-context` event emitted when the HTML builder has
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixes :file:`escape4chm.py` script used when building the CHM documentation
file