diff options
author | Fred Drake <fdrake@acm.org> | 2001-09-27 16:52:22 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-09-27 16:52:22 (GMT) |
commit | 9213b7a96115ccabfcc744deb05cbbdc3fcdc941 (patch) | |
tree | e7403539be1e1930a059fb83233c3e95bacd093e /Doc/tools | |
parent | 5a28bfbbc7707b6820b3ecf31589d04ee9120da5 (diff) | |
download | cpython-9213b7a96115ccabfcc744deb05cbbdc3fcdc941.zip cpython-9213b7a96115ccabfcc744deb05cbbdc3fcdc941.tar.gz cpython-9213b7a96115ccabfcc744deb05cbbdc3fcdc941.tar.bz2 |
Re-write <ulink> elements as described in the conversion spec.
Diffstat (limited to 'Doc/tools')
-rwxr-xr-x | Doc/tools/sgmlconv/docfixer.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/tools/sgmlconv/docfixer.py b/Doc/tools/sgmlconv/docfixer.py index c1ea970..fd58979 100755 --- a/Doc/tools/sgmlconv/docfixer.py +++ b/Doc/tools/sgmlconv/docfixer.py @@ -810,6 +810,24 @@ def add_node_ids(fragment, counter=0): return counter + 1 +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') @@ -976,6 +994,7 @@ def convert(ifp, ofp): fixup_table_structures(doc, fragment) fixup_rfc_references(doc, fragment) fixup_signatures(doc, fragment) + fixup_ulink(doc, fragment) add_node_ids(fragment) fixup_refmodindexes(fragment) fixup_bifuncindexes(fragment) |