This is the djula Reference Manual, version 0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:59:37 2024 GMT+0.
djula/djula.asd
djula/src/pathnames.lisp
djula/src/compiler.lisp
djula/src/conditions.lisp
djula/src/filters.lisp
djula/src/lexer.lisp
djula/src/locale.lisp
djula/src/packages.lisp
djula/src/parser.lisp
djula/src/pipeline.lisp
djula/src/specials.lisp
djula/src/tags.lisp
djula/src/tag.lisp
djula/src/template-store.lisp
djula/src/translation.lisp
djula/src/util.lisp
djula/src/variables.lisp
The main system appears first, followed by any subsystem dependency.
djula
An implementation of Django templates for Common Lisp.
Eric Sessoms <eric@nubgames.com>
Mariano Montone <marianomontone@gmail.com>
Nick Allen <nallen05@gmail.com>
MIT
# Djula
[![Build Status](https://travis-ci.org/mmontone/djula.svg?branch=master)](https://travis-ci.org/mmontone/djula)
[![Quicklisp](http://quickdocs.org/badge/djula.svg)](http://quickdocs.org/djula/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
Djula is a port of Python’s [Django](http://www.djangoproject.com) template engine to Common Lisp.
## Nutshell
Here a small example of a template::
“‘HTML+Django
{% extends "base.html" %}
{% block title %}Memberlist{% endblock %}
{% block content %}
<ul>
{% for user in users %}
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% endfor %}
</ul>
{% endblock %}
“‘
## Philosophy
Application logic is for the controller but don’t try to make the life
for the template designer too hard by giving him too few functionality.
For more information visit the [documentation page](http://mmontone.github.io/djula/djula/).
0.2
access
(system).
alexandria
(system).
babel
(system).
cl-ppcre
(system).
split-sequence
(system).
local-time
(system).
closer-mop
(system).
trivial-backtrace
(system).
cl-slice
(system).
cl-locale
(system).
gettext
(system).
parser-combinators
(system).
iterate
(system).
uiop
(system).
src
(module).
Modules are listed depth-first from the system components tree.
djula/src
djula
(system).
pathnames.lisp
(file).
compiler.lisp
(file).
conditions.lisp
(file).
filters.lisp
(file).
lexer.lisp
(file).
locale.lisp
(file).
packages.lisp
(file).
parser.lisp
(file).
pipeline.lisp
(file).
specials.lisp
(file).
tags.lisp
(file).
tag.lisp
(file).
template-store.lisp
(file).
translation.lisp
(file).
util.lisp
(file).
variables.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
djula/djula.asd
djula/src/pathnames.lisp
djula/src/compiler.lisp
djula/src/conditions.lisp
djula/src/filters.lisp
djula/src/lexer.lisp
djula/src/locale.lisp
djula/src/packages.lisp
djula/src/parser.lisp
djula/src/pipeline.lisp
djula/src/specials.lisp
djula/src/tags.lisp
djula/src/tag.lisp
djula/src/template-store.lisp
djula/src/translation.lisp
djula/src/util.lisp
djula/src/variables.lisp
djula/src/pathnames.lisp
src
(module).
parse-unix-namestring
(function).
djula/src/compiler.lisp
lexer.lisp
(file).
parser.lisp
(file).
template-store.lisp
(file).
src
(module).
*current-compiler*
(special variable).
compile-string
(function).
compile-template
(generic function).
compile-template*
(function).
compiler
(class).
fragment-compiler
(reader method).
initialize-instance
(method).
print-object
(method).
render-template*
(function).
string
(function).
toplevel-compiler
(class).
compile-template-file
(method).
compile-token
(function).
compiled-template
(reader method).
(setf compiled-template)
(writer method).
compiled-template
(class).
linked-templates
(reader method).
(setf linked-templates)
(writer method).
template-changed
(method).
template-file
(reader method).
(setf template-file)
(writer method).
template-file-write-date
(reader method).
(setf template-file-write-date)
(writer method).
djula/src/conditions.lisp
specials.lisp
(file).
src
(module).
template-error
(function).
template-error
(condition).
render-error-template
(function).
template-error*
(function).
template-error-string
(function).
template-error-string*
(function).
with-template-error
(macro).
djula/src/filters.lisp
pipeline.lisp
(file).
src
(module).
add
(function).
addslashes
(function).
capfirst
(function).
cut
(function).
date
(function).
datetime
(function).
default
(function).
divisibleby
(function).
escape
(function).
first
(function).
force-escape
(function).
format
(function).
join
(function).
last
(function).
length
(function).
length_is
(function).
linebreaks
(function).
linebreaksbr
(function).
lisp
(function).
lower
(function).
make_list
(function).
prin1
(function).
replace
(function).
rest
(function).
reverse
(function).
safe
(function).
scan
(function).
slice
(function).
sort
(function).
time
(function).
truncatechars
(function).
upper
(function).
urlencode
(function).
with
(function).
apply-filters
(function).
djula/src/lexer.lisp
pipeline.lisp
(file).
util.lisp
(file).
src
(module).
verbatim
(function).
get-closing-delimiter
(function).
next-tag
(function).
parse-tag
(function).
parse-template-string
(function).
token-type
(function).
djula/src/locale.lisp
lexer.lisp
(file).
src
(module).
directory-translate-strings
(function).
file-template-translate-strings
(function).
locale-list
(function).
update-caveman-project
(function).
update-locale-list
(function).
update-project
(function).
+whitespace+
(constant).
alter-pathname
(function).
backup-file
(function).
parse-template-string
(function).
string-string-p
(function).
string-translate-strings
(function).
trim-whitespace
(function).
djula/src/parser.lisp
pipeline.lisp
(file).
src
(module).
process-token
(function).
process-tokens
(function).
djula/src/pipeline.lisp
conditions.lisp
(file).
src
(module).
def-filter
(macro).
def-tag-compiler
(macro).
def-delimited-tag
(macro).
def-tag-processor
(macro).
def-token-compiler
(macro).
def-token-processor
(macro).
def-unparsed-tag-processor
(macro).
find-filter
(function).
find-tag-compiler
(function).
find-tag-processor
(function).
find-token-compiler
(function).
find-token-processor
(function).
find-unparsed-tag-processor
(function).
djula/src/specials.lisp
packages.lisp
(file).
src
(module).
*allow-include-roots*
(special variable).
*catch-template-errors-p*
(special variable).
*current-language*
(special variable).
*debug-mode*
(special variable).
*default-language*
(special variable).
*default-template-arguments*
(special variable).
*elision-string*
(special variable).
*error-template*
(special variable).
*fancy-debug-p*
(special variable).
*fancy-error-template-p*
(special variable).
*recompile-templates-on-change*
(special variable).
*strict-mode*
(special variable).
*template-package*
(special variable).
*verbose-errors-p*
(special variable).
*accumulated-javascript-strings*
(special variable).
*block-alist*
(special variable).
*current-block*
(special variable).
*current-template*
(special variable).
*eval-lisp-tags*
(special variable).
*linked-templates*
(special variable).
*template-arguments*
(special variable).
djula/src/tags.lisp
tag.lisp
(file).
variables.lisp
(file).
src
(module).
*djula-emptyp*
(special variable).
almost-parsed-ifequal
(function).
almost-parsed-ifnotequal
(function).
autoescape
(function).
block
(function).
comment
(function).
comment-tag
(function).
cycle
(function).
debug
(function).
emit-js
(function).
endautoescape
(function).
endblock
(function).
endcomment
(function).
endfilter
(function).
endfor
(function).
endif
(function).
endifchanged
(function).
endifequal
(function).
endifnotequal
(function).
endjs-script
(function).
extends
(function).
filter
(function).
firstof
(function).
for
(function).
if
(function).
ifchanged
(function).
ifequal
(function).
ifnotequal
(function).
include
(function).
js
(function).
js-script
(function).
lisp
(function).
parsed-autoescape
(function).
parsed-block
(function).
parsed-filter
(function).
parsed-for
(function).
parsed-if
(function).
parsed-ifchanged
(function).
parsed-ifequal
(function).
parsed-js
(function).
parsed-js-script
(function).
parsed-lisp
(function).
parsed-set
(function).
semi-parsed-filter
(function).
semi-parsed-if
(function).
semi-parsed-ifequal
(function).
semi-parsed-ifnotequal
(function).
semi-parsed-js-script
(function).
set
(function).
set-language
(function).
set-package
(function).
show-language
(function).
ssi
(function).
super
(function).
templatetag
(function).
and-bterm
(function).
bliteral
(function).
boolean-comparison
(function).
boolexp-factor
(function).
boolexp-parser
(function).
bterm
(function).
comparison-operator-parser
(function).
compile-boolexp
(function).
compile-logical-statement
(function).
djula-emptyp
(function).
in-list
(function).
iterable-list
(generic function).
not-bfactor
(function).
or-bterm
(function).
parse-if-clause
(function).
print-debugging-information
(function).
print-fancy-debugging-information
(function).
process-ifequal-args
(function).
remove-first
(function).
split-if-clause
(function).
transform
(function).
with-file-handler
(macro).
djula/src/tag.lisp
pipeline.lisp
(file).
src
(module).
tag
(function).
tag
(function).
unparsed-tag
(function).
find-end-tag
(function).
find-end-tag-nested
(function).
parse-rest-of-tag
(function).
semi-parse-tag
(function).
djula/src/template-store.lisp
specials.lisp
(file).
src
(module).
*current-store*
(special variable).
add-template-directory
(function).
fetch-template
(generic function).
fetch-template*
(function).
filesystem-template-store
(class).
find-template
(generic function).
find-template*
(function).
list-asdf-system-templates
(function).
memory-template-store
(class).
template-store
(class).
portable-parse-namestring
(function).
search-path
(reader method).
(setf search-path)
(writer method).
djula/src/translation.lisp
specials.lisp
(file).
pipeline.lisp
(file).
src
(module).
*translation-backend*
(special variable).
trans
(function).
trans
(function).
translate
(function).
translation
(function).
unparsed-translation
(function).
*translation-backends*
(special variable).
*untranslated-messages*
(special variable).
*warn-on-untranslated-messages*
(special variable).
backend-translate
(generic function).
current-translation-backend
(function).
format-translation
(function).
resolve-plist
(function).
djula/src/util.lisp
packages.lisp
(file).
src
(module).
template-print-object
(generic function).
url-encode
(function).
url-encode-path
(function).
accum
(macro).
escape-for-html
(function).
join
(function).
truncate-characters
(function).
djula/src/variables.lisp
specials.lisp
(file).
util.lisp
(file).
src
(module).
*auto-escape*
(special variable).
unparsed-variable
(function).
variable
(function).
apply-keys/indexes
(function).
check-template-variable-boundp
(function).
ensure-access
(function).
escape-string-split
(function).
get-variable
(function).
integer-or-keyword
(function).
parse-filter-string
(function).
parse-variable-clause
(function).
parse-variable-phrase
(function).
resolve-variable-phrase
(function).
template-var-boundp
(function).
Packages are listed by definition order.
djula
djula.tag-compilers
djula.unparsed-tag-processors
djula.locale
djula.tag-processors
portable-pathnames
djula.token-compilers
djula.filters
djula.token-processors
djula
alexandria
.
common-lisp
.
iterate
.
parser-combinators
.
*allow-include-roots*
(special variable).
*auto-escape*
(special variable).
*catch-template-errors-p*
(special variable).
*current-compiler*
(special variable).
*current-language*
(special variable).
*current-store*
(special variable).
*debug-mode*
(special variable).
*default-language*
(special variable).
*default-template-arguments*
(special variable).
*djula-emptyp*
(special variable).
*elision-string*
(special variable).
*error-template*
(special variable).
*fancy-debug-p*
(special variable).
*fancy-error-template-p*
(special variable).
*recompile-templates-on-change*
(special variable).
*strict-mode*
(special variable).
*template-package*
(special variable).
*translation-backend*
(special variable).
*verbose-errors-p*
(special variable).
add-template-directory
(function).
compile-string
(function).
compile-template
(generic function).
compile-template*
(function).
compiler
(class).
def-filter
(macro).
def-tag-compiler
(macro).
fetch-template
(generic function).
fetch-template*
(function).
filesystem-template-store
(class).
find-template
(generic function).
find-template*
(function).
fragment-compiler
(generic reader).
list-asdf-system-templates
(function).
memory-template-store
(class).
render-template*
(function).
template-error
(function).
template-error
(condition).
template-print-object
(generic function).
template-store
(class).
toplevel-compiler
(class).
translate
(function).
url-encode
(function).
url-encode-path
(function).
*accumulated-javascript-strings*
(special variable).
*block-alist*
(special variable).
*current-block*
(special variable).
*current-template*
(special variable).
*eval-lisp-tags*
(special variable).
*linked-templates*
(special variable).
*template-arguments*
(special variable).
*translation-backends*
(special variable).
*untranslated-messages*
(special variable).
*warn-on-untranslated-messages*
(special variable).
accum
(macro).
and-bterm
(function).
apply-filters
(function).
apply-keys/indexes
(function).
backend-translate
(generic function).
bliteral
(function).
boolean-comparison
(function).
boolexp-factor
(function).
boolexp-parser
(function).
bterm
(function).
check-template-variable-boundp
(function).
comparison-operator-parser
(function).
compile-boolexp
(function).
compile-logical-statement
(function).
compile-template-file
(generic function).
compile-token
(function).
compiled-template
(generic reader).
(setf compiled-template)
(generic writer).
compiled-template
(class).
current-translation-backend
(function).
def-delimited-tag
(macro).
def-tag-processor
(macro).
def-token-compiler
(macro).
def-token-processor
(macro).
def-unparsed-tag-processor
(macro).
djula-emptyp
(function).
ensure-access
(function).
escape-for-html
(function).
escape-string-split
(function).
find-end-tag
(function).
find-end-tag-nested
(function).
find-filter
(function).
find-tag-compiler
(function).
find-tag-processor
(function).
find-token-compiler
(function).
find-token-processor
(function).
find-unparsed-tag-processor
(function).
format-translation
(function).
get-closing-delimiter
(function).
get-variable
(function).
in-list
(function).
integer-or-keyword
(function).
iterable-list
(generic function).
join
(function).
linked-templates
(generic reader).
(setf linked-templates)
(generic writer).
next-tag
(function).
not-bfactor
(function).
or-bterm
(function).
parse-filter-string
(function).
parse-if-clause
(function).
parse-rest-of-tag
(function).
parse-tag
(function).
parse-template-string
(function).
parse-variable-clause
(function).
parse-variable-phrase
(function).
portable-parse-namestring
(function).
print-debugging-information
(function).
print-fancy-debugging-information
(function).
process-ifequal-args
(function).
process-token
(function).
process-tokens
(function).
remove-first
(function).
render-error-template
(function).
resolve-plist
(function).
resolve-variable-phrase
(function).
search-path
(generic reader).
(setf search-path)
(generic writer).
semi-parse-tag
(function).
split-if-clause
(function).
template-changed
(generic function).
template-error*
(function).
template-error-string
(function).
template-error-string*
(function).
template-file
(generic reader).
(setf template-file)
(generic writer).
template-file-write-date
(generic reader).
(setf template-file-write-date)
(generic writer).
template-var-boundp
(function).
token-type
(function).
transform
(function).
truncate-characters
(function).
with-file-handler
(macro).
with-template-error
(macro).
djula.tag-compilers
This package contains the tag compilers.
cycle
(function).
debug
(function).
emit-js
(function).
endautoescape
(function).
endblock
(function).
endcomment
(function).
endfilter
(function).
endfor
(function).
endif
(function).
endifchanged
(function).
endifequal
(function).
endifnotequal
(function).
endjs-script
(function).
firstof
(function).
include
(function).
set-language
(function).
set-package
(function).
show-language
(function).
ssi
(function).
super
(function).
templatetag
(function).
djula.unparsed-tag-processors
This package contains the unparsed tag processors.
djula.locale
This package contains code to generate cl-locale dictionary files.
common-lisp
.
directory-translate-strings
(function).
file-template-translate-strings
(function).
locale-list
(function).
update-caveman-project
(function).
update-locale-list
(function).
update-project
(function).
+whitespace+
(constant).
alter-pathname
(function).
backup-file
(function).
parse-template-string
(function).
string-string-p
(function).
string-translate-strings
(function).
trim-whitespace
(function).
djula.tag-processors
This package contains the tag processors.
autoescape
(function).
block
(function).
comment
(function).
extends
(function).
for
(function).
if
(function).
ifchanged
(function).
js-script
(function).
semi-parsed-filter
(function).
semi-parsed-ifequal
(function).
semi-parsed-ifnotequal
(function).
portable-pathnames
common-lisp
.
parse-unix-namestring
(function).
djula.token-compilers
This package contains the token compilers.
parsed-autoescape
(function).
parsed-block
(function).
parsed-filter
(function).
parsed-for
(function).
parsed-if
(function).
parsed-ifchanged
(function).
parsed-ifequal
(function).
parsed-js
(function).
parsed-js-script
(function).
parsed-lisp
(function).
parsed-set
(function).
string
(function).
tag
(function).
translation
(function).
variable
(function).
verbatim
(function).
djula.filters
This package contains the djula filters. Filters are take as a first argument a string and return a string.
add
(function).
addslashes
(function).
capfirst
(function).
cut
(function).
date
(function).
datetime
(function).
default
(function).
divisibleby
(function).
escape
(function).
first
(function).
force-escape
(function).
format
(function).
join
(function).
last
(function).
length
(function).
length_is
(function).
linebreaks
(function).
linebreaksbr
(function).
lisp
(function).
lower
(function).
make_list
(function).
prin1
(function).
replace
(function).
rest
(function).
reverse
(function).
safe
(function).
scan
(function).
slice
(function).
sort
(function).
time
(function).
trans
(function).
truncatechars
(function).
upper
(function).
urlencode
(function).
with
(function).
djula.token-processors
Contains the token processors
almost-parsed-ifequal
(function).
almost-parsed-ifnotequal
(function).
comment
(function).
comment-tag
(function).
semi-parsed-if
(function).
semi-parsed-js-script
(function).
string
(function).
tag
(function).
unparsed-tag
(function).
unparsed-translation
(function).
unparsed-variable
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
A list of folder names that are allowed to be included by SSI.
Controls auto escaping.
When enabled, caught errors during the rendering of the template are written to the output instead of being handled by the lisp listener.
The current template compiler.
The currently in-use template store. Defaults to a FILESYSTEM-TEMPLATE-STORE.
When in debug mode, debugging information is attached to rendered templates.
The default i18n language. English is the default.
List of arguments available for all templates. Add arguments to this list if you want them to be available in every template. This is a plist, so use getf to add arguments, like: (setf (getf djula:*default-template-arguments* :foo) ’some-value)
Change this to customize how djula decides if some value is empty or not
The string to be used by ‘truncatechars’ at the end of truncated strings.
The error template used by ‘render-error-template’.
When enabled, displays fancy html based debugging information for the {% debug %} tag.
When enabled, show a fancy template when an error ocurrs.
When enabled, templates are recompiled if they have changed on disk, before they are rendered.
This is the default and convenient for development. For production, this can be turned off and the filesystem check is bypassed.
When enabled, unbound template variables access signals an error.
The package in which template expressions are evaluated.
The translation backend. One of :locale, :gettext, :translate.
Loading the correspondent Djula ASDF translation backend system is required.
When enabled, errors are displayed more verbosely. Good for debugging.
Define a Djula filter.
NAME is the name of the filter.
ARGS is the list of arguments of the filter.
BODY is the implementation of the filter.
Define a Djula tag compiler.
NAME is the name of the tag.
ARGS is the list of arguments required.
BODY is the tag compilation implementation.
Adds DIRECTORY to the search path of the TEMPLATE-STORE.
:COMMENT tokens are removed by PROCESS-TOKENS
Compile the template in STRING. Returns a funcallable template.
Compiles template NAME with compiler in *CURRENT-COMPILER*.
given a directory of djula html template files find all the strings to be translated
Return the text of a template fetched from the *CURRENT-STORE*.
given a djula html template file, find all the strings to be translated
Find template with name NAME in *CURRENT-STORE*.
If the template is not found, an error is signaled depending on ERROR-P argument value.
when compiled, :INCLUDE tags first compile the template pointed to by ‘PATH’ then they compile into a function that simply calls this function with *TEMPLATE-ARGUMENTS*
‘PARAMETERS’ should have the form (:param1 value1 :param2 value2 ...). If given, they are prepended to *TEMPLATE-ARGUMENTS*
List djula templates in ASDF-SYSTEM at COMPONENT. A list of template PATHNAMEs is returned.
return an augmented dictionary of a cl-locale message file with the translate strings. Does not update the file.
:PARSED-IF tags are compiled into a function that executes the {% if %} clause
Render TEMPLATE into DESTINATION passing *TEMPLATE-ARGUMENTS*. DESTINATION is the same as FORMAT destination. TEMPLATE-ARGUMENTS is a property-list.
:SEMI-PARSED-IF tags are parsed into :PARSED-IF tags. a :PARSED-IF tag looks more ike a traditional IF statement [a test, an "if" branch, and an "else" branch], so :SEMI-PARSED-IF has to look for the :ELSE token to split up ‘CLAUSE’
:SET-LANGUAGE tags are compiled into a function that set *CURRENT-LANGUAGE* to the keyword version of ‘NAME’ [or NIL if ‘NAME’ is not supplied]
:SET-PACKAGE tags are compiled into a function that set *TEMPLATE-PACKAGE* to the the package value of find package on the keyword ‘PACKAGE-NAME’ or the package ‘common-lisp-user’ if the package for ‘PACKAGE-NAME’ is not found. This is useful to determine the package in which :LISP tags are executed.
:SHOW-LANGUAGE tags are compiled into a function that just shows the values of *CURRENT-LANGUAGE* or *DEFAULT-LANGUAGE* if there is no current language
Server Side Includes.
If ‘PATH’ lives in a folder reckognized by *ALLOW-INCLUDE-ROOTS*, then :SSI tag
compiles into a function that returns the contents of the file pointed to
by the template-path ‘PATH’.
If ‘PARSE’ is T then the function renders ‘PATH’ as a template.
:STRING tokens compile into a function that simply returns the string
adjacent :STRING tokens are concatenated together by PROCESS-TOKENS as a small optimization
:TAG tokens are sometimes parsed into some other tokens by PROCESS-TOKENS
:SHOW-FILE tags compile into a function that return the html-escaped contents of the file pointed to by the template-path ‘PATH’
Translate STRING using Djula transaltion backend.
LANGUAGE is the language to translate to. The default is to use either *CURRENT-LANGUAGE* or *DEFAULT-LANGUAGE*, in that order.
BACKEND is the translation backend to use. Default is *TRANSLATION-BACKEND*.
:PARSED-VARIABLE tokens are parsed into :VARIABLE tokens by PROCESS-TOKENS
update the cl-locale dictionary files with the djula translate strings.
Project should coincide with project (asdf) name of the caveman project.
This assumes the project uses the standard caveman2 directory structure.
It does not depend on any caveman source code and
caveman or your project need not be loaded.
update a cl-locale message file with the list of translate strings
update a djula project informing the template directory and the directory of subdirectories holding the cl-locale dictionary files
URL-encodes a string using the external format EXTERNAL-FORMAT.
Provides a hook to customize template compilation.
toplevel-compiler
) name &optional error-p) ¶Return the text of the template identified by the given key.
filesystem-template-store
) name) ¶memory-template-store
) name) ¶Return a hashable key that uniquely identifies the named template.
memory-template-store
) name &optional error-p) ¶filesystem-template-store
) (name pathname
) &optional error-p) ¶Algorithm that finds a template in a filesystem-template-store.
filesystem-template-store
) (name string
) &optional error-p) ¶toplevel-compiler
)) ¶automatically generated reader method
Print an object in a template. Customize this function to implement custom printers for your objects.
compiled-template
) &rest initargs) ¶compiled-template
) stream) ¶Abstract class. Top-level class for template compilers.
Searches for template files on disk according to the given search path.
A template store with a memory cache.
This store works like FILESYSTEM-TEMPLATE-STORE, but when a template is compiled it saves the template contents in memory and templates are rendered from memory after.
This is useful for building standalone binaries, as there’s no need to ship template files once they have been compiled (they are stored in the lisp image memory).
You need to set Djula’s *current-store* to a MEMORY-TEMPLATE-STORE instance before compiling templates.
See the section on building standalong binaries in Djula manual.
The default Djula template compiler.
(make-instance (quote djula:compiler))
:fragment-compiler
This slot is read-only.
Enable/disable Lisp evaluation in templates.
List of available translation backends.
evaluates ‘BODY’ with ‘STRING-VAR’ bound to a string representing the contents of the file pointed to be the template-path ‘TEMPLATE-PATH’, returning it’s results. if there is an error while binding ‘STRING-VAR’ and *CATCH-TEMPLATE-ERRORS-P* is T then it returns a function that is suitable output for the body of a DEF-TOKEN-COMPILER form that returns some debugging info.
alter pathname as specified in the options
backup the file by copying it from filename.ext to filename-n.ext where n is the next available number.
takes a "logical statement" like you would give {% if %} that has been parsed
into a list of keywords [eg: ’(:not :foo) or ’(:foo :and :baz) or
‘(:foo.bar :or :list.1)] and turns them into a thunk predicate for dispatching the
conditional branching of the {% if %} tag. when called, the function returns two values:
1. the value returned by resolving the phrase
2. an error message string if something went wrong [ie, an invalid variable].
[note: if return value 2 is present, then its probably not safe to consider return
value 1 useful]
Compiles TOKEN.
The compilation of a TOKEN creates a LAMBDA that given a stream renders the token.
The default truth decider function for if expressions.
This is Django documentation for if expressions:
The {% if %} tag evaluates a variable, and if that variable is “true” (i.e. exists, is not empty, and is not a false boolean value)
Escapes the characters #\<, #\>, #\’, #\", and #\& for HTML output.
returns NIL if a :TAG token with the name ‘TAG-NAME’ can’t be found in ‘TOKENS’.
Otherwise returns three values:
1. a list of all the tokens up to that token
2. a list of all tokens after that token
3. T, indicating that ‘TAG-NAME’ was found
Find end tag ENDTAG taking into account possible nested tags of type TAG.
Like FIND-END-TAG, but taking into account control structures nesting.
Returns NIL if a :TAG token with the name ‘TAG-NAME’ can’t be found in ‘TOKENS’.
Otherwise returns three values:
1. a list of all the tokens up to that token
2. a list of all tokens after that token
3. T, indicating that ‘TAG-NAME’ was found
Return the filter by the name of NAME.
Return the tag compiler by the name of NAME.
Return the tag processor by the name of NAME.
Return the token processor by the name of NAME.
Return the token processor by the name of NAME.
Return the unparsed tag processor by the name of TAG-NAME.
Return the string that closes the corresponding token TYPE.
takes a variable ‘NAME’ and returns:
1. the value of ‘NAME’
2. any error string generated by the lookup (if there is an error string then the
lookup was unsuccessful)
If the STRING is an integer return an integer, otherwise return STRING as a keyword.
Join the strings in LIST, using SEPARATOR in between the elements.
Similar to Python’s str.join
Return the position of the start of next tag in STRING starting from START.
Parse if clause taking into account else and elif tokens in body. Returns a :parsed-if clause.
Return the lexer token and the index where the tag ended.
Transform the TEMPLATE into a list of lexer tokens
Removes the first ocurrence of item in sequence
Render the *ERROR-TEMPLATE* with the ERROR, the BACKTRACE and the TEMPLATE where the error ocurred.
takes a list starting wise a variable and ending with 0 or more keys or indexes [this
is a direct translation from the dot (.) syntax] and returns two values:
1. the result [looking up the var and applying index/keys]
2. an error string if something went wrond [note: if there is an error string then
the result probably shouldn’t be considered useful.
returns two values:
1. all clause tokens that appear _before_ the first :ELSE token 2. all clause tokens that appear _after_ the first :ELSE token
test if s is a string that contains a string representation
given a djula html template string, find all the substrings to be translated
Return the token-type for CHAR.
Parser: transform and return the result, when the transformation applies (not null)
STRING without whitespace at ends.
If the STRING is larger than MAX-LENGTH, truncate it and append the ELISION-STRING so that the total length is MAX-LENGTH. Otherwise return the STRING unmodified. If the truncation is impossible to accomplish, return nil.
compiled-template
)) ¶compiled-template
)) ¶compiled-template
)) ¶The compiled template (a closure)
Create a list from ITERABLE.
This is used in {% for %} to convert different types.
Library user can extend this generic function, add methods for types to iterate on.
compiled-template
)) ¶compiled-template
)) ¶Extends for Include files.
filesystem-template-store
)) ¶filesystem-template-store
)) ¶User-provided list of template locations.
compiled-template
)) ¶compiled-template
)) ¶compiled-template
)) ¶The filepath of the template
compiled-template
)) ¶compiled-template
)) ¶The write date of the template file
A compiled template
funcallable-standard-object
.
The compiled template (a closure)
:compiled-template
Extends for Include files.
(quote nil)
:linked-templates
The filepath of the template
(error "provide the template file")
:template-file
The write date of the template file
Jump to: | (
A B C D E F G I J L M N O P R S T U V W |
---|
Jump to: | (
A B C D E F G I J L M N O P R S T U V W |
---|
Jump to: | *
+
C F L S T |
---|
Jump to: | *
+
C F L S T |
---|
Jump to: | C D F L M P S T U V |
---|
Jump to: | C D F L M P S T U V |
---|