Common Lisp Package: NET.ACCELERATION.BUILDNODE-TEST

README:

FUNCTION

Private

%ENSTREAM (STREAM S-NAME CONTENT)

Helper to bind a stream or with-output-to-string it, based on whether

%MERGE-CONTS (&REST CONTS)

Takes many continuations and makes a single continuation that iterates through each of the arguments in turn

%WALK-DOM-CONT (TREE)

calls this on a dom tree (or tree list) and you get back a node and a continuation function. repeated calls to the continuation each return the next node and the next walker continuation

?XML-STYLESHEET (HREF &OPTIONAL (TYPE text/css))

adds an xml-stylesheet processing instruction to the cxml:dom document bound to the special variable *document*

ADD-CHILDREN (ELEM &REST KIDS &AUX (LIST? (LISTP ELEM)) (DOC (DOCUMENT-OF (IF LIST? (FIRST ELEM) ELEM))) (ELEM-LIST (ENSURE-LIST ELEM)))

adds some kids to an element and return that element alias for append-nodes

APPEND-NODES (TO-LOCATION &REST CHILLINS)

appends a bunch of dom-nodes (chillins) to the location specified alias of add-children

CREATE-COMPLETE-ELEMENT (DOCUMENT NAMESPACE TAGNAME ATTRIBUTES CHILDREN &OPTIONAL (NAMESPACE-PREFIX-MAP *NAMESPACE-PREFIX-MAP*))

Creates an xml element out of all the necessary components. If the tagname does not contain a prefix, then one is added based on the namespace-prefix map.

DEPTH-FIRST-NODES (TREE)

get a list of the nodes in a depth first traversal of the dom trees

DOCUMENT-OF (EL)

Returns the document of a given node (or the document if passed in)

DOCUMENT-TO-STRING (DOC)

Return a string representation of a document.

DOM-COMMENT (TEXT)

Insert a dom comment into the current *document*

FLATTEN-CHILDREN (KIDS &OPTIONAL (DOC *DOCUMENT*))

Handles flattening nested lists and vectors of nodes into a single flat list of children

INNER-HTML (STRING &OPTIONAL (TAG div) (NAMESPACE-URI http://www.w3.org/1999/xhtml) (DTD NIL) (REMOVE-WHITESPACE? T))

Parses a string containing a well formed html snippet into dom nodes inside of a newly created node. (Based loosely around the idea of setting the javascript innerHTML property) Will wrap the input in a tag (which is neccessary from CXMLs perspective) can validate the html against a DTD if one is passed, can use *xhtml1-transitional-extid* for example.

INSERT-CHILDREN (ELEM IDX &REST KIDS)

insert a bunch of dom-nodes (kids) to the location specified alias for insert-nodes

INSERT-NODES (TO-LOCATION INDEX &REST CHILLINS)

insert a bunch of dom-nodes (chillins) to the location specified alias of insert-children

LOG-TIME (&OPTIONAL (TIME (GET-UNIVERSAL-TIME)) STREAM)

returns a date as ${mon}/${d}/${y} ${h}:${min}:{s}, defaults to get-universal-time

MAKE-SCOPED-DOM-BUILDER (NODE)

Returns a new scoped dom builder, scoped to the passed in node. Nodes built with this builder will be added to the passed in node

PREPARE-ATTRIBUTE-NAME (ATTRIBUTE)

Prepares an attribute name for output to html by coercing to strings

PREPARE-ATTRIBUTE-VALUE (VALUE)

prepares a value for html out put by coercing to a string

PUSH-NEW-ATTRIBUTE (ELEM ATTRIBUTE VALUE)

if the attribute is not on the element then put it there with the specified value, returns the elem and whether or not the attribute was set

PUSH-NEW-ATTRIBUTES (ELEM &REST ATTRIBUTE-P-LIST)

for each attribute in the plist push-new into the attributes list of the elem, returns the elem

REMOVE-ATTRIBUTES (ELEM &REST ATTRIBUTES)

removes an attribute and passes the elem through, returns the elem

SCRIPT-BLOCK (FN LIST-OF-URLS)

given a list of urls, will build a list of script nodes pointing to the appropriate urls. Pass in #'xul:script or #'xhtml:script as the first argument

SET-ATTRIBUTES (ELEM &REST ATTRIBUTE-P-LIST)

set-attribute for each attribute specified in the plist, returns the elem

STYLESHEET-BLOCK (LIST &OPTIONAL (TYPE text/css))

given a list of urls, will build a list of ?xml-stylesheet nodes pointing to the appropriate urls

TRIM-AND-NULLIFY (S)

trims the whitespace from a string returning nil if trimming produces an empty string or the string 'nil'

WRITE-DOC-TO-FILE (DOC FILENAME)

Binary write-out a document. will create/overwrite any existing file named the same.

WRITE-DOCUMENT (DOCUMENT &OPTIONAL (OUT-STREAM *STANDARD-OUTPUT*))

Write the document to the designated out-stream, or *standard-ouput* by default.

WRITE-DOCUMENT-TO-CHARACTER-STREAM (DOCUMENT CHAR-STREAM)

writes a cxml:dom document to a character stream

WRITE-DOCUMENT-TO-OCTET-STREAM (DOCUMENT OCTET-STREAM)

writes a cxml:dom document to a character stream

WRITE-NORMALIZED-DOCUMENT-TO-SINK (DOCUMENT STREAM-SINK)

writes a cxml:dom document to the given stream-sink, passing the document through a namespace normalizer first, and possibly a html-compatibility-sink if *html-compatibility-mode* is set

XMLS-TO-DOM-SNIPPET (SXML &KEY (NAMESPACE http://www.w3.org/1999/xhtml))

Given a snippet of xmls, return a new dom snippet of that content

Undocumented

?PROCESSING-INSTRUCTION (TARGET DATA)

ATTRIBUTE-URI (ATTRIBUTE)

BUILDNODE-TESTS.INFO (MESSAGE &REST ARGS)

CALC-COMPLETE-TAGNAME (NAMESPACE BASE-TAG NAMESPACE-PREFIX-MAP)

COMPUTE-ATTRIBUTES (ELEMENT XMLNSP DEFAULTP)

DO-DEF-TAG-NODE (PACKAGE NAME NAMESPACE DOCSTRING &OPTIONAL FN-NAME)

GET-NAMESPACE-FROM-PREFIX (PREFIX &OPTIONAL (NAMESPACE-PREFIX-MAP *NAMESPACE-PREFIX-MAP*))

GET-PREFIX (NAMESPACE &OPTIONAL (NAMESPACE-PREFIX-MAP *NAMESPACE-PREFIX-MAP*))

HTML5-CAPABLE-CHARACTER-OUTPUT-SINK (STREAM &KEY CANONICAL INDENTATION ENCODING)

MAKE-OUTPUT-SINK (STREAM &KEY CANONICAL INDENTATION (CHAR-P T))

MAKE-SCRIPT-BLOCK-FN (FN-SCRIPT JS)

MAKE-SCRIPT-FN (FN-SCRIPT URL)

RUN-TESTS (&KEY SUITES TESTS (USE-DEBUGGER T))

TAG-SYM (N)

TRIM-WHITESPACE (S)

MACRO

Private

%WITH-SNIPPET ((TYPE &OPTIONAL STREAM) &BODY BODY)

helper to define with-html-snippet and with-xhtml-snippet

BUFFER-XML-OUTPUT ((&OPTIONAL STREAM) &BODY BODY)

buffers out sax:events to a sting xml parameters like <param:foo param:type="string"><div>bar</div></param:foo> are requested to be strings (presumably for string processing)

CLAUSE-FOR-IN-DOM-44 (&KEY ((FOR NODE) NIL) ((IN-DOM TREE) NIL) GENERATE)

A driver that will walk over every node in a set of dom trees

CLAUSE-FOR-IN-DOM-CHILDREN-46 (&KEY ((FOR KID) NIL) ((IN-DOM-CHILDREN NODES) NIL) GENERATE)

iterates over the children of a dom node as per flatten-children

CLAUSE-FOR-IN-DOM-PARENTS-45 (&KEY ((FOR PARENT) NIL) ((IN-DOM-PARENTS NODE) NIL) GENERATE)

A driver that will return each parent node up from a starting node until we get to a null parent

DEF-HTML-TAG (NAME DOC)

defines a function that will build an xhtml node (on *document*) when called

DEF-TAG-NODE (PACKAGE NAME NAMESPACE DOCSTRING &OPTIONAL FN-NAME)

Defines a tag function in the package with the name and prefix specified for example: :net.acceleration.xul "box" "xul" will create a function #'box in the :net.acceleration.xul lisp namespace. When this function is called it will create a 'xul:box' node in the xmlns provided in the namespace param

WITH-DOCUMENT (&BODY CHILLINS)

(with-document ( a bunch of child nodes of the document )) --> cxml:dom document Creates an environment in which the special variable *document* is available a document is necessary to create dom nodes and the document the nodes end up on must be the document on which they were created. At the end of the form, the complete document is returned

WITH-DOCUMENT-TO-FILE (FILENAME &BODY CHILLINS)

Creates a document block with-document upon which to add the chillins (southern for children). When the document is complete, it is written out to the specified file.

WITH-HTML-DOCUMENT (&BODY BODY)

(with-html-document ( a bunch of child nodes of the document )) --> cxml:dom document Creates an environment in which the special variable *document* is available a document is necessary to create dom nodes and the document the nodes end up on must be the document on which they were created. At the end of the form, the complete document is returned. This sets the doctype to be html 4.01 strict.

WITH-HTML-DOCUMENT-TO-FILE ((FILENAME) &BODY BODY)

Creates an html-document, writes out the results to filename

WITH-HTML-DOCUMENT-TO-STRING (NIL &BODY BODY)

trys to output a string containing all

WITH-HTML-SNIPPET ((&OPTIONAL STREAM) &BODY BODY)

builds a little piece of html-dom and renders that to a string / stream

WITH-HTML5-DOCUMENT (&BODY BODY)

(with-html5-document ( a bunch of child nodes of the document )) --> cxml:dom document Creates an environment in which the special variable *document* is available a document is necessary to create dom nodes and the document the nodes end up on must be the document on which they were created. At the end of the form, the complete document is returned. This sets the doctype to be html5 compatible <!DOCTYPE html>.

WITH-HTML5-DOCUMENT-TO-FILE ((FILENAME) &BODY BODY)

Creates an html-document, writes out the results to filename

WITH-HTML5-DOCUMENT-TO-STRING (NIL &BODY BODY)

trys to output a string containing all

WITH-XHTML-DOCUMENT (&BODY CHILLINS)

(with-xhtml-document ( a bunch of child nodes of the document )) --> cxml:dom document Creates an environment in which the special variable *document* is available a document is necessary to create dom nodes and the document the nodes end up on must be the document on which they were created. At the end of the form, the complete document is returned. This sets the doctype to be xhtml transitional.

WITH-XHTML-DOCUMENT-TO-FILE (FILENAME &BODY CHILLINS)

Creates a document block with-document upon which to add the chillins (southern for children). When the document is complete, it is written out to the specified file.

WITH-XHTML-FRAMESET-DOCUMENT (&BODY CHILLINS)

(with-xhtml-document ( a bunch of child nodes of the document )) --> cxml:dom document Creates an environment in which the special variable *document* is available a document is necessary to create dom nodes and the document the nodes end up on must be the document on which they were created. At the end of the form, the complete document is returned. This sets the doctype to be xhtml transitional.

WITH-XHTML-SNIPPET ((&OPTIONAL STREAM) &BODY BODY)

builds a little piece of xhtml-dom and renders that to a string / stream

Undocumented

BUILDNODE-TEST (NAME (&REST ARGS) &BODY BODY)

BUILDNODE-W/DOC-TEST (NAME (&REST ARGS) &BODY BODY)

EVAL-ALWAYS (&BODY BODY)

GENERIC-FUNCTION

Private

DOM-WALK (HANDLER VALUE &KEY INCLUDE-XMLNS-ATTRIBUTES INCLUDE-DOCTYPE INCLUDE-DEFAULT-VALUES RECODE (INCLUDE-XMLNS-ATTRIBUTES *INCLUDE-XMLNS-ATTRIBUTES*) (RECODE (AND)) &ALLOW-OTHER-KEYS)

An in order traversal of a subset of the dom, that calls the appropriate sax events

Undocumented

ADD-CSS-CLASS (EL NEW-CLASS)

CSS-CLASSES (EL)

GET-ATTRIBUTE (ELEM ATTRIBUTE)

HTML-OUTPUT? (DOC)

REMOVE-ALL-CHILDREN (IT)

REMOVE-ATTRIBUTE (ELEM ATTRIBUTE)

REMOVE-CSS-CLASS (EL NEW-CLASS)

SET-ATTRIBUTE (ELEM ATTRIBUTE VALUE)

TEXT-OF-DOM-SNIPPET (EL &OPTIONAL SPLICE STREAM)

VARIABLE

Private

*CDATA-SCRIPT-BLOCKS*

Should script blocks have a cdata?

*DOCUMENT*

A variable that holds the current document that is being built. see with-document.

Undocumented

*HTML-COMPATIBILITY-MODE*

*NAMESPACE-PREFIX-MAP*

*TAGS-INDENTATION-HINTS*

*XHTML1-TRANSITIONAL-EXTID*

+COMMON-WHITE-SPACE-TRIMBAG+

+HTML5-NAMESPACE+

+HTML5-TAG-SPEC+

+XHTML-NAMESPACE+

CLASS

Private

HTML-WHITESPACE-REMOVER

a stream filter to remove nodes that are entirely whitespace

SCOPED-DOM-BUILDER

A dom builder that builds inside of another dom-node

Undocumented

HTML5-CAPABLE-CHARACTER-OUTPUT-SINK (STREAM &KEY CANONICAL INDENTATION ENCODING)