djula

API Reference

djula

An implementation of Django templates for Common Lisp.

DJULA

  • Macro DEF-TAG-COMPILER (name args &body body)
  • Variable *CURRENT-LANGUAGE*
    nil
  • Variable *DJULA-EXECUTE-PACKAGE*
    (find-package :common-lisp-user)
  • Variable *DEFAULT-LANGUAGE*
    :en
  • Variable *CATCH-TEMPLATE-ERRORS-P*
    t
    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*
    t
    When enabled, errors are displayed more verbosely. Good for debugging
  • Variable *FANCY-ERROR-TEMPLATE-P*
    t
    When enabled, show a fancy template when an error ocurrs
  • Variable *FANCY-DEBUG-P*
    t
    When enabled, displays fancy html based debugging information for the {% debug %} tag
  • Variable *ALLOW-INCLUDE-ROOTS*
    nil
  • 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.
    CURRENT-PATH
    The location of the most-recently fetched template.
    SEARCH-PATH   Accessor: SEARCH-PATH
    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*.
  • Variable *TRANSLATION-BACKEND*
    nil
    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*
    t

DJULA.TOKEN-PROCESSORS

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

DJULA.UNPARSED-TAG-PROCESSORS

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)

DJULA.TAG-PROCESSORS

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)

DJULA.TOKEN-COMPILERS

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)

DJULA.TAG-COMPILERS

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'

DJULA.FILTERS

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

DJULA.LOCALE

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

djula-demo

Demo of the Djula template system

DJULA-DEMO

  • Function START-DEMO
  • Function STOP-DEMO

djula-test

Tests for the Djula template system

DJULA-TEST

  • Function RUN-DJULA-TESTS