[cairo-commit] svgslides/src svgslides-4suite,1.10,1.11

Carl Worth commit at pdx.freedesktop.org
Tue Jul 12 09:12:39 PDT 2005


Committed by: cworth

Update of /cvs/cairo/svgslides/src
In directory gabe:/tmp/cvs-serv3413/src

Modified Files:
	svgslides-4suite 
Log Message:

        * src/svgslides-4suite: Add a hack to allow titles to contain
        utf-8 characters.

        * test/test.xml: Add a slide to test utf-8 characters in title and
        body.


Index: svgslides-4suite
===================================================================
RCS file: /cvs/cairo/svgslides/src/svgslides-4suite,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- svgslides-4suite	12 Jul 2005 04:40:33 -0000	1.10
+++ svgslides-4suite	12 Jul 2005 16:12:37 -0000	1.11
@@ -131,9 +131,13 @@
 print >> file, presentation,
 print >> file, '</title>\n  </head>\n  <body>'
 print >> file, '<h1>',presentation,'</h1>'
+
+# XXX: The manual calls to encode here are really annoying. What's the
+# python way to make a file object that automatically encodes all
+# unicode characters to utf-8?
 slide_num = 0
 for slide in slides:
-    print >> file, '    <p><a href="'+slide_file_name (slide_num, '.html')+'">'+get_attr (slide, 'title')+'</a>'
+    print >> file, '    <p><a href="'+slide_file_name (slide_num, '.html')+'">'+get_attr (slide, 'title').encode('utf-8')+'</a>'
     slide_num += 1
 print >> file, '  </body>\n</html>'
 file.close ()
@@ -142,7 +146,7 @@
 for slide in slides:
     file = open (slide_file_name (slide_num, '.html'), 'w')
     print >> file, '<html>\n  <head>\n    <title>', 
-    print >> file, get_attr (slide, 'title'), 
+    print >> file, get_attr (slide, 'title').encode('utf-8')
     print >> file, '</title>\n  </head>\n  <body>'
     if slide_num > 0:
         print >> file, '    <a href="'+slide_file_name (slide_num-1, '.html')+'">prev</a>'




More information about the cairo-commit mailing list