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)
(needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype)
(needs sxml-transforms srfi-69 scss srfi-13 lowdown doctype posix)
;(test-depends test)

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

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

Loading…
Cancel
Save