[cairo-commit] svgslides/src svgslides-4suite, 1.4, 1.5 svgslides-output.c, 1.2, 1.3

Carl Worth commit at pdx.freedesktop.org
Sun Apr 17 17:07:10 PDT 2005


Committed by: cworth

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

Modified Files:
	svgslides-4suite svgslides-output.c 
Log Message:
        * src/svgslides-output.c (svgslides_document_output_pdf):
        Eliminate unused variable data.

        * src/svgslides-4suite (title): Generate HTML output as well.


Index: svgslides-4suite
===================================================================
RCS file: /cvs/cairo/svgslides/src/svgslides-4suite,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- svgslides-4suite	13 Feb 2005 04:00:46 -0000	1.4
+++ svgslides-4suite	18 Apr 2005 00:07:08 -0000	1.5
@@ -30,8 +30,8 @@
 	u'svg': SVG
 }
 
-def slide_file_name (slide_num):
-    return basename+'-'+str(slide_num+1).zfill(3)+'.svg'
+def slide_file_name (slide_num, extension='.svg'):
+    return basename+'-'+str(slide_num+1).zfill(3)+extension
 
 # Some convenience functions to make this DOM stuff a touch less painful
 
@@ -89,6 +89,36 @@
 Dom.PrettyPrint (index_doc, file)
 file.close ()
 
+# Generate HTML output
+file = open ('index.html', 'w')
+title = do_xpath (slides_doc, u'//ss:slides/@title')[0].nodeValue
+print >> file, '<html>\n  <head>\n    <title>', 
+print >> file, title,
+print >> file, '</title>\n  </head>\n  <body>'
+print >> file, '<h1>',title,'</h1>'
+slide_num = 0
+for slide in slides:
+    print >> file, '    <p><a href="'+slide_file_name (slide_num, '.html')+'">'+get_attr (slide, 'title')+'</a>'
+    slide_num += 1
+print >> file, '  </body>\n</html>'
+file.close ()
+    
+slide_num = 0
+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, '</title>\n  </head>\n  <body>'
+    if slide_num > 0:
+        print >> file, '    <a href="'+slide_file_name (slide_num-1, '.html')+'">prev</a>'
+    if slide_num < len (slides) - 1:
+        print >> file, '    <a href="'+slide_file_name (slide_num+1, '.html')+'">next</a>'
+    print >> file, '    <a href="index.html">index</a>'
+    print >> file, '    <img src="'+slide_file_name (slide_num, '.png')+'">'
+    print >> file, '  </body>\n</html>'
+    file.close ()
+    slide_num += 1
+
 def slide_generate_svg_from_template (slide, theme, variant = None):
 
     def substitute_variable (variable):

Index: svgslides-output.c
===================================================================
RCS file: /cvs/cairo/svgslides/src/svgslides-output.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- svgslides-output.c	15 Feb 2005 19:48:59 -0000	1.2
+++ svgslides-output.c	18 Apr 2005 00:07:08 -0000	1.3
@@ -142,13 +142,10 @@
     cairo_t *cr;
     SVGSlidesSlide *slide;
     int i, width, height;
-    char *data;
 
     file = fopen (filename, "w");
     cr = cairo_create ();
 
-    data = malloc (100 * 100 * 4);
-
     cairo_set_target_pdf (cr, file, 11, 8.5, 300, 300);
 
     for (i = 0; i < document->slides->len; i++) {




More information about the cairo-commit mailing list