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

(cherry picked from commit 57d1855682)

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2022-01-21 14:11:47 -08:00 committed by GitHub
parent 05063fa15c
commit d548c87171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -5,6 +5,7 @@ effect on some MBCS Windows systems.
https://bugs.python.org/issue32174
"""
import pathlib
import re
from html.entities import codepoint2name
@ -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('&#x27;', '&#39;'))
with open(outdir / (outname + '.hhk'), 'wb') as f:
f.write(index.replace(b'&#x27;', b'&#39;'))
def setup(app):
# `html-page-context` event emitted when the HTML builder has

View file

@ -0,0 +1,2 @@
Fixes :file:`escape4chm.py` script used when building the CHM documentation
file