@@ -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
462482def cleanup_synopses (doc ):
0 commit comments