From 58d56dc9dae201d89a4911e125099f1f41780eab Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sat, 5 Dec 2020 22:51:37 +0100 Subject: First version of the website --- add_books | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 add_books (limited to 'add_books') diff --git a/add_books b/add_books new file mode 100755 index 0000000..9c38ec0 --- /dev/null +++ b/add_books @@ -0,0 +1,41 @@ +#| +#!/usr/bin/env sh +exec chibi-scheme -A `dirname $0` $0 $@ +|# + +(import + (scheme base) + (srfi 1) + (chibi) + (chibi filesystem) + (chibi io) + (chibi pathname) + (chibi sxml)) + +(define outdir "www") +(define bookdir "../books/out/") +(define valid '("book-simple.pdf" "web.html" "web-simple.html" "cover.png")) + +(define (copy-books) + "Copy books" + (directory-fold-tree + bookdir + #f + #f + (lambda (file acc) + (let ((output (make-path outdir "books" (path-relative-to file bookdir)))) + (if (member (path-strip-directory file) valid) + (begin + (display "Loading: ") + (display file) + (display " to:") + (display output) + (newline) + (create-directory* (path-directory output)) + (call-with-output-file output + (lambda (x) + (send-file file x))))))) + #\null)) + + +(copy-books) -- cgit v1.2.3