mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Mark <verbatim> elements that represent interactive sessions; these
become <interpreter-session> elements.
This commit is contained in:
		
							parent
							
								
									997eec7cca
								
							
						
					
					
						commit
						93d762fc7a
					
				
					 1 changed files with 11 additions and 0 deletions
				
			
		|  | @ -570,6 +570,7 @@ def move_elements_by_name(doc, source, dest, name, sep=None): | |||
| 
 | ||||
| PARA_LEVEL_ELEMENTS = ( | ||||
|     "moduleinfo", "title", "verbatim", "enumerate", "item", | ||||
|     "interpreter-session", | ||||
|     "opcodedesc", "classdesc", "datadesc", | ||||
|     "funcdesc", "methoddesc", "excdesc", | ||||
|     "funcdescni", "methoddescni", "excdescni", | ||||
|  | @ -757,6 +758,15 @@ def fixup_sectionauthors(doc): | |||
|         section.insertBefore(sectauth, after) | ||||
| 
 | ||||
| 
 | ||||
| def fixup_verbatims(doc): | ||||
|     for verbatim in find_all_elements(doc, "verbatim"): | ||||
|         child = verbatim.childNodes[0] | ||||
|         if child.nodeType == xml.dom.core.TEXT \ | ||||
|            and string.lstrip(child.data)[:3] == ">>>": | ||||
|             verbatim._node.name = "interpreter-session" | ||||
|             #verbatim.setAttribute("interactive", "interactive") | ||||
| 
 | ||||
| 
 | ||||
| _token_rx = re.compile(r"[a-zA-Z][a-zA-Z0-9.-]*$") | ||||
| 
 | ||||
| def write_esis(doc, ofp, knownempty): | ||||
|  | @ -806,6 +816,7 @@ def convert(ifp, ofp): | |||
|     cleanup_trailing_parens(doc, ["function", "method", "cfunction"]) | ||||
|     cleanup_synopses(doc) | ||||
|     fixup_descriptors(doc) | ||||
|     fixup_verbatims(doc) | ||||
|     normalize(doc) | ||||
|     fixup_paras(doc) | ||||
|     fixup_sectionauthors(doc) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fred Drake
						Fred Drake