(use awful irregex posix utils) (define wiki-dir "wiki") (create-directory wiki-dir 'recursively) (enable-sxml #t) (define-page (irregex "/[^/]*") (lambda (path) (with-request-variables ((edit (nonempty as-boolean)) (content (nonempty as-string))) (let ((wiki-file (make-pathname wiki-dir (if (equal? path "/") "index" path)))) (cond (edit `(form (@ (action ,path) (method post)) (textarea (@ (name "content")) ,(if (file-exists? wiki-file) (read-all wiki-file) "")) (input (@ (type "submit"))))) (content (with-output-to-file wiki-file (cut print content)) (redirect-to path)) (else (if (file-exists? wiki-file) `((pre ,(read-all wiki-file)) (a (@ (href ,(string-append path "?edit=1"))) "Edit")) (redirect-to (string-append path "?edit=1")))))))) method: '(get post))