From ee8262b21ce6da8f861811228054917d8023df15 Mon Sep 17 00:00:00 2001 From: tux Date: Wed, 22 Nov 2023 15:13:41 +0100 Subject: [PATCH] TOC to CSV --- book_include.ly | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/book_include.ly b/book_include.ly index 13c98da..42eeda6 100644 --- a/book_include.ly +++ b/book_include.ly @@ -214,6 +214,28 @@ songs = ) "\n" ) ))) +#(define (writeTOCtoCSV) + (let ((song-lines (map (lambda (song) + (list + (symbol->string (car song)) + )) + (alist-delete 'imagePage (alist-delete 'emptyPage song-list))))) + (call-with-output-file "toc.csv" + (lambda (port) + (csv-write (cons '("filename") song-lines) port)) +))) + +%% https://github.com/NalaGinrut/guile-csv/blob/master/csv/csv.scm + +#(define* (sxml->csv sxml port #:key (delimiter #\,)) + (let* ((d (string delimiter)) + (csv (map (lambda (l) (string-join l d)) sxml))) + (for-each (lambda (l) + (format port "~a~%" l)) + csv))) + +#(define csv-write sxml->csv) + %%%%%%%%%%%%%%%%%%%%%%%%%%% %% Include Images once and reference them: #(define bbox-regexp