mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-15 17:20:07 +01:00
Simplify postprocessing, remove changes no longer needed, or edit them for Sphinx 2.2.0.
This commit is contained in:
@@ -56,6 +56,9 @@ def makeHeadings():
|
||||
rel_path = os.path.normpath(rel_path).replace('\\', '/')
|
||||
text += templates.TEMPLATE_HEADINGS % (name, rel_path, width)
|
||||
|
||||
# Add custom roles
|
||||
text += "\n.. role:: html(raw)\n :format: html\n\n"
|
||||
|
||||
writeIfChanged(heading_file, text)
|
||||
|
||||
# ----------------------------------------------------------------------- #
|
||||
@@ -68,7 +71,7 @@ def genIndexes(sphinxDir):
|
||||
main class index and some clean-up/maintenance of the generated ReST
|
||||
files.
|
||||
"""
|
||||
|
||||
print("Generating indexes...")
|
||||
pklfiles = glob.glob(sphinxDir + '/*.pkl')
|
||||
|
||||
for file in pklfiles:
|
||||
@@ -519,6 +522,7 @@ def makeModuleIndex(sphinxDir, file):
|
||||
# ----------------------------------------------------------------------- #
|
||||
|
||||
def genGallery():
|
||||
print("Generating gallery...")
|
||||
|
||||
link = '<div class="gallery_class">'
|
||||
|
||||
@@ -677,7 +681,6 @@ def postProcess(folder, options):
|
||||
enum_dict['(<em>%s</em>)'%enum] = new
|
||||
|
||||
for files in fileNames:
|
||||
|
||||
if "genindex" in files or "modindex" in files:
|
||||
continue
|
||||
|
||||
@@ -694,42 +697,32 @@ def postProcess(folder, options):
|
||||
else:
|
||||
text = text.replace('class="headerimage"', 'class="headerimage-noshow"')
|
||||
|
||||
text = text.replace('– <p>', '– ')
|
||||
text = text.replace('<p><img alt="overload"', '<br><p><img alt="overload"')
|
||||
text = text.replace('<strong>Overloaded Implementations</strong>', '<em><strong>Overloaded Implementations</strong></em>')
|
||||
text = text.replace('<strong>~~~</strong></p>', '<hr style="color:#0000FF;background-color:#0000FF;height:1px;border:none;width:50%;float:left" /></p><br>')
|
||||
|
||||
text = text.replace('<p><img alt="contributed"', '<br><p><img alt="contributed"')
|
||||
|
||||
text = text.replace('– <p>', '– ')
|
||||
text = text.replace('Overloaded Implementations:', '<strong>Overloaded Implementations:</strong>')
|
||||
for item in HTML_REPLACE:
|
||||
text = text.replace('<dl class="%s">'%item, '<br><hr />\n<dl class="%s">'%item)
|
||||
if item != 'class':
|
||||
text = text.replace('<dl class="%s">'%item, '\n<br><hr />\n<dl class="%s">'%item)
|
||||
|
||||
newtext = ''
|
||||
splitted_text = text.splitlines()
|
||||
len_split = len(splitted_text)
|
||||
|
||||
for index, line in enumerate(splitted_text):
|
||||
if '<div class="admonition-availability admonition' in line:
|
||||
line = '<div class="admonition-availability admonition availability">'
|
||||
|
||||
if index < len_split - 1:
|
||||
|
||||
if line.strip() == '<br><hr />' or line.strip() == '<dd><br><hr />':
|
||||
next_line = splitted_text[index+1]
|
||||
stripline = next_line.strip()
|
||||
|
||||
# repalce the <hr> with a new headline for the first method or first property
|
||||
if (stripline == '<dl class="staticmethod">' or stripline == '<dl class="method">' \
|
||||
or stripline == '<dl class="classmethod">') and not methods_done:
|
||||
line = '<br><h3>Methods<a class="headerlink" href="#methods" title="Permalink to this headline">¶</a></h3>' + '\n' + line
|
||||
line = '\n<br><h3>Methods<a class="headerlink" href="#methods" title="Permalink to this headline">¶</a></h3>\n'
|
||||
methods_done = True
|
||||
|
||||
elif stripline == '<dl class="attribute">' and not properties_done:
|
||||
line = '<br><h3>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h3>' + '\n' + line
|
||||
line = '\n<br><h3>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h3>\n'
|
||||
properties_done = True
|
||||
|
||||
if '<em> ' in line and '–' in line:
|
||||
line = line.replace('<em> ', '<em>')
|
||||
|
||||
newtext += line + '\n'
|
||||
|
||||
for old, new in list(enum_dict.items()):
|
||||
|
||||
Reference in New Issue
Block a user