(index ("render" 0) ("process-template-set" 633) ("process-base-template" 837) ("make-context" 1556) ("context->context" 3356) ("*site-path*" 4687) ("*template-path*" 5217) ("*template-cache-path*" 5583) ("*enable-l10n*" 5878) ("*civet-ns-prefix*" 6022) ("*civet-ns-uri*" 6294) ("*default-nsmap*" 6521) ("*sxpath-nsmap*" 6779) ("*sort-functions*" 7054))
(def (sig (procedure "(render TEMPLATE CONTEXT #!key (PORT #f) (FILE #f))" (id render))) (p "This is the main function used to transform a template to some form of useful output (such as an XHTML web page). The TEMPLATE argument should be the filename of a template, including the extension but not including the directory path. CONTEXT is a context object (see " (tt "make-context") " below for a description). There are two keyword arguments to specify an output destination: PORT is an output port, and FILE is a filename. If both are given, PORT takes precedence; if neither is given, the output will be returned as a string."))
(def (sig (procedure "(process-template-set TEMPLATE CONTEXT)" (id process-template-set))) (p "This function is similar to " (tt "render") ", but returns an SXML document rather than rendering to XML."))
(def (sig (procedure "(process-base-template TEMPLATE BLOCK-DATA CONTEXT)" (id process-base-template))) (p "This function takes an SXML template, TEMPLATE, and an alist containing SXML blocks (which generally will have been read from extension templates, but could potentially be created programmatically), and a CONTEXT object, and returns a transformed SXML document. The BLOCK-DATA alist consists of `'((NAME . (LOCALE VARS MACROS BLOCK)) ...), where NAME corresponds to the name of a block in the source template, LOCALE, VARS, and MACROS are, respectively, locale options, variables, and macros read from the template, and BLOCK is an SXML fragment consisting of a " (tt "cvt:block") " element and its content."))
(def (sig (procedure "(make-context KWARGS)" (id make-context))) (p "Returns a context object: a closure that is used to maintain state information during the processing run. The following keywords are supported:") (ul (li (tt "vars") "      alist, default = '()") (li (tt "attrs") "     alist, default = '()") (li (tt "nsmap") "     alist, default = (*default-nsmap*)") (li (tt "locale") "    alist, default = '()") (li (tt "blocks") "    alist, default = '()") (li (tt "macros") "    alist, default = '()") (li (tt "state") "     symbol, default = 'init")) (p "Directly manipulating the context object is not recommended. In general you should use " (tt "context->context") " (see below). However, should you need to get or set any values, the closure responds to the following messages:") (ul (li (tt "(set-var! SYMBOL VALUE)")) (li (tt "(update-vars! ALIST)") " ") (li (tt "(set-vars! ALIST)")) (li (tt "(get-var SYMBOL)")) (li (tt "(get-vars)")) (li (tt "(get-field OBJ-NAME FIELD-NAME)")) (li (tt "(pfx->uri NAMESPACE-PREFIX)")) (li (tt "(uri->pfx NAMESPACE-URI)")) (li (tt "(set-ns! PREFIX URI)")) (li (tt "(update-nsmap! ALIST)")) (li (tt "(set-nsmap! ALIST)")) (li (tt "(get-nsmap)")) (li (tt "(set-attrs! ALIST)")) (li (tt "(set-attr! SYMBOL VALUE)")) (li (tt "(get-attrs)")) (li (tt "(delete-attrs!)")) (li (tt "(set-block! SYMBOL SXML-FRAGMENT)") " ") (li (tt "(get-block SYMBOL)")) (li (tt "(get-blocks)")) (li (tt "(set-macro! SYMBOL SXML-FRAGMENT)") " ") (li (tt "(get-macro SYMBOL)")) (li (tt "(get-macros)")) (li (tt "(set-locale! ALIST)")) (li (tt "(set-lang! LANG-CODE)")) (li (tt "(set-country! COUNTRY-CODE)")) (li (tt "(set-encoding! ENCODING-NAME)")) (li (tt "(set-date-format! DATE-FORMAT)")) (li (tt "(get-locale)")) (li (tt "(set-state! SYMBOL)")) (li (tt "(get-state)"))))
(def (sig (procedure "(context->context CONTEXT KWARGS)" (id context->context))) (p "Returns a new context object based on the existing one, with all its data copied from the original except as modified by the KWARGS. The following keyword arguments are supported.") (ul (li (tt "+vars") "    Updates or sets one or more variables. Takes an alist.") (li (tt "+attrs") "   Updates or sets one or more attributes. Takes an alist.") (li (tt "+nsmap") "   Updates or sets one or more namespace bindings. Takes an alist.") (li (tt "+locale") "  Updates or sets one or more locale options. Takes an alist.") (li (tt "+blocks") "  Updates or sets one or more template blocks. Takes an alist.") (li (tt "+macros") "  Updates or sets one or more template macros. Takes an alist.") (li (tt "-vars") "    Unsets one or more variables. Takes a list of symbols.") (li (tt "-attrs") "   Unsets one or more attributes. Takes a list of symbols.") (li (tt "-nsmap") "   Unsets one or more namespace bindings. Takes a list of symbols.") (li (tt "-locale") "  Unsets one or more locale options. Takes a list of symbols.") (li (tt "-blocks") "  Unsets one or more template blocks. Takes a list of symbols.") (li (tt "-macros") "  Unsets one or more template macros. Takes a list of symbols.") (li (tt "state") "    Sets the state. Takes a symbol.")))
(def (sig (parameter "*site-path*" (id *site-path*))) (p "The root directory of your web site. The template path is automatically calculated from this path unless you set " (tt "*template-path*") ". If the value of this parameter is " (tt "#f") ", the processor assumes that the current working directory is the site path; likewise, if you set a relative path, that path is assumed to be relative to the current directory. Therefore it is a good idea to set this parameter to an absolute path.") (p (b "Default:") " " (tt "#f")))
(def (sig (parameter "*template-path*" (id *template-path*))) (p "The directory where templates are stored. If the parameter is set to " (tt "#f") ", the processor will look for templates in a " (tt "templates") " subdirectory of the site path. Storing templates in subdirectories of the template path is not currently supported.") (p (b "Default:") " " (tt "#f")))
(def (sig (parameter "*template-cache-path*" (id *template-cache-path*))) (p "The directory where cached SXML templates are stored. If it is set to " (tt "#f") ", cached templates will be searched for in a " (tt ".cache") " subdirectory of the template path.") (p (b "Default:") " " (tt "#f")))
(def (sig (parameter "*enable-l10n*" (id *enable-l10n*))) (p "Enable localization? Currently has no effect.") (p (b "Default:") " " (tt "#f")))
(def (sig (parameter "*civet-ns-prefix*" (id *civet-ns-prefix*))) (p "A symbol representing the prefix to be used for Civet vocabulary elements. Do not override this unless you are actually using a different prefix in your templates.") (p (b "Default:") " " (tt "'cvt")))
(def (sig (parameter "*civet-ns-uri*" (id *civet-ns-uri*))) (p "The namespace URI for Civet vocabulary elements. Overriding this is not recommended.") (p (b "Default:") " " (tt "\"http://xmlns.therebetygers.net/civet/0.2\"")))
(def (sig (parameter "*default-nsmap*" (id *default-nsmap*))) (p "The default namespace map to be used when loading XML templates.") (p (b "Default:")) (pre "   `((#f . \"http://www.w3.org/1999/xhtml\")\n     (,(*civet-ns-prefix*) . ,(*civet-ns-uri*)))))"))
(def (sig (parameter "*sxpath-nsmap*" (id *sxpath-nsmap*))) (p "The default namespace map to be used for SXPath expressions and serialization.") (p (b "Default:")) (pre "   `((*default* . \"http://www.w3.org/1999/xhtml\")\n     (,(*civet-ns-prefix*) . ,(*civet-ns-uri*)))"))
(def (sig (parameter "*sort-functions*" (id *sort-functions*))) (p "A mapping from data type symbols to sorting functions to be used in " (tt "for") " loops. For each \"built-in\" data type there are two functions specified: the first is used for ascending sorts, the second for descending.") (p (b "Default:")) (pre "   `((string . (,string<? ,string>?))\n     (char . (,char<? ,char>?))\n     (number . (,< ,>))\n     (boolean . (,(lambda (a b) (or (not a) b)) ,(lambda (a b) (or a (not b))))))"))
