diff options
author | Fred Drake <fdrake@acm.org> | 1999-03-11 17:35:12 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-03-11 17:35:12 (GMT) |
commit | 87a42cd61b9fddb558363392985e7decfa9abf11 (patch) | |
tree | a51cf46f31869b40a934cdcaa2666c0bb064b9e6 /Doc/tools/sgmlconv | |
parent | 49c7bc416e9e139a1af5aa9a5d98f77639609719 (diff) | |
download | cpython-87a42cd61b9fddb558363392985e7decfa9abf11.zip cpython-87a42cd61b9fddb558363392985e7decfa9abf11.tar.gz cpython-87a42cd61b9fddb558363392985e7decfa9abf11.tar.bz2 |
Add support for <platform>, some cleanup of module section after
creating the <moduleinfo>.
Diffstat (limited to 'Doc/tools/sgmlconv')
-rwxr-xr-x | Doc/tools/sgmlconv/docfixer.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Doc/tools/sgmlconv/docfixer.py b/Doc/tools/sgmlconv/docfixer.py index bee99fa..11c487d 100755 --- a/Doc/tools/sgmlconv/docfixer.py +++ b/Doc/tools/sgmlconv/docfixer.py @@ -397,6 +397,7 @@ def create_module_info(doc, section): modauthor.appendChild(doc.createTextNode( modauthor.getAttribute("name"))) modauthor.removeAttribute("name") + platform = extract_first_element(section, "platform") if section.tagName == "section": modinfo_pos = 2 modinfo = doc.createElement("moduleinfo") @@ -454,9 +455,28 @@ def create_module_info(doc, section): if modauthor: modinfo.appendChild(doc.createTextNode("\n ")) modinfo.appendChild(modauthor) + if platform: + modinfo.appendChild(doc.createTextNode("\n ")) + modinfo.appendChild(platform) modinfo.appendChild(doc.createTextNode("\n ")) section.insertBefore(modinfo, section.childNodes[modinfo_pos]) 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): |