diff options
author | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2021-06-14 00:00:37 +0000 |
commit | a73a964e51247ed169d322c725a3a18859f109a3 (patch) | |
tree | 3f752d117274d444bda44e85609aeac1acf313f3 /sys/src/cmd/python/Doc/lib/minidom-example.py | |
parent | e64efe273fcb921a61bf27d33b230c4e64fcd425 (diff) |
python, hg: tow outside the environment.
they've served us well, and can ride off into the sunset.
Diffstat (limited to 'sys/src/cmd/python/Doc/lib/minidom-example.py')
-rw-r--r-- | sys/src/cmd/python/Doc/lib/minidom-example.py | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/sys/src/cmd/python/Doc/lib/minidom-example.py b/sys/src/cmd/python/Doc/lib/minidom-example.py deleted file mode 100644 index c30c4e08a..000000000 --- a/sys/src/cmd/python/Doc/lib/minidom-example.py +++ /dev/null @@ -1,64 +0,0 @@ -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): - rc = "" - for node in nodelist: - if node.nodeType == node.TEXT_NODE: - rc = rc + node.data - return rc - -def handleSlideshow(slideshow): - print "<html>" - handleSlideshowTitle(slideshow.getElementsByTagName("title")[0]) - slides = slideshow.getElementsByTagName("slide") - handleToc(slides) - handleSlides(slides) - print "</html>" - -def handleSlides(slides): - for slide in slides: - handleSlide(slide) - -def handleSlide(slide): - handleSlideTitle(slide.getElementsByTagName("title")[0]) - handlePoints(slide.getElementsByTagName("point")) - -def handleSlideshowTitle(title): - print "<title>%s</title>" % getText(title.childNodes) - -def handleSlideTitle(title): - print "<h2>%s</h2>" % getText(title.childNodes) - -def handlePoints(points): - print "<ul>" - for point in points: - handlePoint(point) - print "</ul>" - -def handlePoint(point): - print "<li>%s</li>" % getText(point.childNodes) - -def handleToc(slides): - for slide in slides: - title = slide.getElementsByTagName("title")[0] - print "<p>%s</p>" % getText(title.childNodes) - -handleSlideshow(dom) |