@@ -570,6 +570,7 @@ def move_elements_by_name(doc, source, dest, name, sep=None):
570570
571571PARA_LEVEL_ELEMENTS = (
572572 "moduleinfo" , "title" , "verbatim" , "enumerate" , "item" ,
573+ "interpreter-session" ,
573574 "opcodedesc" , "classdesc" , "datadesc" ,
574575 "funcdesc" , "methoddesc" , "excdesc" ,
575576 "funcdescni" , "methoddescni" , "excdescni" ,
@@ -757,6 +758,15 @@ def fixup_sectionauthors(doc):
757758 section .insertBefore (sectauth , after )
758759
759760
761+ def fixup_verbatims (doc ):
762+ for verbatim in find_all_elements (doc , "verbatim" ):
763+ child = verbatim .childNodes [0 ]
764+ if child .nodeType == xml .dom .core .TEXT \
765+ and string .lstrip (child .data )[:3 ] == ">>>" :
766+ verbatim ._node .name = "interpreter-session"
767+ #verbatim.setAttribute("interactive", "interactive")
768+
769+
760770_token_rx = re .compile (r"[a-zA-Z][a-zA-Z0-9.-]*$" )
761771
762772def write_esis (doc , ofp , knownempty ):
@@ -806,6 +816,7 @@ def convert(ifp, ofp):
806816 cleanup_trailing_parens (doc , ["function" , "method" , "cfunction" ])
807817 cleanup_synopses (doc )
808818 fixup_descriptors (doc )
819+ fixup_verbatims (doc )
809820 normalize (doc )
810821 fixup_paras (doc )
811822 fixup_sectionauthors (doc )
0 commit comments