mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Add support for <platform>, some cleanup of module section after
creating the <moduleinfo>.
This commit is contained in:
parent
49c7bc416e
commit
87a42cd61b
1 changed files with 20 additions and 0 deletions
|
|
@ -397,6 +397,7 @@ def create_module_info(doc, section):
|
||||||
modauthor.appendChild(doc.createTextNode(
|
modauthor.appendChild(doc.createTextNode(
|
||||||
modauthor.getAttribute("name")))
|
modauthor.getAttribute("name")))
|
||||||
modauthor.removeAttribute("name")
|
modauthor.removeAttribute("name")
|
||||||
|
platform = extract_first_element(section, "platform")
|
||||||
if section.tagName == "section":
|
if section.tagName == "section":
|
||||||
modinfo_pos = 2
|
modinfo_pos = 2
|
||||||
modinfo = doc.createElement("moduleinfo")
|
modinfo = doc.createElement("moduleinfo")
|
||||||
|
|
@ -454,9 +455,28 @@ def create_module_info(doc, section):
|
||||||
if modauthor:
|
if modauthor:
|
||||||
modinfo.appendChild(doc.createTextNode("\n "))
|
modinfo.appendChild(doc.createTextNode("\n "))
|
||||||
modinfo.appendChild(modauthor)
|
modinfo.appendChild(modauthor)
|
||||||
|
if platform:
|
||||||
|
modinfo.appendChild(doc.createTextNode("\n "))
|
||||||
|
modinfo.appendChild(platform)
|
||||||
modinfo.appendChild(doc.createTextNode("\n "))
|
modinfo.appendChild(doc.createTextNode("\n "))
|
||||||
section.insertBefore(modinfo, section.childNodes[modinfo_pos])
|
section.insertBefore(modinfo, section.childNodes[modinfo_pos])
|
||||||
section.insertBefore(doc.createTextNode("\n "), modinfo)
|
section.insertBefore(doc.createTextNode("\n "), modinfo)
|
||||||
|
#
|
||||||
|
# The rest of this removes extra newlines from where we cut out
|
||||||
|
# a lot of elements. A lot of code for minimal value, but keeps
|
||||||
|
# keeps the generated SGML from being too funny looking.
|
||||||
|
#
|
||||||
|
section.normalize()
|
||||||
|
children = section.childNodes
|
||||||
|
for i in range(len(children)):
|
||||||
|
node = children[i]
|
||||||
|
if node.nodeType == xml.dom.core.ELEMENT \
|
||||||
|
and node.tagName == "moduleinfo":
|
||||||
|
nextnode = children[i+1]
|
||||||
|
if nextnode.nodeType == xml.dom.core.TEXT:
|
||||||
|
data = nextnode.data
|
||||||
|
if len(string.lstrip(data)) < (len(data) - 4):
|
||||||
|
nextnode.data = "\n\n\n" + string.lstrip(data)
|
||||||
|
|
||||||
|
|
||||||
def cleanup_synopses(doc):
|
def cleanup_synopses(doc):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue