TITLE General HTML file SUMMARY This module provides a few simple functions that can be used to create a file of html code. It does not provide any help with creating html code. It is just code for appending lines to a big string and writing it to disk. DOCUMENTATION The services mimic what one might do in COBOL, that is, "open" the file, "write" lines to it, and then "close" it. HTMLFILE-OPEN-OUTPUT This procedure clears out a big string where the "file" will be constructed in memory. HTMLFILE-CLOSE This procedure writes to disk the big string that has been built in memory. HTMLFILE-EMIT string-of-html This procedure appends, to the big string being built in memory, the contents of the string-of-html, and follows it by a line-feed. HTMLFILE-EMIT-FILE file-name This procedure appends, to the string being built in memory, the contents of file-name, AFTER running the contents of file-name through the build-markup function which runs any REBOL code found in the template between the <% and %> markers. SCRIPT REBOL [ Title: "General HTML file" ] ;; [-----------------------------------------------------------------] ;; [ This is a module that defines a page of html that we will ] ;; [ build up and eventually write to disk. ] ;; [-----------------------------------------------------------------] HTMLFILE-PAGE: make string! 5000 HTMLFILE-FILE-ID: %htmlfile.htm HTMLFILE-OPEN-OUTPUT: does [ HTMLFILE-PAGE: copy "" ] HTMLFILE-CLOSE: does [ write HTMLFILE-FILE-ID HTMLFILE-PAGE ] HTMLFILE-EMIT: func [ HTMLFILE-LINE ] [ append repend HTMLFILE-PAGE HTMLFILE-LINE newline ] HTMLFILE-EMIT-FILE: func [ HTMLFILE-TEMPLATE [file!] ] [ HTMLFILE-EMIT build-markup read HTMLFILE-TEMPLATE ]