Make it possible to call a function that post-processes the generated ReST doc for a class.

This commit is contained in:
Robin Dunn
2020-11-11 15:40:05 -08:00
parent e3dbe68b49
commit 7a839de248
4 changed files with 39 additions and 2 deletions

View File

@@ -561,7 +561,7 @@ header = """\
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
"""
@@ -861,3 +861,17 @@ def isPython3():
return sys.version_info >= (3, )
def textfile_open(filename, mode='rt'):
"""
Simple wrapper around open() that will use codecs.open on Python2 and
on Python3 will add the encoding parameter to the normal open(). The
mode parameter must include the 't' to put the stream into text mode.
"""
assert 't' in mode
if sys.version_info < (3,):
import codecs
mode = mode.replace('t', '')
return codecs.open(filename, mode, encoding='utf-8')
else:
return open(filename, mode, encoding='utf-8')