Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-mustache Reference Manual, version 0.12.3, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:50:42 2022 GMT+0.
Next: Systems, Previous: The cl-mustache Reference Manual, Up: The cl-mustache Reference Manual [Contents][Index]
======== CL-MUSTACHE ======== .. image:: https://travis-ci.org/kanru/cl-mustache.png?branch=master :target: https://travis-ci.org/kanru/cl-mustache Inspired by ctemplate_ and et_, Mustache_ is a framework-agnostic way to render logic-free views. As ctemplates says, "It emphasizes separating logic from presentation: it is impossible to embed application logic in this template language." CL-MUSTACHE is a Common Lisp implementation of Mustache v1.1.2+λ. Tested with: - SBCL 1.0.55 - CLISP 2.49 CL-MUSTACHE is semantically versioned: http://semver.org. Documentation ============= The different Mustache tags are documented at `mustache(5)`_. Install It ========== Using quicklisp is recommended. :: CL-USER> (ql:quickload "cl-mustache") Use It ====== Currently accepts context data in alist format, for example: :: `((:tag . "string") (:array . #(1 2 3 4)) (:lambda ,(lambda () "world")) (:nested . ((:data . t)))) To render the template: :: CL-USER> (mustache:render* "Hi {{person}}!" '((:person . "Mom"))) "Hi Mom!" Or save the renderer for later use: :: CL-USER> (setf view (mustache:compile-template "Hi {{person}}!")) Or define static renderer function: :: CL-USER> (mustache:define view "Hi {{person}}!") CL-USER> (view context) Test It ======= :: CL-USR> (ql:quickload "cl-mustache-test") CL-USR> (prove:run :cl-mustache-test) Extend It (Experimental) ======================== Define your tag classes, tag character and render function: :: (in-package :mustache) (defclass exec-tag (non-standalone-tag) ((command :initarg :command :accessor command))) (set-mustache-character #\$ (lambda (raw-text arg-text escapep start end) (make-instance 'exec-tag :command arg-text))) ;; or ;; (define-mustache-character #\$ ;; (make-instance 'exec-tag :command arg-text)) (defmethod render-token ((token exec-tag) context template) (print-data (run-program-output (command token)) t context)) .. _ctemplate: http://code.google.com/p/google-ctemplate/ .. _et: http://www.ivan.fomichev.name/2008/05/erlang-template-engine-prototype.html .. _Mustache: http://mustache.github.com/ .. _mustache(5): http://mustache.github.com/mustache.5.html
Next: Files, Previous: Introduction, Up: The cl-mustache Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Mustache Template Renderer
Kan-Ru Chen <kanru@kanru.info>
MIT/Expat
0.12.3
uiop (system).
Next: Packages, Previous: Systems, Up: The cl-mustache Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-mustache/packages.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-mustache (system).
Next: cl-mustache/mustache.lisp, Previous: cl-mustache/cl-mustache.asd, Up: Lisp [Contents][Index]
cl-mustache (system).
Next: cl-mustache/compat-api-v1.lisp, Previous: cl-mustache/packages.lisp, Up: Lisp [Contents][Index]
packages.lisp (file).
cl-mustache (system).
Previous: cl-mustache/mustache.lisp, Up: Lisp [Contents][Index]
mustache.lisp (file).
cl-mustache (system).
Next: Definitions, Previous: Files, Up: The cl-mustache Reference Manual [Contents][Index]
Packages are listed by definition order.
common-lisp.
Next: Indexes, Previous: Packages, Up: The cl-mustache 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: Macros, Previous: Public Interface, Up: Public Interface [Contents][Index]
Current context for lambda section
The default file extension for partials.
A list. The search pathes for partials.
Deprecated in favor of MUSTACHE:*OUTPUT-STREAM* since version 0.10.0
The default output stream for mustache rendering. Bind this variable before calling mustache-rendering and friends. Default is *standard-output*.
Next: Ordinary functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Define a named renderer of string TEMPLATE.
Define a named renderer of string TEMPLATE.
Next: Generic functions, Previous: Macros, Up: Public Interface [Contents][Index]
Create mustache context from alist DATA.
Return a compiled rendering function.
Create mustache context from alist DATA.
Render TEMPLATE with optional CONTEXT to *OUTPUT-STREAM* or OUTPUT-STREAM
Render TEMPLATE with optional CONTEXT to STREAM.
Render TEMPLATE with optional CONTEXT to string.
Return the CL-MUSTACHE version.
Return the CL-MUSTACHE version.
Render TEMPLATE with optional CONTEXT to string.
Return the CL-MUSTACHE version.
Next: Standalone methods, Previous: Ordinary functions, Up: Public Interface [Contents][Index]
Return a compiled rendering function.
Render TEMPLATE with optional CONTEXT to *OUTPUT-STREAM* or OUTPUT-STREAM
Previous: Generic functions, Up: Public Interface [Contents][Index]
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Special variables, Up: Internals [Contents][Index]
Next: Generic functions, Previous: Macros, Up: Internals [Contents][Index]
Change the mustache tag delimiter according to TEXT.
The syntax grammar is:
delimiter-tag = left-d 1*space right-d
left-d = *ALPHANUM
right-d = *ALPHANUM
space = #\Space #\Tab
Ensure MAYBE-CONTEXT is a valid context. If not then make one.
HTML escape STRING when *escape-tokens* is t.
Next: Conditions, Previous: Ordinary functions, Up: Internals [Contents][Index]
automatically generated reader method
automatically generated writer method
Get data from CONTEXT by KEY.
name.
automatically generated reader method
%end.
automatically generated writer method
%end.
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
Next: Classes, Previous: Generic functions, Up: Internals [Contents][Index]
Next: Types, Previous: Conditions, Up: Internals [Contents][Index]
mustache::crlf
mustache::offset
0
:start
boolean
:falsey
string
""
:open-delimiter
string
""
:close-delimiter
list
:tokens
boolean
t
:escape
This slot is read-only.
list
:indent
Previous: Definitions, Up: The cl-mustache Reference Manual [Contents][Index]
Jump to: | %
(
C D E F G I K L M N O P R S T V |
---|
Jump to: | %
(
C D E F G I K L M N O P R S T V |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | %
*
B C N R S |
---|
Jump to: | %
*
B C N R S |
---|
Jump to: | A B C D F M N O P S T W |
---|
Jump to: | A B C D F M N O P S T W |
---|