Common Lisp Package: CL-WHO

README:

FUNCTION

Public

CONC (&REST STRING-LIST)

Concatenates all arguments which should be string into one string.

CONVERT-ATTRIBUTES (ATTR-LIST)

Helper function for CONVERT-TAG-TO-STRING-LIST which converts the alist ATTR-LIST of attributes into a list of strings and/or Lisp forms.

ESCAPE-CHAR (CHAR &KEY (TEST *ESCAPE-CHAR-P*))

Returns an escaped version of the character CHAR if CHAR satisfies the predicate TEST. Always returns a string.

ESCAPE-CHAR-ALL (CHAR)

Escapes characters which aren't in the 7-bit ASCII character set.

ESCAPE-CHAR-ISO-8859-1 (CHAR)

Escapes characters that aren't defined in ISO-8859-9.

ESCAPE-CHAR-MINIMAL (CHAR)

Escapes only #<, #>, and #& characters.

ESCAPE-CHAR-MINIMAL-PLUS-QUOTES (CHAR)

Like ESCAPE-CHAR-MINIMAL but also escapes quotes.

ESCAPE-STRING (STRING &KEY (TEST *ESCAPE-CHAR-P*))

Escape all characters in STRING which pass TEST. This function is not guaranteed to return a fresh string. Note that you can pass NIL for STRING which'll just be returned.

ESCAPE-STRING-ALL (STRING)

Escapes all characters in STRING which aren't in the 7-bit ASCII character set.

ESCAPE-STRING-ISO-8859-1 (STRING)

Escapes all characters in STRING which aren't defined in ISO-8859-1.

ESCAPE-STRING-MINIMAL (STRING)

Escapes only #<, #>, and #& in STRING.

ESCAPE-STRING-MINIMAL-PLUS-QUOTES (STRING)

Like ESCAPE-STRING-MINIMAL but also escapes quotes.

HTML-MODE

Returns the current HTML mode. :SGML for (SGML-)HTML, :XML for XHTML and :HTML5 for HTML5 (HTML syntax).

SETFHTML-MODE (MODE)

Sets the output mode to XHTML or (SGML-)HTML. MODE can be :SGML for HTML, :XML for XHTML or :HTML5 for HTML5 (HTML syntax).

Private

EXTRACT-DECLARATIONS (FORMS)

Given a FORM, the declarations - if any - will be extracted from the head of the FORM, and will return two values the declarations, and the remaining of FORM

ISO-8859-1-ESCAPE-CHAR-P (CHAR)

Helper function for the ESCAPE-FOO-ISO-8859-1 functions to determine whether CHAR must be escaped.

MINIMAL-ESCAPE-CHAR-P (CHAR)

Helper function for the ESCAPE-FOO-MINIMAL functions to determine whether CHAR must be escaped.

MINIMAL-PLUS-QUOTES-ESCAPE-CHAR-P (CHAR)

Helper function for the ESCAPE-FOO-MINIMAL-PLUS-QUOTES functions to determine whether CHAR must be escaped.

NON-7BIT-ASCII-ESCAPE-CHAR-P (CHAR)

Helper function for the ESCAPE-FOO-ISO-8859-1 functions to determine whether CHAR must be escaped.

PROCESS-TAG (SEXP BODY-FN)

Returns a string list corresponding to the `HTML' (in CL-WHO syntax) in SEXP. Uses the generic function CONVERT-TO-STRING-LIST internally. Utility function used by TREE-TO-TEMPLATE.

STRING-LIST-TO-STRING (STRING-LIST)

Concatenates a list of strings to one string.

TREE-TO-TEMPLATE (TREE)

Transforms an HTML tree into an intermediate format - mainly a flattened list of strings. Utility function used by TREE-TO-COMMANDS-AUX.

Undocumented

HYPERDOC-LOOKUP (SYMBOL TYPE)

TREE-TO-COMMANDS (TREE STREAM &KEY PROLOGUE ((INDENT *INDENT*) *INDENT*))

MACRO

Public

WITH-HTML-OUTPUT ((VAR &OPTIONAL STREAM &REST REST &KEY PROLOGUE INDENT) &BODY BODY)

Transform the enclosed BODY consisting of HTML as s-expressions into Lisp code to write the corresponding HTML as strings to VAR - which should either hold a stream or which'll be bound to STREAM if supplied.

WITH-HTML-OUTPUT-TO-STRING ((VAR &OPTIONAL STRING-FORM &KEY (ELEMENT-TYPE ''CHARACTER) PROLOGUE INDENT) &BODY BODY)

Transform the enclosed BODY consisting of HTML as s-expressions into Lisp code which creates the corresponding HTML as a string.

Private

DEFCONSTANT (NAME VALUE &OPTIONAL DOC)

Make sure VALUE is evaluated only once (to appease SBCL).

N-SPACES (N)

A string with N spaces - used by indentation.

WITH-REBINDING (BINDINGS &BODY BODY)

WITH-REBINDING ( { var | (var prefix) }* ) form* Evaluates a series of forms in the lexical environment that is formed by adding the binding of each VAR to a fresh, uninterned symbol, and the binding of that fresh, uninterned symbol to VAR's original value, i.e., its value in the current lexical environment. The uninterned symbol is created as if by a call to GENSYM with the string denoted by PREFIX - or, if PREFIX is not supplied, the string denoted by VAR - as argument. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

WITH-UNIQUE-NAMES ((&REST BINDINGS) &BODY BODY)

Syntax: WITH-UNIQUE-NAMES ( { var | (var x) }* ) declaration* form* Executes a series of forms with each VAR bound to a fresh, uninterned symbol. The uninterned symbol is as if returned by a call to GENSYM with the string denoted by X - or, if X is not supplied, the string denoted by VAR - as argument. The variable bindings created are lexical unless special declarations are specified. The scopes of the name bindings and declarations do not include the Xs. The forms are evaluated in order, and the values of all but the last are discarded (that is, the body is an implicit PROGN).

GENERIC-FUNCTION

Public

CONVERT-TAG-TO-STRING-LIST (TAG ATTR-LIST BODY BODY-FN)

Used by PROCESS-TAG to convert `HTML' into a list of strings. TAG is a keyword symbol naming the outer tag, ATTR-LIST is an alist of its attributes (the car is the attribute's name as a keyword, the cdr is its value), BODY is the tag's body, and BODY-FN is a function which should be applied to BODY. The function must return a list of strings or Lisp forms.

VARIABLE

Public

*ATTRIBUTE-QUOTE-CHAR*

Quote character for attributes.

*DOWNCASE-TOKENS-P*

If NIL, a keyword symbol representing a tag or attribute name will not be automatically converted to lowercase. This is useful when one needs to output case sensitive XML.

*ESCAPE-CHAR-P*

Used by ESCAPE-STRING to test whether a character should be escaped.

*HTML-EMPTY-TAG-AWARE-P*

Set this to NIL to if you want to use CL-WHO as a strict XML generator. Otherwise, CL-WHO will only write empty tags listed in *HTML-EMPTY-TAGS* as <tag/> (XHTML mode) or <tag> (SGML mode and HTML5 mode). For all other tags, it will always generate <tag></tag>.

*HTML-EMPTY-TAGS*

The list of HTML tags that should be output as empty tags. See *HTML-EMPTY-TAG-AWARE-P*.

*HTML-NO-INDENT-TAGS*

The list of HTML tags that should disable indentation inside them. The initial value is a list containing only :PRE and :TEXTAREA.

*PROLOGUE*

This is the first line that'll be printed if the :PROLOGUE keyword argument is T

Private

*EMPTY-TAG-END*

End of an empty tag. Default is XML style.

*HTML-MODE*

:SGML for (SGML-)HTML, :XML (default) for XHTML, :HTML5 for HTML5.

*INDENT*

Whether to insert line breaks and indent. Also controls amount of indentation dynamically.

Undocumented

*HYPERDOC-BASE-URI*

CONSTANT

Private

+NEWLINE+

Used for indentation.

+SPACES+

Used for indentation.