API Reference


An implementation of Django templates for Common Lisp.


  • Macro DEF-TAG-COMPILER (name args &body body)
    (find-package :common-lisp-user)
    When enabled, caught errors during the rendering of the template are written to the output instead of being handled by the lisp listener
  • Variable *VERBOSE-ERRORS-P*
    When enabled, errors are displayed more verbosely. Good for debugging
    When enabled, show a fancy template when an error ocurrs
  • Variable *FANCY-DEBUG-P*
    When enabled, displays fancy html based debugging information for the {% debug %} tag
  • Variable *ERROR-TEMPLATE*
    (asdf/system:system-relative-pathname :djula "templates/error-template.djhtml")
    The error template used by `render-error-template'.
  • Variable *ELISION-STRING*
    The string to be used by `truncatechars' at the end of truncated strings.
  • Generic-Function FIND-TEMPLATE (store name &optional error-p)
    Return a hashable key that uniquely identifies the named template.
  • Generic-Function FETCH-TEMPLATE (store key)
    Return the text of the template identified by the given key.
  • Class FILE-STORE
    Searches for template files on disk according to the given search path.
    The location of the most-recently fetched template.
    User-provided list of template locations.
  • Method FIND-TEMPLATE ((store file-store) name &optional (error-p t))
  • Method FETCH-TEMPLATE ((store file-store) name)
  • Variable *CURRENT-STORE*
    (make-instance 'djula:file-store)
    The currently in-use template store. Defaults to a FILE-STORE.
  • Function ADD-TEMPLATE-DIRECTORY (directory &optional (template-store *current-store*))
    Adds DIRECTORY to the search path of the TEMPLATE-STORE
  • Function FIND-TEMPLATE* (name &optional (error-p t))
  • Function FETCH-TEMPLATE* (key)
    Return the text of a template fetched from the *CURRENT-STORE*.
    The translation backend. One of :locale, :gettext
  • Function TRANSLATE (string &optional args (language (or *current-language* *default-language*)) (backend *translation-backend*))
  • Function URL-ENCODE-PATH (path)
  • Function URL-ENCODE (string)
    URL-encodes a string using the external format EXTERNAL-FORMAT.
  • Variable *AUTO-ESCAPE*


Contains the token processors
  • Function COMMENT (&rest arg-list36)
    :COMMENT tokens are removed by PROCESS-TOKENS
  • Function STRING (&rest arg-list53)
    adjacent :STRING tokens are concatenated together by PROCESS-TOKENS as a small optimization
  • Function COMMENT-TAG (&rest arg-list307)
  • Function SEMI-PARSED-IF (&rest arg-list1393)
    :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'
  • Function ALMOST-PARSED-IFEQUAL (&rest arg-list1881)
  • Function ALMOST-PARSED-IFNOTEQUAL (&rest arg-list1909)
  • Function SEMI-PARSED-JS-SCRIPT (&rest arg-list2141)
  • Function UNPARSED-TAG (&rest arg-list49)
  • Function TAG (&rest arg-list66)
    :TAG tokens are sometimes parsed into some other tokens by PROCESS-TOKENS
  • Function UNPARSED-TRANSLATION (&rest arg-list170)
  • Function UNPARSED-VARIABLE (&rest arg-list64)
    :PARSED-VARIABLE tokens are parsed into :VARIABLE tokens by PROCESS-TOKENS


This package contains the unparsed tag processors.
  • Function FILTER (&rest arg-list1079)
  • Function IFEQUAL (&rest arg-list1735)
  • Function IFNOTEQUAL (&rest arg-list1777)
  • Function JS (&rest arg-list2064)
  • Function LISP (&rest arg-list2232)
  • Function SET (&rest arg-list2316)
  • Function TRANS (&rest arg-list215)


This package contains the tag processors.
  • Function EXTENDS (&rest arg-list47)
  • Function BLOCK (&rest arg-list131)
  • Function COMMENT (&rest arg-list276)
  • Function SEMI-PARSED-FILTER (&rest arg-list1048)
  • Function FOR (&rest arg-list1147)
  • Function IF (&rest arg-list1362)
  • Function IFCHANGED (&rest arg-list1485)
  • Function SEMI-PARSED-IFEQUAL (&rest arg-list1819)
  • Function SEMI-PARSED-IFNOTEQUAL (&rest arg-list1850)
  • Function JS-SCRIPT (&rest arg-list2110)
  • Function AUTOESCAPE (&rest arg-list2444)


This package contains the token compilers.
  • Function PARSED-BLOCK (&rest arg-list162)
  • Function PARSED-FILTER (&rest arg-list1113)
  • Function PARSED-FOR (&rest arg-list1185)
  • Function PARSED-IF (&rest arg-list1413)
    :PARSED-IF tags are compiled into a function that executes the {% if %} clause
  • Function PARSED-IFCHANGED (&rest arg-list1516)
  • Function PARSED-IFEQUAL (&rest arg-list1937)
  • Function PARSED-JS (&rest arg-list2078)
  • Function PARSED-JS-SCRIPT (&rest arg-list2158)
  • Function PARSED-LISP (&rest arg-list2267)
  • Function PARSED-SET (&rest arg-list2355)
  • Function PARSED-AUTOESCAPE (&rest arg-list2475)
  • Function TAG (&rest arg-list97)
  • Function TRANSLATION (&rest arg-list272)
  • Function VARIABLE (&rest arg-list128)


This package contains the tag compilers.
  • Function ENDBLOCK (&rest arg-list148)
  • Function SUPER (&rest arg-list245)
  • Function ENDCOMMENT (&rest arg-list293)
  • Function FIRSTOF (&rest arg-list321)
  • Function CYCLE (&rest arg-list347)
  • Function DEBUG (&rest arg-list982)
  • Function SET-LANGUAGE (&rest arg-list998)
    :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]
  • Function SET-PACKAGE (&rest arg-list1014)
    :SET-PACKAGE tags are compiled into a function that set *DJULA-EXECUTE-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
  • Function SHOW-LANGUAGE (&rest arg-list1031)
    :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
  • Function ENDFILTER (&rest arg-list1065)
  • Function ENDFOR (&rest arg-list1164)
  • Function ENDIF (&rest arg-list1379)
  • Function ENDIFCHANGED (&rest arg-list1502)
  • Function ENDIFEQUAL (&rest arg-list1836)
  • Function ENDIFNOTEQUAL (&rest arg-list1867)
  • Function INCLUDE (&rest arg-list1981)
    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*
  • Function ENDJS-SCRIPT (&rest arg-list2127)
  • Function EMIT-JS (&rest arg-list2214)
  • Function SSI (&rest arg-list2406)
    if `PATH' lives in a folder reckognized by *ALLOW-INCLUDE-ROOTS*, then :SSI tags compile into a function that return the contents of the file pointed to by the template-path `PATH'. If `PARSE' is T then the function renders `PATH' as a template.
  • Function ENDAUTOESCAPE (&rest arg-list2461)
  • Function TEMPLATETAG (&rest arg-list2534)
    :SHOW-FILE tags compile into a function that return the html-escaped contents of the file pointed to by the template-path `PATH'


This package contains the djula filters. Filters are take as
  a first argument a string and return a string.
  • Function TRANS (it &rest args)


This package contains code to generate cl-locale dictionary files.
No exported symbols.


Demo of the Djula template system


  • Function START-DEMO
  • Function STOP-DEMO


Tests for the Djula template system


  • Function RUN-DJULA-TESTS