New release CL-EMB 0.2.1
CL-EMB is a library to embed Common Lisp and special template
tags into normal text files. Can be used for dynamically
generated HTML pages.
You can download it from
http://common-lisp.net/project/cl-emb/
or install with ASDF-Install.
CL-USER> (require :asdf-install)
CL-USER> (asdf-install:install :cl-emb)
Changes:
- New functions CLEAR-EMB, CLEAR-EMB-ALL, and CLEAR-EMB-ALL-FILES
clear registered emb code. By name, all or just all emb code from
files.
Maybe you want to start debugging a running project. Setting
CL-EMB:*DEBUG* allows you to see the generated code with
CL-EMB:PPRINT-EMB-FUNCTION for code that gets registered after that.
If you clear the registered code with CL-EMB:CLEAR-EMB-ALL-FILES all
files get registered again when called with CL-EMB:EXECUTE-EMB.
(Or just touch all the files.)
New release CL-EMB 0.2.0
CL-EMB is a library to embed Common Lisp and special template
tags into normal text files. Can be used for dynamically
generated HTML pages.
You can download it from
http://common-lisp.net/project/cl-emb/
or install with ASDF-Install.
CL-USER> (require :asdf-install)
CL-USER> (asdf-install:install :cl-emb)
Changes:
- Debugging: CL-EMB:REGISTER-EMB saves the generated lambda form
when CL-EMB:*DEBUG* is T. You may pretty print this form with
CL-EMB:PPRINT-EMB-FUNCTION
CL-USER> (emb:register-emb "test7" " - <% @var foo -escape uri %> - ")
#<CL-EMB::EMB-FUNCTION {96F1239}>
CL-USER> (emb:pprint-emb-function "test7")
(LAMBDA (&OPTIONAL CL-EMB-INTERN::ENV)
(WITH-OUTPUT-TO-STRING (*STANDARD-OUTPUT*)
(PROGN
(WRITE-STRING " - ")
(FORMAT T "~A" (CL-EMB::ECHO (GETF CL-EMB-INTERN::ENV :FOO) :ESCAPE :URI))
(WRITE-STRING " - "))))
; No value
- New template tag @set can be used to set special variables and
establish a default for the rest of the code.
CL-USER> (emb:register-emb "test8" "<% @set escape=xml %>--<% @var hey %>--")
#<CL-EMB::EMB-FUNCTION {962B839}>
CL-USER> (emb:register-emb "test9" "--<% @var hey %>--<% @call test8 %>--<% @var hey %>--")
#<CL-EMB::EMB-FUNCTION {96931A9}>
CL-USER> (emb:execute-emb "test9" '(:hey "5>2"))
"--5>2----5>2----5>2--"
New release 0.0.3
You can download it from
http://www.common-lisp.net/project/cl-emb/
or install with ASDF-Install.
> (require :asdf-install)
> (asdf-install:install :cl-emb)
Changes:
- Comments. Everything within <%# ... #%> will be removed/ignored.
(With "<%" and "%>" representing the current start and end
marker.)
- Escaping. New special variable *ESCAPE-TYPE* and a modifier for
@var. Supported escaping: raw, xml (aka html), uri (aka url or
url-encode)
Example:
CL-USER> (emb:register-emb "test5"
"<a href=\"http://somewhere.test/test.cgi?<% @var foo -escape uri %>\"><% @var foo %></a>")
#<CL-EMB::EMB-FUNCTION {9FBF5F1}>
CL-USER> (let ((emb:*escape-type* :html))
(emb:execute-emb "test5" '(:foo "10 > 7")))
"<a href=\"http://somewhere.test/test.cgi?10+%3E+7\">10 > 7</a>"
New release 0.0.2
You can download it direct from
http://www.common-lisp.net/project/cl-emb/
or install it with ASDF-Install.
Changes:
Added special variables *emb-start-marker* and *emb-end-marker*
This change was inspired by the patches Peter Minten sent me.
Thanks!
You can now use other start and end markers instead of "<%" and
"%>", which are the default.
Examble:
CL-USER> (let ((emb:*emb-start-marker* "<?emb")
(emb:*emb-end-marker* "?>"))
(emb:register-emb "marker-test"
"42 + 42 = <?emb= (+ 42 42) ?>"))
#<CL-EMB::EMB-FUNCTION {97BEFD9}>
CL-USER> (emb:execute-emb "marker-test")
"42 + 42 = 84"