@@ -132,33 +132,38 @@ (define (ods:sheet sheetdat) (let ((name (car sheetdat)) (rows (cdr sheetdat))) (conc "\n" (conc (ods:column) - (apply conc (map ods:row rows))) + (string-join (map ods:row rows) "")) ""))) ;; seems to be called once at top of each sheet, i.e. a column of rows (define (ods:column) "\n") ;; cells is a list of ... (define (ods:row cells) - (apply conc - (cons "\n" - (append (map ods:cell cells) - (list "\n"))))) + (conc "\n" + (string-join (map ods:cell cells) "") + "\n")) ;; types are "string" or "float" (define (ods:cell value) - (let ((type (cond + (let* ((type (cond ((string? value) "string") ((symbol? value) "string") ((number? value) "float") - (else "string")))) - (conc "" "\n" - "" value "" "\n" + (else #f))) + (tmpval (if (symbol? value) + (symbol->string value) + (if type value ""))) ;; convert everything else to an empty string + (escval (if (string? tmpval)(string-substitute (regexp "<") "<" (string-substitute (regexp ">") ">" tmpval)) tmpval))) + (conc "\n" + "" escval "" "\n" "" "\n"))) ;; create the directories (define (ods:construct-dir path) (for-each @@ -203,7 +208,7 @@ (map display ods:content-header) ;; process each sheet (map print (map ods:sheet data)) (map display ods:content-footer))) - (system (conc "cd " path "; zip " fname " -n mimetype mimetype `find . |grep -v mimetype`"))))) + (system (conc "cd " path "; zip " fname " -n mimetype mimetype `find . |grep -v mimetype` > /dev/null")))))