| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | import xml.dom.minidom | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | document = """\
 | 
					
						
							|  |  |  | <slideshow> | 
					
						
							|  |  |  | <title>Demo slideshow</title> | 
					
						
							|  |  |  | <slide><title>Slide title</title> | 
					
						
							|  |  |  | <point>This is a demo</point> | 
					
						
							|  |  |  | <point>Of a program for processing slides</point> | 
					
						
							|  |  |  | </slide> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <slide><title>Another demo slide</title> | 
					
						
							|  |  |  | <point>It is important</point> | 
					
						
							|  |  |  | <point>To have more than</point> | 
					
						
							|  |  |  | <point>one slide</point> | 
					
						
							|  |  |  | </slide> | 
					
						
							|  |  |  | </slideshow> | 
					
						
							|  |  |  | """
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | dom = xml.dom.minidom.parseString(document) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def getText(nodelist): | 
					
						
							| 
									
										
											  
											
												Merged revisions 78338,78345-78346,78561-78562,78566,78574,78581,78634,78660,78675 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r78338 | andrew.kuchling | 2010-02-22 15:04:02 -0600 (Mon, 22 Feb 2010) | 4 lines
  Remove Tools/modulator, a reference to it in the docs, and a screenshot of it.
  (I asked the BDFL first, and he approved removing it.  The last actual bugfix
  to Tools/modulator was in 2001; since then all changes have been search-and-replace:
  string methods, whitespace fixes, etc.)
........
  r78345 | andrew.kuchling | 2010-02-22 17:10:52 -0600 (Mon, 22 Feb 2010) | 1 line
  #7706: DONT_HAVE_ERRNO_H is no longer defined by configure (after rev.46819).
........
  r78346 | andrew.kuchling | 2010-02-22 17:12:00 -0600 (Mon, 22 Feb 2010) | 1 line
  #7706: add include guards where they're missing; required for Windows CE
........
  r78561 | andrew.kuchling | 2010-03-01 13:51:43 -0600 (Mon, 01 Mar 2010) | 1 line
  #7191: describe more details of wbits parameter
........
  r78562 | andrew.kuchling | 2010-03-01 14:11:57 -0600 (Mon, 01 Mar 2010) | 1 line
  #7637: avoid repeated-concatenation antipattern in example
........
  r78566 | barry.warsaw | 2010-03-01 15:46:51 -0600 (Mon, 01 Mar 2010) | 4 lines
  Manually copy patch for bug 7250 from the release26-maint branch.  I suck
  because I did this in the wrong order and couldn't smack svnmerge into
  submission.
........
  r78574 | benjamin.peterson | 2010-03-01 17:25:13 -0600 (Mon, 01 Mar 2010) | 1 line
  remove CVS id
........
  r78581 | michael.foord | 2010-03-02 08:22:15 -0600 (Tue, 02 Mar 2010) | 1 line
  Link correction in documentation.
........
  r78634 | benjamin.peterson | 2010-03-03 15:28:25 -0600 (Wed, 03 Mar 2010) | 1 line
  rephrase
........
  r78660 | dirkjan.ochtman | 2010-03-04 13:21:53 -0600 (Thu, 04 Mar 2010) | 4 lines
  Try to fix buildbot breakage from r78384.
  Thanks bitdancer and briancurtin for the help.
........
  r78675 | florent.xicluna | 2010-03-04 19:12:14 -0600 (Thu, 04 Mar 2010) | 2 lines
  These line should not be there.
........
											
										 
											2010-03-21 22:36:19 +00:00
										 |  |  |     rc = [] | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     for node in nodelist: | 
					
						
							|  |  |  |         if node.nodeType == node.TEXT_NODE: | 
					
						
							| 
									
										
											  
											
												Merged revisions 78338,78345-78346,78561-78562,78566,78574,78581,78634,78660,78675 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
  r78338 | andrew.kuchling | 2010-02-22 15:04:02 -0600 (Mon, 22 Feb 2010) | 4 lines
  Remove Tools/modulator, a reference to it in the docs, and a screenshot of it.
  (I asked the BDFL first, and he approved removing it.  The last actual bugfix
  to Tools/modulator was in 2001; since then all changes have been search-and-replace:
  string methods, whitespace fixes, etc.)
........
  r78345 | andrew.kuchling | 2010-02-22 17:10:52 -0600 (Mon, 22 Feb 2010) | 1 line
  #7706: DONT_HAVE_ERRNO_H is no longer defined by configure (after rev.46819).
........
  r78346 | andrew.kuchling | 2010-02-22 17:12:00 -0600 (Mon, 22 Feb 2010) | 1 line
  #7706: add include guards where they're missing; required for Windows CE
........
  r78561 | andrew.kuchling | 2010-03-01 13:51:43 -0600 (Mon, 01 Mar 2010) | 1 line
  #7191: describe more details of wbits parameter
........
  r78562 | andrew.kuchling | 2010-03-01 14:11:57 -0600 (Mon, 01 Mar 2010) | 1 line
  #7637: avoid repeated-concatenation antipattern in example
........
  r78566 | barry.warsaw | 2010-03-01 15:46:51 -0600 (Mon, 01 Mar 2010) | 4 lines
  Manually copy patch for bug 7250 from the release26-maint branch.  I suck
  because I did this in the wrong order and couldn't smack svnmerge into
  submission.
........
  r78574 | benjamin.peterson | 2010-03-01 17:25:13 -0600 (Mon, 01 Mar 2010) | 1 line
  remove CVS id
........
  r78581 | michael.foord | 2010-03-02 08:22:15 -0600 (Tue, 02 Mar 2010) | 1 line
  Link correction in documentation.
........
  r78634 | benjamin.peterson | 2010-03-03 15:28:25 -0600 (Wed, 03 Mar 2010) | 1 line
  rephrase
........
  r78660 | dirkjan.ochtman | 2010-03-04 13:21:53 -0600 (Thu, 04 Mar 2010) | 4 lines
  Try to fix buildbot breakage from r78384.
  Thanks bitdancer and briancurtin for the help.
........
  r78675 | florent.xicluna | 2010-03-04 19:12:14 -0600 (Thu, 04 Mar 2010) | 2 lines
  These line should not be there.
........
											
										 
											2010-03-21 22:36:19 +00:00
										 |  |  |             rc.append(node.data) | 
					
						
							|  |  |  |     return ''.join(rc) | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handleSlideshow(slideshow): | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("<html>") | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     handleSlideshowTitle(slideshow.getElementsByTagName("title")[0]) | 
					
						
							|  |  |  |     slides = slideshow.getElementsByTagName("slide") | 
					
						
							|  |  |  |     handleToc(slides) | 
					
						
							|  |  |  |     handleSlides(slides) | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("</html>") | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handleSlides(slides): | 
					
						
							|  |  |  |     for slide in slides: | 
					
						
							|  |  |  |         handleSlide(slide) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def handleSlide(slide): | 
					
						
							|  |  |  |     handleSlideTitle(slide.getElementsByTagName("title")[0]) | 
					
						
							|  |  |  |     handlePoints(slide.getElementsByTagName("point")) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def handleSlideshowTitle(title): | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("<title>%s</title>" % getText(title.childNodes)) | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handleSlideTitle(title): | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("<h2>%s</h2>" % getText(title.childNodes)) | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handlePoints(points): | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("<ul>") | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  |     for point in points: | 
					
						
							|  |  |  |         handlePoint(point) | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("</ul>") | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handlePoint(point): | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |     print("<li>%s</li>" % getText(point.childNodes)) | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | def handleToc(slides): | 
					
						
							|  |  |  |     for slide in slides: | 
					
						
							|  |  |  |         title = slide.getElementsByTagName("title")[0] | 
					
						
							| 
									
										
										
										
											2007-08-30 18:50:25 +00:00
										 |  |  |         print("<p>%s</p>" % getText(title.childNodes)) | 
					
						
							| 
									
										
										
										
											2007-08-15 14:28:22 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | handleSlideshow(dom) |