Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87a42cd

Browse files
committed
Add support for <platform>, some cleanup of module section after
creating the <moduleinfo>.
1 parent 49c7bc4 commit 87a42cd

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Doc/tools/sgmlconv/docfixer.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ def create_module_info(doc, section):
397397
modauthor.appendChild(doc.createTextNode(
398398
modauthor.getAttribute("name")))
399399
modauthor.removeAttribute("name")
400+
platform = extract_first_element(section, "platform")
400401
if section.tagName == "section":
401402
modinfo_pos = 2
402403
modinfo = doc.createElement("moduleinfo")
@@ -454,9 +455,28 @@ def create_module_info(doc, section):
454455
if modauthor:
455456
modinfo.appendChild(doc.createTextNode("\n "))
456457
modinfo.appendChild(modauthor)
458+
if platform:
459+
modinfo.appendChild(doc.createTextNode("\n "))
460+
modinfo.appendChild(platform)
457461
modinfo.appendChild(doc.createTextNode("\n "))
458462
section.insertBefore(modinfo, section.childNodes[modinfo_pos])
459463
section.insertBefore(doc.createTextNode("\n "), modinfo)
464+
#
465+
# The rest of this removes extra newlines from where we cut out
466+
# a lot of elements. A lot of code for minimal value, but keeps
467+
# keeps the generated SGML from being too funny looking.
468+
#
469+
section.normalize()
470+
children = section.childNodes
471+
for i in range(len(children)):
472+
node = children[i]
473+
if node.nodeType == xml.dom.core.ELEMENT \
474+
and node.tagName == "moduleinfo":
475+
nextnode = children[i+1]
476+
if nextnode.nodeType == xml.dom.core.TEXT:
477+
data = nextnode.data
478+
if len(string.lstrip(data)) < (len(data) - 4):
479+
nextnode.data = "\n\n\n" + string.lstrip(data)
460480

461481

462482
def cleanup_synopses(doc):

0 commit comments

Comments
 (0)