Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the zenekindarl Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 06:11:42 2022 GMT+0.
Next: Systems, Previous: The zenekindarl Reference Manual, Up: The zenekindarl Reference Manual [Contents][Index]
Expected to be a fast, flexible, extensible, low memory usage, async, concurrent template engine.
Like this
(render "Hello {{var name}}!!"
:name "κeen")
(let ((renderer (compile-template-string :stream "Hello {{var name}}!!")))
(funcall renderer *standard-output* :name "κeen"))
.
For more information, see docstring
Zenekindarl perform x16 as fast as a template engine in Python in the following instant benchmark.
Template engines | Time[sec] ---------------------|---------- Zenekindarl, SBCL 1.1.8 | 1.365 Jinja2, Python 2.7.5 | 24.07
The benchmark code for Zenekindarl:
> (time
(with-open-file (out #P"~/Desktop/out" :direction :output :if-exists :supersede)
(let ((fun (zenekindarl:compile-template-string :stream "Hello {{var name}}!!")))
(loop repeat 1000000
do (funcall fun out :name "κeen")))))
Evaluation took:
1.625 seconds of real time
1.364707 seconds of total run time (1.302198 user, 0.062509 system)
[ Run times consist of 0.042 seconds GC time, and 1.323 seconds non-GC time. ]
84.00% CPU
1 form interpreted
3 lambdas converted
3,265,218,807 processor cycles
528,706,464 bytes consed
The benchmark code for a template engine in Python:
$ cat te.py
from jinja2 import Template
template = Template( u'Hello {{ name }}!!' )
f = open( 'out', 'w' )
for i in range( 1000000 ):
f.write( template.render( name=u'κeen' ).encode( 'utf-8' ) )
$ time python te.py
real 0m25.612s
user 0m24.069s
sys 0m0.190s
variables will be HTML escaped
{{var foo}}
{{repeat 10}}hello{{endrepeat}}
{{repeat n as i}}<li>{{var i}}th item</li>{{endrepeat}}
<ol>
{{loop items as item}}
<li>{{var item}}</li>
{{endloop}}
</ol>
{{if new-p}}New{{else}}Old{{endif}}
See code below
<code><pre>
{{insert "snippet.lisp"}}
</pre></code>
<nav>
{{incude "sidebar.tmpl"}}
</nav>
Copyright (c) 2014
Next: Modules, Previous: Introduction, Up: The zenekindarl Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
A fast precompiling template engine
κeen
0.1
src (module).
Next: Files, Previous: Systems, Up: The zenekindarl Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
Next: zenekindarl/src/be, Previous: Modules, Up: Modules [Contents][Index]
zenekindarl (system).
Next: zenekindarl/src/le, Previous: zenekindarl/src, Up: Modules [Contents][Index]
backend.lisp (file).
src (module).
Previous: zenekindarl/src/be, Up: Modules [Contents][Index]
src (module).
default.lisp (file).
Next: Packages, Previous: Modules, Up: The zenekindarl Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: zenekindarl/src/zenekindarl.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
zenekindarl (system).
Next: zenekindarl/src/att.lisp, Previous: zenekindarl/zenekindarl.asd, Up: Lisp [Contents][Index]
src (module).
Next: zenekindarl/src/backend.lisp, Previous: zenekindarl/src/zenekindarl.lisp, Up: Lisp [Contents][Index]
util.lisp (file).
src (module).
Next: zenekindarl/src/be/stream.lisp, Previous: zenekindarl/src/att.lisp, Up: Lisp [Contents][Index]
src (module).
Next: zenekindarl/src/be/sequence.lisp, Previous: zenekindarl/src/backend.lisp, Up: Lisp [Contents][Index]
be (module).
Next: zenekindarl/src/be/fast-io.lisp, Previous: zenekindarl/src/be/stream.lisp, Up: Lisp [Contents][Index]
stream.lisp (file).
be (module).
Next: zenekindarl/src/token.lisp, Previous: zenekindarl/src/be/sequence.lisp, Up: Lisp [Contents][Index]
sequence.lisp (file).
be (module).
Next: zenekindarl/src/pass.lisp, Previous: zenekindarl/src/be/fast-io.lisp, Up: Lisp [Contents][Index]
src (module).
Next: zenekindarl/src/parse.lisp, Previous: zenekindarl/src/token.lisp, Up: Lisp [Contents][Index]
src (module).
Next: zenekindarl/src/lexer.lisp, Previous: zenekindarl/src/pass.lisp, Up: Lisp [Contents][Index]
src (module).
Next: zenekindarl/src/le/default.lisp, Previous: zenekindarl/src/parse.lisp, Up: Lisp [Contents][Index]
Next: zenekindarl/src/parser.lisp, Previous: zenekindarl/src/lexer.lisp, Up: Lisp [Contents][Index]
le (module).
lex (method).
Next: zenekindarl/src/util.lisp, Previous: zenekindarl/src/le/default.lisp, Up: Lisp [Contents][Index]
src (module).
=template (function).
Previous: zenekindarl/src/parser.lisp, Up: Lisp [Contents][Index]
src (module).
Next: Definitions, Previous: Files, Up: The zenekindarl Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: zenekindarl.lexer, Previous: Packages, Up: Packages [Contents][Index]
fast-io-backend (class).
Next: zenekindarl.pass, Previous: zenekindarl.backend.fast-io, Up: Packages [Contents][Index]
common-lisp.
lex (generic function).
Next: zenekindarl, Previous: zenekindarl.lexer, Up: Packages [Contents][Index]
Next: zenekindarl.token, Previous: zenekindarl.pass, Up: Packages [Contents][Index]
zen
Next: zenekindarl.backend.stream, Previous: zenekindarl, Up: Packages [Contents][Index]
Next: zenekindarl.backend, Previous: zenekindarl.token, Up: Packages [Contents][Index]
Next: zenekindarl.parser, Previous: zenekindarl.backend.stream, Up: Packages [Contents][Index]
Next: zenekindarl.lexer.default, Previous: zenekindarl.backend, Up: Packages [Contents][Index]
=template (function).
Next: zenekindarl.att, Previous: zenekindarl.parser, Up: Packages [Contents][Index]
Next: zenekindarl.util, Previous: zenekindarl.lexer.default, Up: Packages [Contents][Index]
Next: zenekindarl.parse, Previous: zenekindarl.att, Up: Packages [Contents][Index]
common-lisp.
Next: zenekindarl.backend.sequence, Previous: zenekindarl.util, Up: Packages [Contents][Index]
Previous: zenekindarl.parse, Up: Packages [Contents][Index]
Next: Indexes, Previous: Packages, Up: The zenekindarl Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Next: Generic functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Read ‘file’ into string and passes ‘compile-template-string’
compiles ‘str’ with ‘env’ and emmit renderer with backend ‘backend’.
‘backend’: Currently, one of :stream :octet-stream :string :octets :fast-io.
‘str’: A template string.
‘syntax’: Currently, :default only.
‘env’: A plist of compile time information. Left nil.
return: A keyword argumented lambda.
If the backend is :stream or :octet-stream, it looks like (lambda (stream &key ...) ...).
If the backend is :string or :octets, it looks like (lambda (&key ...) ...).
If the backend is :fast-io, it looks like (lambda (fast-io-buffer &key ...) ...).
Keys are free variables appear in the template.
Parse template and render it with args. Like below:
(render "Hello {{var name}}!!" :name "κeen")
(render "Hello {{var name}}!!" :backend :octet-stream stream :name "κeen")
.
If args have ‘:backend backend’ key-value pair, this function uses it. If not given the backend is :stream and stream is *standard-output*.
And also if ‘:syntax syntax’ is given, use it or default to :default.
A wrapper of ‘render’
end.
seq.
str.
Next: Standalone methods, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated reader method
automatically generated writer method
automatically generated writer method
automatically generated reader method
automatically generated writer method
automatically generated reader method
automatically generated writer method
Next: Structures, Previous: Generic functions, Up: Public Interface [Contents][Index]
Next: Classes, Previous: Standalone methods, Up: Public Interface [Contents][Index]
list
string
""
string
""
Next: Types, Previous: Structures, Up: Public Interface [Contents][Index]
(quote (or null string))
:gensym-string
:cond
(quote zenekindarl.att:att-node)
:then
(quote zenekindarl.att:att-node)
(zenekindarl.att:att-nil)
:else
(quote (or null t))
t
:auto-escape
(quote zenekindarl.att:att-leaf)
:loop-seq
(quote zenekindarl.att:att-variable)
:loop-var
(quote list)
:nodes
(quote zenekindarl.att:att-leaf)
:repeat-times
(quote zenekindarl.att:att-variable)
:repeat-var
(gensym "buffer")
(gensym "stream")
:stream
common-lisp.
:string
Previous: Classes, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Next: Generic functions, Previous: Special variables, Up: Internals [Contents][Index]
Next: Structures, Previous: Ordinary functions, Up: Internals [Contents][Index]
automatically generated reader method
automatically generated writer method
Previous: Generic functions, Up: Internals [Contents][Index]
Previous: Definitions, Up: The zenekindarl Reference Manual [Contents][Index]
Jump to: | (
=
?
A B C E F G H I L M N O P R S T V |
---|
Jump to: | (
=
?
A B C E F G H I L M N O P R S T V |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
A B C E G I L N P R S T V |
---|
Jump to: | *
A B C E G I L N P R S T V |
---|
Jump to: | A B C D F L M O P S T U Z |
---|
Jump to: | A B C D F L M O P S T U Z |
---|