diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-11 18:18:48 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-11 18:18:48 +0100 |
| commit | d3c3ae47a2937bf0ace994a4bc9928cd2f3605de (patch) | |
| tree | f13e8c98e973b9c6534c477c3f2829e87e23d0dc /temper.lisp | |
| parent | 82b803603f519bcd91eb4a2fbc9bb5c2bfa6e168 (diff) | |
| download | temper-d3c3ae47a2937bf0ace994a4bc9928cd2f3605de.tar.gz temper-d3c3ae47a2937bf0ace994a4bc9928cd2f3605de.tar.bz2 temper-d3c3ae47a2937bf0ace994a4bc9928cd2f3605de.zip | |
Added make-index builtin
Diffstat (limited to 'temper.lisp')
| -rwxr-xr-x | temper.lisp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/temper.lisp b/temper.lisp index 2bd63cc..9f5350c 100755 --- a/temper.lisp +++ b/temper.lisp @@ -1,7 +1,8 @@ -#!/usr/bin/env clisp +#!/usr/bin/clisp (load "helper.lisp") (load "config.lisp") +(load "builtin.lisp") (defun lex (input) @@ -22,6 +23,9 @@ (lex input)))))) +; (defun temper-buf-push (&rest strings) +; (setf *temper-buf + (defun tokens-to-code-string (tokens) (apply #'concatenate 'string (map @@ -29,25 +33,26 @@ #'(lambda (token) (let ((token-type (first token)) (token-content (second token))) - (cond - ((eql token-type 'code) token-content) - ((eql token-type 'interpolation) + (ecase token-type + ('code token-content) + ('interpolation (format nil "~S" - `(setf buf + `(setf *temper-buf* (concatenate 'string - buf + *temper-buf* (format nil "~A" ,(read-from-string token-content)))))) - ((eql token-type 'string) + ('string (format nil "~S" - `(setf buf - (concatenate 'string buf ,(string-trim '(#\linefeed) token-content)))))))) + `(setf *temper-buf* + (concatenate 'string *temper-buf* ,(string-trim '(#\linefeed) token-content)))))))) tokens))) +(defvar *temper-buf* "") + (defun generate (tokens &rest args) `(let ,(apply #'rest-keys args) (progn - (setq buf "") (eval ,(read-from-string (concatenate 'string "(progn " @@ -63,7 +68,8 @@ (with-open-file (stream filename) (apply #'render-stream (cons stream args)))) +(princ (render-stream *standard-input* 'foo "bon" 'bar "jour")) -; (princ (render-stream *standard-input* 'foo "bon" 'bar "jour")) +; (princ (render "test.html" 'foo "bon" 'bar "jour")) -(princ (render "test.html" 'foo "bon" 'bar "jour")) +; (print (make-index "d")) |
