Common Lisp Package: CL-EMB

README:

FUNCTION

Public

CLEAR-EMB (NAME)

Remove named emb code.

CLEAR-EMB-ALL

Remove all registered emb code.

CLEAR-EMB-ALL-FILES

Remove all registered file emb code (registered/executed by a pathname).

CLEAR-EXPAND-TEMPLATE-TAG-HASH

Removes all scanners for template tags from cache.

PPRINT-EMB-FUNCTION (NAME)

DEBUG function. Pretty prints function form, if *DEBUG* was t when the function was registered.

Private

CONSTRUCT-EMB-BODY-STRING (CODE &OPTIONAL (START 0))

Takes a string containing an emb code and returns a string containing the lisp code that implements that emb code.

CONSTRUCT-EMB-FUNCTION (CODE)

Builds and compiles the emb-function.

CONTENTS-OF-FILE (PATHNAME)

Returns a string with the entire contents of the specified file.

ECHO (STRING &KEY (ESCAPE *ESCAPE-TYPE*))

Emit given STRING. Escape if wanted (global or via ESCAPE keyword). STRING can be NIL.

EXPAND-TEMPLATE-TAGS (STRING)

Expand template-tags (@if, @else, ...) to Common Lisp. Replacement and regex in *TEMPLATE-TAG-EXPAND*

GET-EMB-FUNCTION (NAME)

Returns the named function implementing a registered emb code. Rebuilds it when text template was a file which has been modified.

INSERT-FILE (FILENAME)

Get given file FILENAME.

MAKE-EMB-FUNCTION (PATH TIME FUNCTION &OPTIONAL FORM)

Constructor for class EMB-FUNCTION.

SCANNER-FOR-EXPAND-TEMPLATE-TAG (TAG)

Returns a CL-PPCRE scanner which matches a template tag expanded by EXPAND-TEMPLATE-TAGS. Scanners are memoized in SCANNER-HASH once they are created.

SET-SPECIALS (MATCH REGISTERS)

Parse parameter(s) of @set and set special variables like e. g. *ESCAPE-TYPE*.

STRING-TO-KEYWORD (STRING)

Interns a given STRING uppercased in the keyword package.

URL-ENCODE (STRING)

URL-encode a string.

Undocumented

ESCAPE-FOR-XML (STRING)

NEXT-CODE (STRING START)

TAG-TEMPLATE (TAG-TYPE)

MACRO

Private

GETF-EMB (KEY)

Search either plist TOPENV or ENV according to the search path in KEY. KEY is a string.

WITH-LOCK (&BODY BODY)

Locking all accesses to *functions*

GENERIC-FUNCTION

Public

EXECUTE-EMB (NAME &KEY ENV GENERATOR-MAKER)

Execute named emb code. Returns a string. Keyword parameter ENV to pass objects to the code. ENV must be a plist.

REGISTER-EMB (NAME CODE)

Register given CODE as NAME.

Private

Undocumented

MAKE-REPLACE (REPLACEMENT)

SLOT-ACCESSOR

Private

Undocumented

EMB-FUNCTION-FORM (OBJECT)

SETFEMB-FUNCTION-FORM (NEW-VALUE OBJECT)

EMB-FUNCTION-FUNCTION (OBJECT)

SETFEMB-FUNCTION-FUNCTION (NEW-VALUE OBJECT)

EMB-FUNCTION-PATH (OBJECT)

SETFEMB-FUNCTION-PATH (NEW-VALUE OBJECT)

EMB-FUNCTION-TIME (OBJECT)

SETFEMB-FUNCTION-TIME (NEW-VALUE OBJECT)

VARIABLE

Public

*DEBUG*

Debugging for CL-EMB.

*EMB-END-MARKER*

End of scriptlet or expression.

*EMB-START-MARKER*

Start of scriptlet or expression. Remember that a following #= indicates an expression.

*ESCAPE-TYPE*

Default value for escaping @var output.

*FUNCTION-PACKAGE*

Package the emb function body gets interned to.

*LOCKING-FUNCTION*

Function to call to lock access to an internal hash table. Must accept a function designator which must be called with the lock hold.

Private

*FUNCTIONS*

Table mapping names to emb-function instances.

*TEMPLATE-TAG-EXPAND*

List of conses. FIRST is regex, REST replacement (STRING or FUNCTION). Functions get called with two parameters: match and list of registers.

Undocumented

*SET-PARAMETER-LIST*

*SET-SPECIAL-LIST*

CLASS

Private

Undocumented

EMB-FUNCTION