diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-11 22:06:37 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-11 22:06:37 +0100 |
| commit | ea7c2a7482b937c4d391402b7a89fb7b9c245992 (patch) | |
| tree | 562bbf42559cac18d0c566dcd77c64fbfcf36523 /temper.lisp | |
| parent | d3c3ae47a2937bf0ace994a4bc9928cd2f3605de (diff) | |
| download | temper-ea7c2a7482b937c4d391402b7a89fb7b9c245992.tar.gz temper-ea7c2a7482b937c4d391402b7a89fb7b9c245992.tar.bz2 temper-ea7c2a7482b937c4d391402b7a89fb7b9c245992.zip | |
Diffstat (limited to 'temper.lisp')
| -rwxr-xr-x | temper.lisp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/temper.lisp b/temper.lisp index 9f5350c..36732d2 100755 --- a/temper.lisp +++ b/temper.lisp @@ -1,5 +1,7 @@ #!/usr/bin/clisp +(load "/home/charles/.clisprc.lisp") +(ql:quickload "uiop") (load "helper.lisp") (load "config.lisp") (load "builtin.lisp") @@ -60,16 +62,28 @@ ")")))))) -(defun render-stream (stream &rest args) - (setq tokens (lex (read-all-stream stream))) - (eval (apply #'generate (cons tokens args)))) +(defgeneric render (input &rest args)) -(defun render (filename &rest args) - (with-open-file (stream filename) - (apply #'render-stream (cons stream args)))) +(defmethod render ((input stream) &rest args) + (prog1 + (eval (apply #'generate (cons (lex (read-all-stream input)) args))) + (setf *temper-buf* ""))) -(princ (render-stream *standard-input* 'foo "bon" 'bar "jour")) +(defmethod render ((filename string) &rest args) + (with-open-file (input filename) + (apply #'render (cons input args)))) -; (princ (render "test.html" 'foo "bon" 'bar "jour")) -; (print (make-index "d")) +(when (null *args*) + (princ (render *standard-input*)) + (exit)) + + +(dolist (arg *args*) + (if (uiop:directory-pathname-p arg) + (uiop:collect-sub*directories ; TODO + dirname + (constantly t) + (constantly t) + (lambda (f) (print f))) + (princ (render arg)))) |
