mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 12:41:10 +02:00
Make it possible to call a function that post-processes the generated ReST doc for a class.
This commit is contained in:
@@ -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')
|
||||
|
Reference in New Issue
Block a user