First version that works with thintz.com.

master 0.1.0
Thomas Hintz 11 years ago
parent 10fa6e3c2e
commit b766f4ae07

@ -1,7 +1,7 @@
( (
(category web) (category web)
(needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype) (needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype posix)
;(test-depends test) ;(test-depends test)

@ -15,8 +15,8 @@
compile compile
) )
(import chicken scheme files srfi-1 extras ports) (import chicken scheme files srfi-1 extras ports irregex)
(use sxml-transforms srfi-69 scss srfi-13 lowdown doctype) (use sxml-transforms srfi-69 scss srfi-13 lowdown doctype posix)
(define *pages* (make-hash-table)) (define *pages* (make-hash-table))
(define *stylesheets* (make-hash-table)) (define *stylesheets* (make-hash-table))
@ -25,7 +25,7 @@
(define src-dir (make-parameter "src")) (define src-dir (make-parameter "src"))
(define out-dir (make-parameter "out")) (define out-dir (make-parameter "out"))
(define res-dir (make-parameter "res")) (define res-dir (make-parameter "res"))
(define link-root (make-parameter "/home")) (define link-root (make-parameter ""))
(define doctype (make-parameter doctype-html)) (define doctype (make-parameter doctype-html))
(define ++ string-append) (define ++ string-append)
@ -76,31 +76,42 @@
(hash-table-delete! *stylesheets* path)) (hash-table-delete! *stylesheets* path))
(define (add-file-resource! path) (define (add-file-resource! path)
(cons path *file-resources*)) (set! *file-resources* (cons path *file-resources*)))
(define (delete-file-resource! path) (define (delete-file-resource! path)
(remove (lambda (p) (equal? p path)) *file-resources*)) (set! *file-resources* (remove (lambda (p) (equal? p path)) *file-resources*)))
(define (create-dirs path)
(create-directory (pathname-directory path) #t))
(define (output-pages) (define (output-pages)
(hash-table-for-each (hash-table-for-each
*pages* *pages*
(lambda (k v) (lambda (k v)
(with-output-to-file (++ (out-dir) "/" k) (let ((p (++ (out-dir) "/" k)))
(lambda () (print (doctype) (sxml->html v))))))) (create-dirs p)
(with-output-to-file p
(lambda () (print (doctype) (sxml->html v))))))))
(define (output-stylesheets) (define (output-stylesheets)
(hash-table-for-each (hash-table-for-each
*stylesheets* *stylesheets*
(lambda (k v) (lambda (k v)
(with-output-to-file (++ (out-dir) "/" k) (let ((p (++ (out-dir) "/" k)))
(lambda () (scss->css v)))))) (create-dirs p)
(with-output-to-file p
(lambda () (scss->css v)))))))
(define (copy-file-resources) (define (copy-file-resources)
(for-each (lambda (p) (for-each
(file-copy (++ (res-dir) "/" p) (++ (out-dir) "/" p))) (lambda (p)
(let ((path-out (++ (out-dir) "/" p)))
(create-dirs path-out)
(file-copy (++ (res-dir) "/" p) path-out)))
*file-resources*)) *file-resources*))
(define (compile) (define (compile)
(and (directory? (out-dir)) (delete-directory (out-dir) #t))
(output-pages) (output-pages)
(output-stylesheets) (output-stylesheets)
(copy-file-resources)) (copy-file-resources))

@ -1,5 +1,5 @@
(compile -s -O2 -d1 alley-cat.scm -j alley-cat) (compile -s -O2 -d2 alley-cat.scm -j alley-cat)
(compile -s alley-cat.import.scm -O2 -d0) (compile -s alley-cat.import.scm -O2 -d2)
(install-extension (install-extension
;; Name of your extension: ;; Name of your extension:

Loading…
Cancel
Save