[Python-checkins] CVS: python/dist/src/Doc/tools/sgmlconv docfixer.py,1.30,1.31
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 27 Sep 2001 09:52:25 -0700
Update of /cvsroot/python/python/dist/src/Doc/tools/sgmlconv
In directory usw-pr-cvs1:/tmp/cvs-serv13507/tools/sgmlconv
Modified Files:
docfixer.py
Log Message:
Re-write <ulink> elements as described in the conversion spec.
Index: docfixer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/sgmlconv/docfixer.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** docfixer.py 2001/09/27 15:49:23 1.30
--- docfixer.py 2001/09/27 16:52:22 1.31
***************
*** 811,814 ****
--- 811,832 ----
+ def fixup_ulink(doc, fragment):
+ for ulink in find_all_elements(fragment, "ulink"):
+ children = ulink.childNodes
+ assert len(children) == 2
+ text = children[0]
+ href = children[1]
+ href.normalize()
+ assert len(href.childNodes) == 1
+ assert href.childNodes[0].nodeType == TEXT
+ url = href.childNodes[0].data
+ ulink.setAttribute("href", url)
+ ulink.removeChild(href)
+ content = text.childNodes
+ while len(content):
+ ulink.appendChild(content[0])
+ ulink.removeChild(text)
+
+
REFMODINDEX_ELEMENTS = ('refmodindex', 'refbimodindex',
'refexmodindex', 'refstmodindex')
***************
*** 977,980 ****
--- 995,999 ----
fixup_rfc_references(doc, fragment)
fixup_signatures(doc, fragment)
+ fixup_ulink(doc, fragment)
add_node_ids(fragment)
fixup_refmodindexes(fragment)