archimag / cl-closure-template Goto Github PK
View Code? Open in Web Editor NEWCommon Lisp implementation of Google's Closure Templates.
License: Other
Common Lisp implementation of Google's Closure Templates.
License: Other
Очень нужен атрибут позволяющий сохранять форматирование в шаблонах. Например, для того, чтобы не повторять всё время команду {\n}.
Параметр можно назвать как-нибудь вроде saveFormating и применять при определении шаблонов:
{template mytemplate saveFormating="true"}
...
{/template}
It would be nice to have documentation of any differences from Google's implementation.
For example, auto-escaping seems to work very differently than Google's implementation, but there is no documentation of how it works in class-closure-template.
Emacs mode not recognises {css } and {msg} closure template commands
A very simple file...
{namespace spa.history}
{template show}
<tr>
<td>{$type}</td>
<td>{$date|date}</td>
<td class="comment"><div>{$comment}</div></td>
<td>{$author}</td>
<td><a href="/history/{$id}/edit">modifier</a></td>
</tr>
{/template}
I try to compile it:
CL-USER> (closure-template:compile-cl-templates #P"/path/to/file.tmpl")
I get this error:
Incomplete parse.
Encountered at:
namespace spa.history}
{template show}
<tr>
^ (Line 3, Column 1, Position 25)
[Condition of type ESRAP::SIMPLE-ESRAP-ERROR]
Have I missed anything obvious?
Делаю так:
//Шаблон:
{template experiment2}
{foreach $loc in $array}
loc.val is a {$loc.val} index = {index($loc)}{\n}
{ifempty}
some
{/foreach}
{/template}
Вызов:
(examples.simple:experiment2
'(:array ((:val 1) (:val 2) (:val 3)))
)
Вывод:
"loc.val is a 1 index = 0
loc.val is a 2 index = 1
loc.val is a 3 index = 2
"
cl-closure-template из последнего quicklisp'a: cl-closure-template-20131003-git
OS: Ubuntu 12.04.3 LTS
Lisp: sbcl 1.1.0
When using
{let $var: 1 /}
the following error occurs:
Incomplete parse. Encountered at: osure-template.Example} {template test} <ht ^ (Line 3, Column 1, Position 38) [Condition of type ESRAP::SIMPLE-ESRAP-ERROR]
Templates that uses \r\n instead of \n can't be parsed.
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
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?
Google closed their code hosting, so link in the repo description is broken now.
Correct URL to the Google Closure Templates project is https://developers.google.com/closure/templates/
Например проходя по списку опций, я бы хотел в случае если используются дополнительные настройки элемента - представлять его списком, концептуально использование я вижу так:
{foreach $option in $options}
{if isList($option)}
Please consider adding :description, :author and :license information to your ASDF system(s). This will greatly help Quicklisp users and make it easier for them to report bugs.
More information:
http://blog.quicklisp.org/2015/05/looking-for-more-metadata.html
https://www.quicklisp.org
Hi,
I could not find a way to insert injected data. Has it been implemented?
При форматировании следущего кода
`
Some text
Another text
`-шки выравниваются неодинаково.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.