create_module_info(): If there's a \moduleauthor, move it to an
<author> inside the <moduleinfo> element.
Fix problems with paragraph identification.
diff --git a/Doc/tools/sgmlconv/docfixer.py b/Doc/tools/sgmlconv/docfixer.py
index 985195f..9628e30 100755
--- a/Doc/tools/sgmlconv/docfixer.py
+++ b/Doc/tools/sgmlconv/docfixer.py
@@ -270,6 +270,12 @@
if lastchild.nodeType == xml.dom.core.TEXT \
and lastchild.data[-1:] == ".":
lastchild.data = lastchild.data[:-1]
+ modauthor = extract_first_element(section, "moduleauthor")
+ if modauthor:
+ modauthor._node.name = "author"
+ modauthor.appendChild(doc.createTextNode(
+ modauthor.getAttribute("name")))
+ modauthor.removeAttribute("name")
if section.tagName == "section":
modinfo_pos = 2
modinfo = doc.createElement("moduleinfo")
@@ -320,6 +326,9 @@
# and needs to be stored:
modinfo.appendChild(doc.createTextNode("\n "))
modinfo.appendChild(title)
+ if modauthor:
+ modinfo.appendChild(doc.createTextNode("\n "))
+ modinfo.appendChild(modauthor)
modinfo.appendChild(doc.createTextNode("\n "))
section.insertBefore(modinfo, section.childNodes[modinfo_pos])
section.insertBefore(doc.createTextNode("\n "), modinfo)
@@ -434,11 +443,16 @@
FIXUP_PARA_ELEMENTS = (
"chapter",
"section", "subsection", "subsubsection",
- "paragraph", "subparagraph")
+ "paragraph", "subparagraph", "description",
+ "opcodedesc", "classdesc",
+ "funcdesc", "methoddesc", "excdesc", "datadesc",
+ "funcdescni", "methoddescni", "excdescni", "datadescni",
+ )
PARA_LEVEL_ELEMENTS = (
- "moduleinfo", "title", "opcodedesc",
- "verbatim", "funcdesc", "methoddesc", "excdesc", "datadesc",
+ "moduleinfo", "title", "verbatim",
+ "opcodedesc", "classdesc",
+ "funcdesc", "methoddesc", "excdesc", "datadesc",
"funcdescni", "methoddescni", "excdescni", "datadescni",
"tableii", "tableiii", "tableiv", "localmoduletable",
"sectionauthor",
@@ -468,24 +482,8 @@
children = container.childNodes
start = 0
start_fixed = 0
- i = 0
+ i = len(children)
SKIP_ELEMENTS = PARA_LEVEL_ELEMENTS + PARA_LEVEL_PRECEEDERS
- for child in children:
- if child.nodeType == xml.dom.core.ELEMENT:
- if child.tagName in FIXUP_PARA_ELEMENTS:
- fixup_paras_helper(doc, child)
- break
- elif child.tagName in SKIP_ELEMENTS:
- if not start_fixed:
- start = i + 1
- elif not start_fixed:
- start_fixed = 1
- i = i + 1
- else:
- if child.nodeType == xml.dom.core.TEXT \
- and string.strip(child.data) and not start_fixed:
- start_fixed = 1
- i = i + 1
if DEBUG_PARA_FIXER:
sys.stderr.write("fixup_paras_helper() called on <%s>; %d, %d\n"
% (container.tagName, start, i))