I've been working on a script to automagically generate html 4.0 tags. It's kinda big, probably ugly. With it you can do things like: h1/text: "Hello World" h1/style: "background:white" h1/out The 'out function spits out a formatted tag like <h1 style="background:white">Hello World</h1>. Basically I took all the html4 tags and turned them into objects, with all the attributes as properties or fields of the object. You can make your own tags and customize them, then use them throughout a page. You can use a 'reset function, h1/reset, to set the tags back to a default, like <h1>. I'd appreciate any comments. Please be gentle, I'm a newbie......:-)I'm attaching a test script I used to test everything, which should be modified to work on your system. Thanks for suggestions, comments, etc. Scott ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
REBOL [ Title: "HTML 4 Generator" Date: 24-Feb-00 Name: 'HTML4 Version: 1.0 File: %HTML4.r Author: "Scott Woodrum" Email: [EMAIL PROTECTED] Category: [web] Tabs: 4 Purpose: {Build properly formatted html4 tags for dynamic web page creation(cgi) } Comment: { Every html tag has a corresponding object. Some object names have been changed to prevent name clashes with REBOL or for simplicity, i.e., <HEAD> = _head | <OBJECT> = obj | <SELECT> = sel | _form=<FORM>. Every object has an 'out function (prints out the constructed tag) and a 'reset function (resets the tags attributes to some default value). Some tag objects have an 'end function to print out a closing tag. Make sure for cgi stuff you call the 'header function at the start of your script. Not everything here is as clean or efficient as I would like, i.e., the cut and pasty reset function. Further note: most of this stuff really only works with IE4 or IE5. I did some testing with Mozilla alpha releases (http://www.mozilla.org) and everything seemed to work OK. Current versions of Netscape are iffy. Some things work, some things don't. I included an ugly test page I used during development to exercize tags/objects. I didn't include any tags that are DEPRECATED by w3c.} ] gentag: func [obj [object!]][ tag: [] clear tag words: next first obj foreach word words [ either function? get in obj word [][ if (not none? get in obj word) [ either equal? (mold word) "text" [] [ append tag to-lit-word word append tag get in obj word ] ] ] ] return tag ] Begin: func ["The <HTML> tag."][ print [<HTML>] ] End: func ["The </HTML> tag."][ print [</HTML>] ] header: func ["Must have this at the beginning of your script, if using for cgi stuff."][ print ["Content-Type: text/html^/"] ] _head: make object! [ http-equiv: none author: none keywords: none description: none title: none style: none out: func [][ print [<HEAD>newline] if (not none? http-equiv) [print build-tag [meta http-equiv (http-equiv)]] if (not none? author) [print build-tag [meta name "AUTHOR" content (author)]] if (not none? keywords) [print build-tag [meta name "KEYWORDS" content (keywords)]] if (not none? description) [print build-tag [meta name "DESCRIPTION" content (description)]] if (not none? style) [ print build-tag [style type "text/css"] print [style newline </STYLE>]] if (not none? title) [print [{<TITLE>}title{</TITLE>}newline{</HEAD>}]] ] end: func [] [print [</HEAD>]] ] ; end of _head object body: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [body (tag)]] ] end: func [] [print [</BODY>]] ] h1: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;the text between <H1></H1> out: func [] [ tag: gentag self print [build-tag [h1 (tag)]] print text print [</h1>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] h2: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [h2 (tag)]] print text print [</h2>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] h3: make object! [ ;attributes id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [][ tag: gentag self print [build-tag [h3 (tag)]] print text print [</h3>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] h4: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [h4 (tag)]] print text print [</h4>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] h5: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [h5 (tag)]] print text print [</h5>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] h6: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [h6 (tag)]] print text print [</h6>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] hr: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [hr (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] a: make object! [ id: none class: none lang: none dir: none title: none style: none events: none name: none shape: none coords: none target: none tabindex: none accesskey: none href: none text: "" out: func [][ tag: gentag self print [build-tag [a (tag)]] print text ] end: func [][ print [</a>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none name: none shape: none coords: none target: none tabindex: none accesskey: none href: none text: "" ] ] ; end of 'a object span: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [span (tag)]] ] end: func [] [ print [</span>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] br: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [br (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] comment: func ["An HTML comment. Takes a string as an argument." text [string!]][ print [{<!--}text{-->}] ] p: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [] [ tag: gentag self print [build-tag [p (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] img: make object! [ id: none class: none lang: none dir: none title: none style: none events: none src: none longdesc: none alt: none name: none ismap: none usemap: none out: func [][ tag: gentag self print [build-tag [img (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none src: none longdesc: none alt: none name: none ismap: none usemap: none ] ] ; end of image object pre: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;the text between <PRE></PRE> out: func [] [ tag: gentag self print [build-tag [pre (tag)]] print text print [</pre>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] blockquote: make object! [ id: none class: none lang: none dir: none title: none style: none events: none cite: none text: "" ; the text between <BLOCKQUOTE></BLOCKQUOTE> out: func [][ tag: gentag self print [build-tag [blockquote (tag)]] print text print [</blockquote>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none cite: none text: "" ] ] caption: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ; the text between <CAPTION></CAPTION> out: func [][ tag: gentag self print [build-tag [caption (tag)]] print text print [</caption>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none cite: none text: "" ] ] table: make object![ id: none class: none lang: none dir: none title: none style: none events: none summary: none width: none frame: none rules: none border: none cellspacing: none cellpadding: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none cite: none summary: none width: none frame: none rules: none border: none cellspacing: none cellpadding: none ] out: func [][ tag: gentag self print [build-tag [table (tag)]] ] end: func [][ print [</table>] ] ] thead: make object! [ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none ] out: func [][ tag: gentag self print [build-tag [thead (tag)]] ] end: func [][ print [</thead>] ] ]; end of thead tfoot: make object! [ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none ] out: func [] [ tag: gentag self print [build-tag [tfoot (tag)]] ] end: func [][ print [</tfoot>] ] ]; end of tfoot tbody: make object! [ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none ] out: func [][ tag: gentag self print [build-tag [tbody (tag)]] ] end: func [][ print [</tbody>] ] ]; end of tbody colgroup: make object! [ id: none class: none lang: none dir: none title: none style: none events: none span: none width: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none span: none width: none ] out: func [] [ tag: gentag self print [build-tag [colgroup (tag)]] ] end: func [][ print [</colgroup>] ] ]; end of colgroup col: make object! [ id: none class: none lang: none dir: none title: none style: none events: none span: none width: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none span: none width: none ] out: func [][ tag: gentag self print [build-tag [col (tag)]] ] end: func [][ print [</col>] ] ]; end of col tr: make object! [ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none ] out: func [][ tag: gentag self print [build-tag [tr (tag)]] ] end: func [][ print [</tr>] ] ]; end of tr th: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;text between the <TH></TH> tags headers: none scope: none abbr: none axis: none rowspan: none colspan: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none text: "" headers: none scope: none abbr: none axis: none rowspan: none colspan: none ] out: func [][ tag: gentag self print [build-tag [th (tag)]] print text print [</th>] ] ]; end of tr td: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;text between the <TD></TD> tags headers: none scope: none abbr: none axis: none rowspan: none colspan: none align: none char: none charoff: none valign: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none align: none char: none charoff: none valign: none text: "" headers: none scope: none abbr: none axis: none rowspan: none colspan: none ] out: func [][ tag: gentag self print [build-tag [td (tag)]] print text ] end: func [][ print [</td>] ] ]; end of td div: make object! [ id: none class: none lang: none dir: none title: none style: none events: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] out: func [][ tag: gentag self print [build-tag [div (tag)]] ] end: func [][ print [</div>] ] ] _form: make object! [;can't call it form - name collision! id: none class: none lang: none dir: none title: none style: none events: none action: none method: "GET" enctype: none accept-charset: none accept: none name: none reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none action: none method: "GET" enctype: none accept-charset: none accept: none name: none ] out: func [][ tag: gentag self print [build-tag [form (tag)]] ] end: func [][ print [</form>] ] words?: func [] [probe next first self] ];end of form object _input: make object! [ id: none class: none lang: none dir: none title: none style: none events: none type: none name: none value: none size: none maxlength: none checked: none src: none alt: none accept: none readonly: none disabled: none tabindex: none accesskey: none ismap: none usemap: none reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none type: none name: none value: none size: none maxlength: none checked: none src: none alt: none accept: none readonly: none disabled: none tabindex: none accesskey: none ismap: none usemap: none ]; end of reset function out: func [][ tag: gentag self print [build-tag [input (tag)]] ]; end of out function end: func [][ print [</input>] ] ];end of _input object iframe: make object! [ id: none class: none lang: none dir: none title: none style: none events: none longdesc: none name: none width: none height: none src: none frameborder: none marginwidth: none marginheight: none scrolling: none reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none longdesc: none name: none width: none height: none src: none frameborder: none marginwidth: none marginheight: none scrolling: none ] out: func [][ tag: gentag self print [build-tag [iframe (tag)]] ] end: func [][ print [</iframe>] ] ] cite: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [cite (tag)]] print text print [</cite>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ];end of cite object big: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [big (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</big>] ] ] tt: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [tt (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</tt>] ] ] b: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [b (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</b>] ] ] small: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [small (tag)]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</small>] ] ] code: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [code (tag)]] ] end: func [][ print [</code>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] em: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [] [ tag: gentag self print [build-tag [em (tag)]] ] end: func [][ print [</em>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] strong: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [strong (tag)]] ] end: func [][ print [</strong>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] dfn: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [dfn (tag)]] ] end: func [][ print [</dfn>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] samp: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [samp (tag)]] ] end: func [][ print [</samp>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] kbd: make object![ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [kbd (tag)]] ] end: func [][ print [</kbd>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] var: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [var (tag)]] ] end: func [][ print [</var>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] abbr: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [abbr (tag)]] ] end: func [][ print [</abbr>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] acronym: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [acronym (tag)]] ] end: func [][ print [</acronym>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] dl: make object![ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [dl (tag)]] ] end: func [][ print [</dl>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] dt: make object![ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [dt (tag)]] ] end: func [][ print [</dt>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] dd: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [dd (tag)]] ] end: func [][ print [</dd>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] del: make object! [ id: none class: none lang: none dir: none title: none style: none events: none cite: none datetime: none text: "" out: func [][ tag: gentag self prin [build-tag [del (tag)] text [</del>]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none cite: none datetime: none text: "" ] ] ins: make object! [ id: none class: none lang: none dir: none title: none style: none events: none cite: none datetime: none text: "" out: func [][ tag: gentag self prin [build-tag [ins (tag)] text [</ins>]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none cite: none datetime: none text: "" ] ] ;end of ins fieldset: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [fieldset (tag)]] ] end: func [][ print [</fieldset>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] legend: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" accesskey: none out: func [][ tag: gentag self print [build-tag [legend (tag)]text [</legend>]] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: none accesskey: none ] ] frame: make object! [ id: none class: none lang: none dir: none title: none style: none events: none name: none longdesc: none src: none noresize: none scrolling: none frameborder: none marginwidth: none marginheight: none out: func [][ tag: gentag self print [build-tag [frame (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none name: none longdesc: none src: none noresize: none scrolling: none frameborder: none marginwidth: none marginheight: none ] ] frameset: make object! [ id: none class: none lang: none dir: none title: none style: none events: none rows: none cols: none out: func [][ tag: gentag self print [build-tag [frameset (tag)]] ] end: func [][ print [</frameset>] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none rows: none cols: none ] ] link: make object! [ id: none class: none lang: none dir: none title: none style: none events: none href: none hreflang: none type: none rel: none rev: none target: none media: none charset: none out: func [][ tag: gentag self print [build-tag [link (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none href: none hreflang: none type: none rel: none rev: none target: none media: none charset: none ] ] ol: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [ol (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</ol>] ] ] ul: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [ul (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</ul>] ] ] li: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [li (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none ] end: func [][ print [</li>] ] ] label: make object! [ id: none class: none lang: none dir: none title: none style: none events: none accesskey: none for: none text: "" out: func [][ tag: gentag self print [build-tag [label (tag)] text </label>] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none accesskey: none for: none text: "" ] ] map: make object! [ id: none class: none lang: none dir: none title: none style: none events: none name: "" out: func [][ tag: gentag self print [build-tag [map (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none name: "" ] ] area: make object! [ id: none class: none lang: none dir: none title: none style: none events: none shape: none coords: none nohref: none usemap: none name: none alt: none href: none target: none tabindex: none accesskey: none out: func [][ tag: gentag self print [build-tag [area (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none shape: none coords: none nohref: none usemap: none name: none alt: none href: none target: none tabindex: none accesskey: none ] ] address: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [address (tag)]] ] end: func [][ print [</address>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] noframes: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [noframes (tag)]] ] end: func [][ print [</noframes>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] noscript: make object! [ id: none class: none lang: none dir: none title: none style: none events: none out: func [][ tag: gentag self print [build-tag [noscript (tag)]] ] end: func [][ print [</noscript>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none ] ] obj: make object! [ id: none class: none lang: none dir: none title: none style: none events: none classid: none codebase: none codetype: none data: none type: none archive: none declare: none standby: none tabindex: none usemap: none name: none out: func [][ tag: gentag self print [build-tag [object (tag)]] ] reset: func [][ id: none class: none lang: none dir: none title: none style: none events: none classid: none codebase: none codetype: none data: none type: none archive: none declare: none standby: none tabindex: none usemap: none name: none ] end: func [][ print [</object>] ] ] option: make object! [ id: none class: none lang: none dir: none title: none style: none events: none selected: none value: none label: none disabled: none out: func [] [ tag: gentag self print [build-tag [option (tag)]] ] end: func [] [ print [</option>] ] reset: func [] [ id: none class: none lang: none dir: none title: none style: none events: none selected: none value: none label: none disabled: none ] ];option optgroup: make object! [ id: none class: none lang: none dir: none title: none style: none events: none disabled: none label: none out: func [] [ tag: gentag self print [build-tag [optgroup (tag)]] ] end: func [] [ print [</optgroup>] ] reset: func [] [ id: none class: none lang: none dir: none title: none style: none events: none disabled: none label: none ] ] sel: make object! [ ;this is the <select> tag! Avoiding name clash with REBOL. id: none class: none lang: none dir: none title: none style: none events: none name: none size: none multiple: none disabled: none tabindex: none out: func [] [ tag: gentag self print [build-tag [select (tag)]] ] end: func [] [ print [</select>] ] reset: func [] [ id: none class: none lang: none dir: none title: none style: none events: none name: none size: none multiple: none disabled: none tabindex: none ] ] param: make object! [ id: none name: none value: none valuetype: none type: none out: func [] [ tag: gentag self print [build-tag [param (tag)]] ] end: func [] [ print [</param>] ] reset: func [] [ id: none name: none value: none valuetype: none type: none ] ] style: make object! [ lang: none dir: none title: none media: none type: none out: func [] [ tag: gentag self print [build-tag [style (reduce tag)]] ] end: func [] [ print [</style>] ] reset: func [] [ lang: none dir: none title: none media: none type: none ] ] sup: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;the text between <sup></sup> out: func [] [ tag: gentag self print [build-tag [sup (tag)]] print text print [</sup>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] sub: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" ;the text between <sub></sub> out: func [] [ tag: gentag self print [build-tag [sub (tag)]] print text print [</sub>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] base: make object! [ href: none target: none out: func [] [ tag: gentag self print [build-tag [base (tag)]] clear tag ] reset: func [] [ href: none target: none ] ] bdo: make object! [ id: none class: none lang: none dir: none title: none style: none events: none text: "" out: func [] [ tag: gentag self print [build-tag [bdo (tag)]] print text print [</bdo>] ] reset: func ["Resets all the object values"][ id: none class: none lang: none dir: none title: none style: none events: none text: "" ] ] script: make object! [ src: none type: none defer: none charset: none out: func [][ tag: gentag self print [build-tag [script (tag)]] clear tag ] end: func [] [ print [</script>] ] reset: func [] [ src: none type: none defer: none charset: none ] ]
REBOL [ Title: "HTML 4 Generator Test Page" Date: 23-December-2000 Author: "Scott Woodrum" Version: 1.0 ] include: func [files] [ either block? files [ forall files [do first files] ] [ do files ] ] include %/d/proj/html4/html4.r ;;;;;;;;;;;;; change to wherever you put the html4 script header begin _head/style: {BODY { text-align:center;background:silver}} _head/title: "Test Page" _head/http-equiv: ["Content-Script-Type" content "text/javascript"] _head/author: "Scott Woodrum" _head/keywords: "test, test2, test3" _head/description: "This is simply a test page." _head/out _head/end body/out h1/text: "This is between h1 tags." h1/events: ['onMouseOver {message('Entered this H1 tag');return true} 'onMouseOut {message('');return true}] h1/out h2/text: "This is between h2 tags." h2/style: {background: yellow; color: red} h2/out h3/text: "This is between h3 tags." h3/out h4/text: "This is between h4 tags." h4/style: {backgound: silver;color: green;text-decoration:underline} h4/out h5/text: "This is between h5 tags." h5/out h6/text: "This is between h6 tags." h6/out hr/out a/href: http://localhost/scripts/test.r ;;;;;;;;;; change to wherever you put this script on your web server a/style: {background:purple;color:white;font:10pt Times} a/text: "This is a link to this test script." a/out a/end a/reset span/style: {font: 12pt Tahoma} span/events: ['onMouseOver {message('In a span!');return true;} 'onMouseOut {message('');return true;}] span/title: "Do you see any JavaScript in the status bar?" span/out br/out print "Testing the span tag" span/end comment "This is a test comment" br/out p/out img/src: http://validator.w3.org/images/vh40.gif img/title: "Testing the image tag." img/alt: "Testing the image tag (alt)" img/out p/out pre/text: {This text is preformatted: Line one Line two} pre/style: {font:12pt courier} pre/out p/out blockquote/cite: http://localhost blockquote/text: {Ignorance is bliss -- Cypher, The Matrix} blockquote/style: {background:green;color:white;font:10pt Tahoma} blockquote/out p/out comment "Beginning of table code" mytable: make table [] mytable/border: 1 mytable/cellspacing: 2 mytable/cellpadding: 2 mytable/out caption/text: "Names" caption/style: {background:purple;color:white} caption/out tr/out th/text: "first" th/out th/text: "last" th/out tr/end tr/out td/text: "Scott" td/out td/text: "Woodrum" td/out tr/end tr/out td/text: "" td/colspan: 2 td/style: {text-align:center} td/out a/text: "Scott's Homepage" a/href: http://www.angelfire.com/sk/sawoodrum a/out a/reset td/end tr/end mytable/end comment "end of table code" f: make _form [] button: make _input [] f/action: http://localhost/scripts/test.r button/type: "button" button/name: "testButton" button/value: "Push Me" f/out fieldset/out legend/text: "A Button" legend/style: {background:yellow} legend/out button/out button/end fieldset/end f/end iframe/src: http://www.rebol.com iframe/width: 400 iframe/height: 400 iframe/frameborder: 0 iframe/out iframe/end iframe/reset br/out prin "Ignorance is Bliss." cite/text: "Cypher, The Matrix" cite/out br/out big/out print "This text should be big." big/end br/out tt/out print "TT style text." tt/end br/out b/out print "This text should be bold." b/end br/out small/out print "This text should be small." small/end br/out em/out print "This text is emphasized." em/end br/out strong/out print "This text is strong." strong/end br/out dfn/out print "Use of the DFN tag." dfn/end br/out samp/out print "Use of the SAMP tag." samp/end br/out kbd/out print "Use of the KDB tag." kbd/end br/out var/out print "Use of the VAR tag." var/end br/out abbr/title: "Using the ABBR tag." abbr/out print "Using the ABBR tag." abbr/end br/out acronym/out print "Using the ACRONYM tag." acronym/end br/out dl/style: {text-align:left} dl/out dt/out print "Dweeb" dd/out print "A young excitable person who may mature into a nerd." dt/out print "Hacker" dd/out print "A clever REBOL programmer." dl/end br/out comment "Demonstrating INS and DEL tags" prin "Inserting and" del/text: "inserting" del/out ins/text: "deleting" ins/out print "text" comment "End of INS and DEL demonstration" br/out ul/style: {text-align:left} ul/out print "An unordered list." li/out print "Hello" li/out print "There" p/out ol/style: {text-align:left} ol/out print "An ordered list." li/out print "One" li/out print "two" li/out print "three" br/out print [{ <SCRIPT Language="JavaScript"> function message(text) { window.status = text; } </SCRIPT>}] body/end end