mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
Added a transform to start cleaning up the modulesynopsis stuff a
little; more thinking is needed about what we really want.
This commit is contained in:
parent
e9e05968e3
commit
fba0ba2a6f
1 changed files with 17 additions and 0 deletions
|
|
@ -227,6 +227,22 @@ def cleanup_trailing_parens(doc, element_names):
|
||||||
queue.append(child)
|
queue.append(child)
|
||||||
|
|
||||||
|
|
||||||
|
def cleanup_synopses(doc):
|
||||||
|
# Actually, this should build a "moduleinfo" element from various
|
||||||
|
# parts of the meta-information in the section. <moduleinfo> needs
|
||||||
|
# some design work before we can really do anything real.
|
||||||
|
synopses = doc.getElementsByTagName("modulesynopsis")
|
||||||
|
for node in synopses:
|
||||||
|
node._node.name = "synopsis"
|
||||||
|
parent = node.parentNode
|
||||||
|
if parent.tagName == "section":
|
||||||
|
children = parent.childNodes
|
||||||
|
parent.removeChild(node)
|
||||||
|
parent.insertBefore(node, children[2])
|
||||||
|
text = doc.createTextNode("\n ")
|
||||||
|
parent.insertBefore(text, node)
|
||||||
|
|
||||||
|
|
||||||
_token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$")
|
_token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$")
|
||||||
|
|
||||||
def write_esis(doc, ofp, knownempty):
|
def write_esis(doc, ofp, knownempty):
|
||||||
|
|
@ -275,6 +291,7 @@ def convert(ifp, ofp):
|
||||||
})
|
})
|
||||||
cleanup_root_text(doc)
|
cleanup_root_text(doc)
|
||||||
cleanup_trailing_parens(doc, ["function", "method", "cfunction"])
|
cleanup_trailing_parens(doc, ["function", "method", "cfunction"])
|
||||||
|
cleanup_synopses(doc)
|
||||||
#
|
#
|
||||||
d = {}
|
d = {}
|
||||||
for gi in p.get_empties():
|
for gi in p.get_empties():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue