HTML Code Generation

"conrad bookout" <[email protected]>
Newsgroups gmane.lisp.cl-http
Message-ID <[email protected]>
Greetings!

HTML4.LISP (attached) will generate HTML code based on the current DTD (2.0, 
3.2, 4.0 strict/transitional/frameset) loaded into the HTML-PARSER. The 
HTML-PARSER must be loaded *and* initialized before loading HTML4.

DECLARE functions are generated for ELEMENTS without content (META, LINK, 
IMG,...) and WITH macros are generated for ELEMENTS with content (HTML, 
HEAD, BODY,...). All but a few (DECLARE-DOCUMENT-TYPE, WITH-HEADING, 
WITH-SECTION-HEADING, WITH-PHRASE, WITH-FONTSTYLE) functions/macros are 
automatically generated.

The DTD ELEMENT names were chosen as the names of the FUNCTIONS/MACROS (with 
the appropriate DECLARE- or WITH- suffix) and the DTD ATTRIBUTE names were 
chosen as the names of the attribute parameters. For example, WITH-HEAD, 
DECLARE-META, :LANG, and :DIR. Alias function/macros are created in an 
attempt to be somewhat backwardly compatible: for example, WITH-PARAGRAPH 
may be used instead of WITH-P. You may generate your own aliased 
functions/macros for any of the elements defined in the DTD. (See the code.) 
However, aliases are not created for attributes: so, for example, :ALIGN 
must be used instead of :ALIGNMENT. Furthermore, keyword parameters are used 
almost exclusively for attributes: the exception being backwardly compatible 
functions/macros like DECLARE-TITLE and WITH-SECTION-HEADING. Use the 
CL-HTTP Documentation Facility after loading this file for a complete list 
of HTML4 functions, macros, and attributes for the currently-loaded DTD.

Missing required attributes (for example, BDO DIR) signal an error. 
Extraneous attributes are simply ignored (or should they also signal an 
error?) Attribute values are verified and bad values signal an error. 
However, this verification is somewhat loose: for example, pixels are 
verified as cdata (as currently defined in the HTML-PARSER DTDs).

Tested under MacIvory/Genera 8.3, CL-HTTP 156, HTML-PARSER V11. Comments and 
ports to other LISPs welcome!

conrad bookout
taos, new mexico




_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail
html4.lisp (application/octet-stream, 15.5 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.