archimag / cl-closure-template

Common Lisp implementation of Google's Closure Templates.
Other
71 stars 23 forks source link

full-call doesn't work #5

Open necto opened 12 years ago

necto commented 12 years ago

The template file:

{namespace ns}

{template callee}
{/template}

{template caller}
{call callee} {/call}
{/template}

Being runned with the following code:

(require 'asdf)
(asdf:operate 'asdf:load-op '#:closure-template)
(print (closure-template:compile-template :javascript-backend (make-pathname :name "./test.tmpl")))

Produces:

$ sbcl --load test.lisp This is SBCL 1.0.54, an implementation of ANSI Common Lisp. More information about SBCL is available at http://www.sbcl.org/.

SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more information. style-warning: Implicitly creating new generic function ps-print.

debugger invoked on a SIMPLE-ERROR in thread

<THREAD "initial thread" RUNNING {AB00921}>:

Incomplete parse, stopped at 50.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name): 0: [RETRY ] Retry EVAL of current toplevel form. 1: [CONTINUE] Ignore error and continue loading file "/home/necto/proj/genealogy/test.lisp". 2: [ABORT ] Abort loading file "/home/necto/proj/genealogy/test.lisp". 3: Ignore runtime option --load "test.lisp". 4: Skip rest of --eval and --load options. 5: Skip to toplevel READ/EVAL/PRINT loop. 6: [QUIT ] Quit SBCL (calling #'QUIT, killing the process).

(ESRAP::PROCESS-PARSE-RESULT

S(ESRAP::RESULT

:%PRODUCTION ((CLOSURE-TEMPLATE.PARSER:NAMESPACE "gaga"
               (CLOSURE-TEMPLATE.PARSER:TEMPLATE ("callee"))))
:POSITION 50)

"{namespace gaga}

{template callee} {/template}

{template caller} {call callee} {/call} {/template} " 102 NIL) 0]

But I've expected a call. If I've misunderstood a syntax in documentation, how should I call a subtemplate with custom parameters?

archimag commented 12 years ago

The problem is that the body of the template can not be empty. This is a small bug. Add something into "callee".

necto commented 12 years ago

This doesn't help, non-empty templates stil produces the same error: {namespace gaga}

{template callee}
trr
{/template}

{template caller}
trra
{call callee} {/call}
{/template}
necto commented 12 years ago

(just confused buttons)

necto commented 11 years ago

Just discovered, that the full form of call won't work if it doesn't contain any {param}, so:

{call callee/}                       // works
{call calee} {/call}                 // doesn't work
{call calee} {param a: "a"/} {/call} // works again.