;;; A collection of utilities that simply the creation of HTML. ;;; ;;; Author: Samuel A. Rebelsky ;;; Version: 1.0 of October 2000 ;;; ;;; Contents: ;;; (html-bold string) ;; Convert a string to "bold" ;;; (html-paragraph string) ;;; Put a string in a paragraph ;;; (html-document title body) ;;; Build an HTML document. ;;; (list->html lst) ;;; Convert a list of strings to an equivalent HTML list. ;;; return ;;; Generate a carriage return. ;;; MANY OTHERS NOT YET DOCUMENTED ;;; return ;;; Clearer shorthand for a carriage return. (define return (string #\newline)) ;;; (html-block string) ;;; Build a block quote from a string. ;;; Pre: The argument is a string. ;;; Post: Returns a string that corresponds to the HTML for ;;; a block quote that contains the original string. (define html-block (lambda (str) (string-append "
" return str return ""))) ;;; (html-bold string) ;;; Convert a string to bold. ;;; Pre: The argument is a string. ;;; Post: Returns a string that corresponds to the HTML for ;;; emboldening the original string. (define html-bold (lambda (str) (string-append "" str ""))) ;;; (html-italic string) ;;; Convert a string to italic. ;;; Pre: The argument is a string. ;;; Post: Returns a string that corresponds to the HTML for ;;; italicizing the original string. (define html-italic (lambda (str) (string-append "" str ""))) ;;; (html-document title body) ;;; Build an HTML document. ;;; Pre: The title is a plain-text string. The body contains valid HTML. ;;; Post: Returns valid HTML for a complete document. (define html-document (lambda (title body) (string-append "" return "
" str "
"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Sample values (define test1 (html-document "Test" (html-paragraph "Test")))