mirror of https://github.com/python/cpython
bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file (GH-30768)
This commit is contained in:
parent
65b88d5e01
commit
57d1855682
|
@ -5,6 +5,7 @@ effect on some MBCS Windows systems.
|
||||||
https://bugs.python.org/issue32174
|
https://bugs.python.org/issue32174
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import pathlib
|
||||||
import re
|
import re
|
||||||
from html.entities import codepoint2name
|
from html.entities import codepoint2name
|
||||||
|
|
||||||
|
@ -39,12 +40,12 @@ def fixup_keywords(app, exception):
|
||||||
return
|
return
|
||||||
|
|
||||||
getLogger(__name__).info('fixing HTML escapes in keywords file...')
|
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
|
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()
|
index = f.read()
|
||||||
with app.builder.open_file(outdir, outname + '.hhk', 'w') as f:
|
with open(outdir / (outname + '.hhk'), 'wb') as f:
|
||||||
f.write(index.replace(''', '''))
|
f.write(index.replace(b''', b'''))
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
# `html-page-context` event emitted when the HTML builder has
|
# `html-page-context` event emitted when the HTML builder has
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fixes :file:`escape4chm.py` script used when building the CHM documentation
|
||||||
|
file
|
Loading…
Reference in New Issue