;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Copyright (C) 1999 Tony Graham ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 2 ;; of the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 1. Design Considerations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This module declares flow object macros for the elements in the ;; HTML 3.2 DTD. Using these macros makes, or should make, reading ;; and writing stylesheets for HTML output easier. ;; ;; For example, using the flow object macros to generate the HTML: ;; ;;

Link to a target

;; ;; the DSSSL code is: ;; ;; (make p ;; (make a ;; href: "#target" ;; (literal "Link to a target"))) ;; ;; Without using the macros, the DSSSL code is: ;; ;; (make element ;; gi: "p" ;; (make element ;; gi: "a" ;; attributes: (list '("href" "#target")) ;; (literal "Link to a target"))) ;; ;; As the first example shows, the flow object macro for each HTML ;; element behaves like a DSSSL flow object, and the attributes of the ;; HTML element are declared as characteristics of the HTML "flow ;; object". ;; ;; Since this is still an experimental release, note that: ;; ;; a. All characteristics are optional ;; ;; b. All characteristic values are strings ;; ;; c. No sanity checking is performed on characteristic values, other ;; than checking that values are strings. ;; ;; d. If a characteristic is not declared or its value is not a ;; string, the corresponding attribute will not appear in the HTML ;; output ;; ;; e. Characteristics for all of the attributes of the HTML 3.2 ;; elements are declared, no matter how kludgy. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 1.1 Jade command line ;; ;; Since flow object macros are part of Jade's experimental ;; extensions, include the "-2" option in the Jade command line: ;; ;; jade -ccatalog -2 -t sgml -d style.dsl in.sgml > out.html ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 1.2 Referencing the module ;; ;; a. Declare the module as an entity in the internal subset of ;; your stylesheet: ;; ;; ;; ]> ;; ;; b. Wrap your DSSSL code in a element: ;; ;; ;; (element ....) ;; ;; ;; c. Include an element for this module in ;; your stylesheet: ;; ;; ;; ;; The "use" attribute of the element must ;; match the "id" attribute of the ;; element. ;; ;; The "document" attribute of the element ;; must match the name of the entity declared in the internal ;; subset. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 1.3 Reading this module ;; ;; This module includes in its comments the complete declarations from ;; the HTML 3.2 DTD. ;; ;; The comments preceding each flow object macro declaration show both ;; the usage of the flow object macro and the HTML that is produced. ;; ;; The following example show the comment containing the declarations ;; for the
element, the usage and example output comment for the ;; br flow object macro, and the declaration for the br flow object ;; macro itself: ;; ;; ;; ;; ;; ;; ;; ;; (make br ;; ;; clear: "CLEAR") ;; ;; =>
;; (declare-flow-object-macro br ((clear #f)) ;; (make-empty-element "br" "clear" clear)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 2. External procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define debug (external-procedure "UNREGISTERED::James Clark//Procedure::debug")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 3. Flow object classes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (declare-flow-object-class element "UNREGISTERED::James Clark//Flow Object Class::element") (declare-flow-object-class empty-element "UNREGISTERED::James Clark//Flow Object Class::empty-element") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 4. Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Version number of this module (define html-fom-version "0.1") ;; Version of the HTML DTD that we map (define html-fom-html-version "3.2") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 5. Procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (cadr list) ;; ;; Return the car of the cdr of the list, i.e. the second item in the ;; list. ;; (cadr '(a b c d)) => b (define cadr (lambda (x) (car (cdr x)))) ;; (cddr list) ;; ;; Return the cdr of the cdr of the list, i.e. the third and ;; subsequent items in the list. ;; (cddr '(a b c d)) => '(c d) (define cddr (lambda (x) (cdr (cdr x)))) ;; (make-element gi children name1 value1 name2 value2...) ;; ;; Using the "element" flow object class from Jade's SGML backend, ;; make an element with the supplied generic identifier (gi) and ;; children. Any attribute name and value pairs are made into a list ;; of lists suitable for use as the value of the "attributes" ;; characteristic of the "element" flow object. The only error ;; checking on the supplied attribute name and value is that they are ;; both strings: if either is not a string, the name-value pair is ;; ignored. (define (make-element gi #!optional (children (empty-sosofo)) #!rest attributes) (make element gi: gi attributes: (let loop ((attr-list attributes) (result-list '())) (if (null? attr-list) result-list (let ((name (car attr-list)) (value (cadr attr-list))) (if (and (string? name) (string? value)) (append (list (list name value)) (loop (cddr attr-list) result-list)) (loop (cddr attr-list) result-list))))) children)) ;; (make-empty-element gi name1 value1 name2 value2...) ;; ;; Using the "empty-element" flow object class from Jade's SGML ;; backend, make an empty element with the supplied generic identifier ;; (gi). Any attribute name and value pairs are made into a list of ;; lists suitable for use as the value of the "attributes" ;; characteristic of the "empty-element" flow object. The only error ;; checking on the supplied attribute name and value is that they are ;; both strings: if either is not a string, the name-value pair is ;; ignored. (define (make-empty-element gi #!rest attributes) (make empty-element gi: gi attributes: (let loop ((attr-list attributes) (result-list '())) (if (null? attr-list) result-list (let ((name (car attr-list)) (value (cadr attr-list))) (if (and (string? name) (string? value)) (append (list (list name value)) (loop (cddr attr-list) result-list)) (loop (cddr attr-list) result-list))))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; 6. Flow object macros for HTML 3.2 elements ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; The complete text of the HTML 3.2 DTD is included in comments so ;; readers can see the derivation of the flow object macros. ;; ;; ;; This is subject to change, pending final approval by the W3C ;; member companies. Changes are limited to bug fixes at this time. ;; ;; HTML 3.2 aims to capture recommended practice as of early '96 ;; and as such to be used as a replacement for HTML 2.0 (RFC 1866). ;; Widely deployed rendering attributes are included where they ;; have been shown to be interoperable. SCRIPT and STYLE are ;; included to smooth the introduction of client-side scripts ;; and style sheets. Browsers must avoid showing the contents ;; of these element Otherwise support for them is not required. ;; ID, CLASS and STYLE attributes are not included in this version ;; of HTML. ;; ;; The next version of HTML after Wilbur is code named Cougar and ;; will add support for , client-side scripting, style ;; sheets, and extensions to fill-out forms. ;; --> ;; ;; ;; ;; ... ;; ;; -- ;; > ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ]];> ;; ;; ;; ;; ;; ;; ;; %ISOlat1; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; (make tt ;; ...) ;; => ... (declare-flow-object-macro tt (#!contents children) (make-element "tt" children)) ;; (make i ;; ...) ;; => ... (declare-flow-object-macro i (#!contents children) (make-element "i" children)) ;; (make b ;; ...) ;; => ... (declare-flow-object-macro b (#!contents children) (make-element "b" children)) ;; (make u ;; ...) ;; => ... (declare-flow-object-macro u (#!contents children) (make-element "u" children)) ;; (make strike ;; ...) ;; => ... (declare-flow-object-macro strike (#!contents children) (make-element "strike" children)) ;; (make big ;; ...) ;; => ... (declare-flow-object-macro big (#!contents children) (make-element "big" children)) ;; (make small ;; ...) ;; => ... (declare-flow-object-macro small (#!contents children) (make-element "small" children)) ;; (make sub ;; ...) ;; => ... (declare-flow-object-macro sub (#!contents children) (make-element "sub" children)) ;; (make sup ;; ...) ;; => ... (declare-flow-object-macro sup (#!contents children) (make-element "sup" children)) ;; (make em ;; ...) ;; => ... (declare-flow-object-macro em (#!contents children) (make-element "em" children)) ;; (make strong ;; ...) ;; => ... (declare-flow-object-macro strong (#!contents children) (make-element "strong" children)) ;; (make dfn ;; ...) ;; => ... (declare-flow-object-macro dfn (#!contents children) (make-element "dfn" children)) ;; (make code ;; ...) ;; => ... (declare-flow-object-macro code (#!contents children) (make-element "code" children)) ;; (make samp ;; ...) ;; => ... (declare-flow-object-macro samp (#!contents children) (make-element "samp" children)) ;; (make kbd ;; ...) ;; => ... (declare-flow-object-macro kbd (#!contents children) (make-element "kbd" children)) ;; (make var ;; ...) ;; => ... (declare-flow-object-macro var (#!contents children) (make-element "var" children)) ;; (make cite ;; ...) ;; => ... (declare-flow-object-macro cite (#!contents children) (make-element "cite" children)) ;; ;; ;; ;; ;; ;; (make font ;; size: "SIZE" ;; color: "COLOR" ;; ...) ;; => ... (declare-flow-object-macro font ((size #f) (color #f) #!contents children) (make-element "font" children "size" size "color" color)) ;; ;; ;; ;; (make br ;; clear: "CLEAR") ;; =>
(declare-flow-object-macro br ((clear #f)) (make-empty-element "br" "clear" clear)) ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; (make body ;; background: "BACKGROUND" ;; text: "TEXT" ;; link: "LINK" ;; vlink: "VLINK" ;; alink: "ALINK" ;; ...) ;; => ... (declare-flow-object-macro body ((background #f) (bgcolor #f) (text #f) (link #f) (vlink #f) (alink #f) (css-style #f) #!contents children) (make-element "body" children "background" background "bgcolor" bgcolor "text" text "link" link "vlink" vlink "alink" alink "style" css-style)) ;; ;; ;; ;; ;; (make address ;; ...) ;; =>
...
(declare-flow-object-macro address (#!contents children) (make-element "address" children)) ;; ;; ;; ;; (make div ;; align: "ALIGN" ;; ...) ;; =>
...
(declare-flow-object-macro div ((align #f) (css-style #f) #!contents children) (make-element "div" children "align" align "style" css-style)) (declare-flow-object-macro span ( (class #f) (dir #f) (id #f) (lang #f) (noindex #f) (css-style #f) (title #f) #!contents children) (make-element "span" children "class" class "dir" dir "id" id "lang" lang "noindex" noindex "style" css-style "title" title)) ;; ;; ;; ;; (make center ;; ...) ;; =>
...
(declare-flow-object-macro center (#!contents children) (make-element "center" children)) ;; ;; ;; ;; ;; ;; (make a ;; name: "NAME" ;; href: "HREF" ;; rel: "REL" ;; rev: "REV" ;; title: "TITLE" ;; ...) ;; => ... (declare-flow-object-macro a ((name #f) (href #f) (rel #f) (rev #f) (title #f) #!contents children) (make-element "a" children "name" name "href" href "rel" rel "rev" rev "title" title)) ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; (make map ;; ...) ;; => ... (declare-flow-object-macro map ((name #f) #!contents children) (make-element "map" children "name" name)) ;; ;; ;; ;; (make area ;; shape: "SHAPE" ;; coords: "COORDS" ;; href: "HREF" ;; nohref: "NOHREF" ;; alt: "ALT") ;; => ALT (declare-flow-object-macro area ((shape #f) (coords #f) (href #f) (nohref #f) (alt #f)) (make-empty-element "area" "shape" shape "coords" coords "href" href "nohref" nohref "alt" alt)) ;; ;; ;; ;; ;; ;; ;; ;; (make link ;; id: "ID" ;; href: "HREF" ;; rel: "REL" ;; rev: "REV" ;; title: "TITLE") ;; => (declare-flow-object-macro link ((id #f) (href #f) (rel #f) (rev #f) (title #f)) (make-empty-element "link" "id" id "href" href "rel" rel "rev" rev "title" title)) ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; (make img ;; src: "SRC" ;; alt: "ALT" ;; align: "ALIGN" ;; height: "HEIGHT" ;; width: "WIDTH" ;; border: "BORDER" ;; hspace: "HSPACE" ;; vspace: "VSPACE" ;; usemap: "USEMAP" ;; ismap: "ISMAP") ;; => ALT (declare-flow-object-macro img ((src #f) (alt #f) (align #f) (height #f) (width #f) (hspace #f) (vspace #f) (usemap #f) (ismap #f)) (make-empty-element "img" "src" src "alt" alt "align" align "height" height "width" width "hspace" hspace "vspace" vspace "usemap" usemap "ismap" ismap)) ;; ;; ;; ;; ;; ;; ;; ;; (make applet ;; codebase: "CODEBASE" ;; code: "CODE" ;; alt: "ALT" ;; align: "ALIGN" ;; height: "HEIGHT" ;; width: "WIDTH" ;; border: "BORDER" ;; hspace: "HSPACE" ;; vspace: "VSPACE" ;; ...) ;; => ... (declare-flow-object-macro applet ((codebase #f) (code #f) (alt #f) (align #f) (height #f) (width #f) (hspace #f) (vspace #f) #!contents children) (make-element "applet" children "codebase" codebase "code" code "height" height "width" width "hspace" hspace "vspace" vspace "usemap" usemap "ismap" ismap)) ;; ;; ;; ;; (make param ;; name: "NAME" ;; value: "VALUE") ;; => (declare-flow-object-macro param ((name #f) (value #f)) (make-empty-element "param" "name" name "value" value)) ;; ;; ;; (make textflow ;; ...) ;; => ... (declare-flow-object-macro textflow (#!contents children) (make-element "textflow" children)) ;; ;; ;; ;; ;; ;; ;; (make hr ;; align: "ALIGN" ;; noshade: "NOSHADE" ;; size: "SIZE" ;; width: "WIDTH") ;; =>
;; ;; ;; ;; (make p ;; align: "ALIGN" ;; ...) ;; =>

...

(declare-flow-object-macro p ((align #f) #!contents children) (make-element "p" children "align" align)) ;; ;; ;; ;; ;; ;; ;; ;; (make h1 ;; align: "ALIGN" ;; ...) ;; =>

...

(declare-flow-object-macro h1 ((align #f) #!contents children) (make-element "h1" children "align" align)) ;; (make h2 ;; align: "ALIGN" ;; ...) ;; =>

...

(declare-flow-object-macro h2 ((align #f) #!contents children) (make-element "h2" children "align" align)) ;; (make h3 ;; align: "ALIGN" ;; ...) ;; =>

...

(declare-flow-object-macro h3 ((align #f) #!contents children) (make-element "h3" children "align" align)) ;; (make h4 ;; align: "ALIGN" ;; ...) ;; =>

...

(declare-flow-object-macro h4 ((align #f) #!contents children) (make-element "h4" children "align" align)) ;; (make h5 ;; align: "ALIGN" ;; ...) ;; =>
...
(declare-flow-object-macro h5 ((align #f) #!contents children) (make-element "h5" children "align" align)) ;; (make h6 ;; align: "ALIGN" ;; ...) ;; =>
...
(declare-flow-object-macro h6 ((align #f) #!contents children) (make-element "h6" children "align" align)) ;; ;; ;; ;; ;; ;; ;; ;; ;; ;; (make pre ;; width: "WIDTH" ;; ...) ;; =>
...
(declare-flow-object-macro pre ((width #f) #!contents children) (make-element "pre" children "width" width)) ;; ;; ;; ;; ;; (make xmp ;; ...) ;; => ...</h> (declare-flow-object-macro xmp (#!contents children) (make-element "xmp" children)) ;; (make listing ;; ...) ;; => <listing>...</listing> (declare-flow-object-macro listing (#!contents children) (make-element "listing" children)) ;; <!ELEMENT PLAINTEXT - O %literal> ;; (make plaintext ;; ...) ;; => <plaintext>...</plaintext> (declare-flow-object-macro plaintext (#!contents children) (make-element "plaintext" children)) ;; ;; ]];> ;; ;; <!--=================== Block-like Quotes =================================--> ;; ;; <!ELEMENT BLOCKQUOTE - - %body.content> ;; (make blockquote ;; ...) ;; => <blockquote>...</blockquote> (declare-flow-object-macro blockquote (#!contents children) (make-element "blockquote" children)) ;; ;; <!--=================== Lists =============================================--> ;; ;; <!-- ;; HTML 3.2 allows you to control the sequence number for ordered lists. ;; You can set the sequence number with the START and VALUE attributes. ;; The TYPE attribute may be used to specify the rendering of ordered ;; and unordered lists. ;; --> ;; ;; <!-- definition lists - DT for term, DD for its definition --> ;; ;; <!ELEMENT DL - - (DT|DD)*> ;; <!ATTLIST DL ;; compact (compact) #IMPLIED -- more compact style -- ;; > ;; (make dl ;; compact: "COMPACT" ;; ...) ;; => <dl compact="COMPACT">...</dl> (declare-flow-object-macro dl ((compact #f) #!contents children) (make-element "dl" children "compact" compact)) ;; ;; <!ELEMENT DT - O (%text)*> ;; (make dt ;; ...) ;; => <dt>...</dt> (declare-flow-object-macro dt (#!contents children) (make-element "dt" children)) ;; <!ELEMENT DD - O %flow;> ;; (make dd ;; ...) ;; => <dd>...</dd> (declare-flow-object-macro dd (#!contents children) (make-element "dd" children)) ;; ;; <!-- Ordered lists OL, and unordered lists UL --> ;; <!ELEMENT (OL|UL) - - (LI)*> ;; ;; <!-- ;; Numbering style ;; 1 arablic numbers 1, 2, 3, ... ;; a lower alpha a, b, c, ... ;; A upper alpha A, B, C, ... ;; i lower roman i, ii, iii, ... ;; I upper roman I, II, III, ... ;; ;; The style is applied to the sequence number which by default ;; is reset to 1 for the first list item in an ordered list. ;; ;; This can't be expressed directly in SGML due to case folding. ;; --> ;; ;; <!ENTITY % OLStyle "CDATA" -- constrained to: [1|a|A|i|I] --> ;; ;; <!ATTLIST OL -- ordered lists -- ;; type %OLStyle #IMPLIED -- numbering style -- ;; start NUMBER #IMPLIED -- starting sequence number -- ;; compact (compact) #IMPLIED -- reduced interitem spacing -- ;; > ;; (make ol ;; type: "TYPE" ;; start: "START" ;; compact: "COMPACT" ;; ...) ;; => <ol type="TYPE" start="START" compact="COMPACT">...</ol> (declare-flow-object-macro ol ((type #f) (start #f) (compact #f) #!contents children) (make-element "ol" children "type" type "start" start "compact" compact)) ;; ;; <!-- bullet styles --> ;; ;; <!ENTITY % ULStyle "disc|square|circle"> ;; ;; <!ATTLIST UL -- unordered lists -- ;; type (%ULStyle) #IMPLIED -- bullet style -- ;; compact (compact) #IMPLIED -- reduced interitem spacing -- ;; > ;; (make ul ;; type: "TYPE" ;; compact: "COMPACT" ;; ...) ;; => <ul type="TYPE" compact="COMPACT">...</ul> (declare-flow-object-macro ul ((type #f) (compact #f) #!contents children) (make-element "ul" children "type" type "compact" compact)) ;; ;; <!ELEMENT (DIR|MENU) - - (LI)* -(%block)> ;; <!ATTLIST DIR ;; compact (compact) #IMPLIED ;; > ;; <!ATTLIST MENU ;; compact (compact) #IMPLIED ;; > ;; (make dir ;; compact: "COMPACT" ;; ...) ;; => <dir compact="COMPACT">...</dir> (declare-flow-object-macro dir ((compact #f) #!contents children) (make-element "dir" children "compact" compact)) ;; (make menu ;; compact: "COMPACT" ;; ...) ;; => <menu compact="COMPACT">...</menu (declare-flow-object-macro menu ((compact #f) #!contents children) (make-element "menu" children "compact" compact)) ;; ;; <!-- <DIR> Directory list --> ;; <!-- <DIR COMPACT> Compact list style --> ;; <!-- <MENU> Menu list --> ;; <!-- <MENU COMPACT> Compact list style --> ;; ;; <!-- The type attribute can be used to change the bullet style ;; in unordered lists and the numbering style in ordered lists --> ;; ;; <!ENTITY % LIStyle "CDATA" -- constrained to: "(%ULStyle|%OLStyle)" --> ;; ;; <!ELEMENT LI - O %flow -- list item --> ;; <!ATTLIST LI ;; type %LIStyle #IMPLIED -- list item style -- ;; value NUMBER #IMPLIED -- reset sequence number -- ;; > ;; (make li ;; type: "TYPE" ;; value: "VALUE" ;; ...) ;; => <li type="TYPE" value="VALUE">...</li> (declare-flow-object-macro li ((type #f) (value #f) #!contents children) (make-element "li" children "type" type "value" value)) ;; ;; <!--================ Forms ===============================================--> ;; ;; <!ELEMENT FORM - - %body.content -(FORM)> ;; <!ATTLIST FORM ;; action %URL #REQUIRED -- server-side form handler -- ;; method (%HTTP-Method) GET -- see HTTP specification -- ;; enctype %Content-Type; "application/x-www-form-urlencoded" ;; > ;; (make form ;; action: "ACTION" ;; method: "METHOD" ;; enctype: "ENCTYPE" ;; ...) ;; => <form action="ACTION" method="METHOD" enctype="ENCTYPE">...</form> (declare-flow-object-macro form ((action #f) (method #f) (enctype #f) #!contents children) (make-element "li" children "type" type "value" value)) ;; ;; <!ENTITY % InputType ;; "(TEXT | PASSWORD | CHECKBOX | RADIO | SUBMIT ;; | RESET | FILE | HIDDEN | IMAGE)"> ;; ;; <!ELEMENT INPUT - O EMPTY> ;; <!ATTLIST INPUT ;; type %InputType TEXT -- what kind of widget is needed -- ;; name CDATA #IMPLIED -- required for all but submit and reset -- ;; value CDATA #IMPLIED -- required for radio and checkboxes -- ;; checked (checked) #IMPLIED -- for radio buttons and check boxes -- ;; size CDATA #IMPLIED -- specific to each type of field -- ;; maxlength NUMBER #IMPLIED ;; src %URL #IMPLIED -- for fields with background images -- ;; align (top|middle|bottom|left|right) top -- image alignment -- ;; > ;; (make input ;; type: "TYPE" ;; name: "NAME" ;; value: "VALUE" ;; checked: "CHECKED" ;; size: "SIZE" ;; maxlength: "MAXLENGTH" ;; src: "SRC" ;; align: "ALIGN" ;; ...) ;; => <input type="TYPE" name="NAME" value="VALUE" checked="CHECKED" ;; size="SIZE" maxlength="MAXLENGTH" src="SRC" ;; align="ALIGN">...</input> (declare-flow-object-macro input ((type #f) (name #f) (value #f) (checked #f) (size #f) (maxlength #f) (src #f) (align #f)) (make-empty-element "input" "type" type "name" name "value" value "checked" checked "size" size "maxlength" maxlength "src" src "align" align)) ;; ;; <!ELEMENT SELECT - - (OPTION+)> ;; <!ATTLIST SELECT ;; name CDATA #REQUIRED ;; size NUMBER #IMPLIED ;; multiple (multiple) #IMPLIED ;; > ;; (make select ;; name: "NAME" ;; size: "SIZE" ;; multiple: "MULTIPLE" ;; ...) ;; => <select name="NAME" size="SIZE" multiple="MULTIPLE">...</select> (declare-flow-object-macro select ((name #f) (size #f) (multiple #f) #!contents children) (make-element "select" children "name" name "size" size "multiple" multiple)) ;; ;; <!ELEMENT OPTION - O (#PCDATA)*> ;; <!ATTLIST OPTION ;; selected (selected) #IMPLIED ;; value CDATA #IMPLIED -- defaults to element content -- ;; > ;; (make option ;; selected: "SELECTED" ;; value: "VALUE" ;; ...) ;; => <option selected="SELECTED" value="VALUE">...</option> (declare-flow-object-macro option ((selected #f) (value #f) #!contents children) (make-element "option" children "selected" selected "value" value)) ;; ;; <!-- Multi-line text input field. --> ;; ;; <!ELEMENT TEXTAREA - - (#PCDATA)*> ;; <!ATTLIST TEXTAREA ;; name CDATA #REQUIRED ;; rows NUMBER #REQUIRED ;; cols NUMBER #REQUIRED ;; > ;; (make textarea ;; name="NAME" ;; rows="ROWS" ;; cols="COLS" ;; ...) ;; => <textarea name="NAME" rows="ROWS" cols="COLS">...</textarea> (declare-flow-object-macro textarea ((name #f) (rows #f) (cols #f) #!contents children) (make-element "textarea" children "name" name "rows" rows "cols" cols)) ;; ;; <!--======================= Tables ========================================--> ;; ;; <!-- Widely deployed subset of the full table standard, see RFC 1942 ;; e.g. at http://www.ics.uci.edu/pub/ietf/html/rfc1942.txt --> ;; ;; <!-- horizontal placement of table relative to window --> ;; <!ENTITY % Where "(left|center|right)"> ;; ;; <!-- horizontal alignment attributes for cell contents --> ;; <!ENTITY % cell.halign ;; "align (left|center|right) #IMPLIED" ;; > ;; ;; <!-- vertical alignment attributes for cell contents --> ;; <!ENTITY % cell.valign ;; "valign (top|middle|bottom|baseline) #IMPLIED" ;; > ;; ;; <!ELEMENT table - - (caption?, tr+)> ;; <!ELEMENT tr - O (th|td)*> ;; <!ELEMENT (th|td) - O %body.content> ;; ;; <!ATTLIST table -- table element -- ;; align %Where; #IMPLIED -- table position relative to window -- ;; width %Length #IMPLIED -- table width relative to window -- ;; border %Pixels #IMPLIED -- controls frame width around table -- ;; dummy (border) #IMPLIED -- fixes SGML error for border w/o value -- ;; cellspacing %Pixels #IMPLIED -- spacing between cells -- ;; cellpadding %Pixels #IMPLIED -- spacing within cells -- ;; > ;; (make table ;; align: "ALIGN" ;; width: "WIDTH" ;; border: "BORDER" ;; dummy: "DUMMY" ;; cellspacing: "CELLSPACING" ;; cellpadding: "CELLPADDING" ;; ...) ;; => <table align="ALIGN" width="WIDTH" border="BORDER" dummy="DUMMY" ;; cellspacing="CELLSPACING" cellpadding="CELLPADDING">...</table> (declare-flow-object-macro table ((align #f) (width #f) (border #f) (dummy #f) (cellspacing #f) (cellpadding #f) #!contents children) (make-element "table" children "align" align "width" width "border" border "dummy" dummy "cellspacing" cellspacing "cellpadding" cellpadding)) ;; ;; <!ELEMENT CAPTION - - (%text;)* -- table or figure caption --> ;; <!ATTLIST CAPTION ;; align (top|bottom) #IMPLIED ;; > ;; (make caption ;; align: "ALIGN" ;; ...) ;; => <caption align="ALIGN">...</caption> (declare-flow-object-macro caption ((align #f) #!contents children) (make-element "caption" children "align" align)) ;; ;; <!ATTLIST tr -- table row -- ;; %cell.halign; -- horizontal alignment in cells -- ;; %cell.valign; -- vertical alignment in cells -- ;; > ;; (make tr ;; align: "ALIGN" ;; valign: "VALIGN" ;; ...) ;; => <tr align="ALIGN" valign="VALIGN">...</tr> (declare-flow-object-macro tr ((align #f) (valign #f) #!contents children) (make-element "tr" children "align" align "valign" valign)) ;; ;; <!ATTLIST (th|td) -- header or data cell -- ;; nowrap (nowrap) #IMPLIED -- suppress word wrap -- ;; rowspan NUMBER 1 -- number of rows spanned by cell -- ;; colspan NUMBER 1 -- number of cols spanned by cell -- ;; %cell.halign; -- horizontal alignment in cells -- ;; %cell.valign; -- vertical alignment in cells -- ;; > ;; (make th ;; nowrap: "NOWRAP" ;; rowspan: "ROWSPAN" ;; colspan: "COLSPAN" ;; align: "ALIGN" ;; valign: "VALIGN" ;; ...) ;; => <th nowrap="NOWRAP" rowspan="ROWSPAN" colspan="COLSPAN" ;; align="ALIGN" valign="VALIGN">...</th> (declare-flow-object-macro th ((nowrap #f) (rowspan #f) (colspan #f) (align #f) (valign #f) #!contents children) (make-element "tr" children "nowrap" nowrap "rowspan" rowspan "colspan" colspan "align" align "valign" valign)) ;; (make td ;; nowrap: "NOWRAP" ;; rowspan: "ROWSPAN" ;; colspan: "COLSPAN" ;; align: "ALIGN" ;; valign: "VALIGN" ;; ...) ;; => <td nowrap="NOWRAP" rowspan="ROWSPAN" colspan="COLSPAN" ;; align="ALIGN" valign="VALIGN">...</td> (declare-flow-object-macro td ((nowrap #f) (rowspan #f) (colspan #f) (align #f) (valign #f) #!contents children) (make-element "td" children "nowrap" nowrap "rowspan" rowspan "colspan" colspan "align" align "valign" valign)) ;; ;; <!--================ Document Head ========================================--> ;; ;; <!-- %head.misc defined earlier on as "SCRIPT|STYLE|META|LINK" --> ;; ;; <!ENTITY % head.content "TITLE & ISINDEX? & BASE?"> ;; ;; <!ELEMENT HEAD O O (%head.content) +(%head.misc)> ;; (make head ;; ...) ;; => <head>...</head> (declare-flow-object-macro head (#!contents children) (make-element "head" children)) ;; ;; <!ELEMENT TITLE - - (#PCDATA)* -(%head.misc) ;; -- The TITLE element is not considered part of the flow of text. ;; It should be displayed, for example as the page header or ;; window title. ;; --> ;; (make title ;; ...) ;; => <title>...</title> (declare-flow-object-macro title (#!contents children) (make-element "title" children)) ;; ;; <!ELEMENT ISINDEX - O EMPTY> ;; <!ATTLIST ISINDEX ;; prompt CDATA #IMPLIED -- prompt message --> ;; (make isindex ;; prompt: "PROMPT") ;; => <isindex prompt="PROMPT"> (declare-flow-object-macro isindex ((prompt #f)) (make-empty-element "isindex" "prompt" prompt)) ;; ;; <!-- ;; The BASE element gives an absolute URL for dereferencing relative ;; URLs, e.g. ;; ;; <BASE href="http://foo.com/index.html"> ;; ... ;; <IMG SRC="images/bar.gif"> ;; ;; The image is deferenced to ;; ;; http://foo.com/images/bar.gif ;; ;; In the absence of a BASE element the document URL should be used. ;; Note that this is not necessarily the same as the URL used to ;; request the document, as the base URL may be overridden by an HTTP ;; header accompanying the document. ;; --> ;; ;; <!ELEMENT BASE - O EMPTY> ;; <!ATTLIST BASE ;; href %URL #REQUIRED ;; > ;; (make base ;; href: "HREF") ;; => <base href="HREF"> (declare-flow-object-macro base ((href #f)) (make-empty-element "base" "href" href)) ;; ;; <!ELEMENT META - O EMPTY -- Generic Metainformation --> ;; <!ATTLIST META ;; http-equiv NAME #IMPLIED -- HTTP response header name -- ;; name NAME #IMPLIED -- metainformation name -- ;; content CDATA #REQUIRED -- associated information -- ;; > ;; (make meta ;; http-equiv: "HTTP-EQUIV" ;; name: "NAME" ;; content: "CONTENT") ;; => <meta http-equiv="HTTP-EQUIV" name="NAME" content="CONTENT"> (declare-flow-object-macro meta ((http-equiv #f) (name #f) (content #f)) (make-empty-element "meta" "http-equiv" http-equiv "name" name "content" content)) ;; ;; <!-- SCRIPT/STYLE are place holders for transition to next version of HTML --> ;; ;; <!ELEMENT STYLE - - (#PCDATA)* -(%head.misc) -- style info --> ;; (make style ;; ...) ;; => <style>...</style> (declare-flow-object-macro style (#!contents children) (make-element "style" children)) ;; <!ELEMENT SCRIPT - - (#PCDATA)* -(%head.misc) -- script statements --> ;; (make script ;; ...) ;; => <script>...</script> (declare-flow-object-macro script (#!contents children) (make-element "script" children)) ;; ;; <!--================ Document Structure ===================================--> ;; ;; <!ENTITY % version.attr "VERSION CDATA #FIXED '%HTML.Version;'"> ;; ;; <![ %HTML.Deprecated [ ;; <!ENTITY % html.content "HEAD, BODY, PLAINTEXT?"> ;; ]];> ;; <!ENTITY % html.content "HEAD, BODY"> ;; ;; <!ELEMENT HTML O O (%html.content)> ;; <!ATTLIST HTML ;; %version.attr; ;; > ;; (make html ;; version: "VERSION" ;; ...) ;; => <html version="VERSION">...</html> (declare-flow-object-macro html ((version #f) #!contents children) (make-element "html" children "version" version)) ;; ]> ]]> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; End of HTML 3.2 Flow Object Macro stylesheet module ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;