Skip to content

Commit

Permalink
bpo-46463: Fixes escape4chm.py script used when building the CHM docu…
Browse files Browse the repository at this point in the history
…mentation file (GH-30768)

(cherry picked from commit 57d1855)

Co-authored-by: Steve Dower <[email protected]>
  • Loading branch information
miss-islington and zooba authored Jan 21, 2022
1 parent 9e3ff82 commit b37f3e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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('&#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
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

0 comments on commit b37f3e9

Please sign in to comment.