Next: , Previous: , Up: Textual Conversion Packages   [Contents][Index]

4.5 HTML

(require 'html-form)

Function: html:atval txt

Returns a string with character substitutions appropriate to send txt as an attribute-value.

Function: html:plain txt

Returns a string with character substitutions appropriate to send txt as an plain-text.

Function: html:meta name content

Returns a tag of meta-information suitable for passing as the third argument to html:head. The tag produced is ‘<META NAME="name" CONTENT="content">’. The string or symbol name can be ‘author’, ‘copyright’, ‘keywords’, ‘description’, ‘date’, ‘robots’, ….

Function: html:http-equiv name content

Returns a tag of HTTP information suitable for passing as the third argument to html:head. The tag produced is ‘<META HTTP-EQUIV="name" CONTENT="content">’. The string or symbol name can be ‘Expires’, ‘PICS-Label’, ‘Content-Type’, ‘Refresh’, ….

Function: html:meta-refresh delay uri
Function: html:meta-refresh delay

Returns a tag suitable for passing as the third argument to html:head. If uri argument is supplied, then delay seconds after displaying the page with this tag, Netscape or IE browsers will fetch and display uri. Otherwise, delay seconds after displaying the page with this tag, Netscape or IE browsers will fetch and redisplay this page.

Function: html:head title backlink tags …
Function: html:head title backlink
Function: html:head title

Returns header string for an HTML page named title. If backlink is a string, it is used verbatim between the ‘H1’ tags; otherwise title is used. If string arguments tags ... are supplied, then they are included verbatim within the <HEAD> section.

Function: html:body body …

Returns HTML string to end a page.

Function: html:pre line1 line …

Returns the strings line1, lines as PREformmated plain text (rendered in fixed-width font). Newlines are inserted between line1, lines. HTML tags (‘<tag>’) within lines will be visible verbatim.

Function: html:comment line1 line …

Returns the strings line1 as HTML comments.

4.6 HTML Forms

Function: html:form method action body …

The symbol method is either get, head, post, put, or delete. The strings body form the body of the form. html:form returns the HTML form.

Function: html:hidden name value

Returns HTML string which will cause name=value in form.

Function: html:checkbox pname default

Returns HTML string for check box.

Function: html:text pname default size …

Returns HTML string for one-line text box.

Function: html:text-area pname default-list

Returns HTML string for multi-line text box.

Function: html:select pname arity default-list foreign-values

Returns HTML string for pull-down menu selector.

Function: html:buttons pname arity default-list foreign-values

Returns HTML string for any-of selector.

Function: form:submit submit-label command
Function: form:submit submit-label

The string or symbol submit-label appears on the button which submits the form. If the optional second argument command is given, then *command*=command and *button*=submit-label are set in the query. Otherwise, *command*=submit-label is set in the query.

Function: form:image submit-label image-src

The image-src appears on the button which submits the form.

Function: form:reset

Returns a string which generates a reset button.

Function: form:element pname arity default-list foreign-values

Returns a string which generates an INPUT element for the field named pname. The element appears in the created form with its representation determined by its arity and domain. For domains which are foreign-keys:

single

select menu

optional

select menu

nary

check boxes

nary1

check boxes

If the foreign-key table has a field named ‘visible-name’, then the contents of that field are the names visible to the user for those choices. Otherwise, the foreign-key itself is visible.

For other types of domains:

single

text area

optional

text area

boolean

check box

nary

text area

nary1

text area

Function: form:delimited pname doc aliat arity default-list foreign-values

Returns a HTML string for a form element embedded in a line of a delimited list. Apply map form:delimited to the list returned by command->p-specs.

Function: html:delimited-list row …

Wraps its arguments with delimited-list (‘DL’ command.

Function: get-foreign-choices tab

Returns a list of the ‘visible-name’ or first fields of table tab.

Function: command->p-specs rdb command-table command

The symbol command-table names a command table in the rdb relational database. The symbol command names a key in command-table.

command->p-specs returns a list of lists of pname, doc, aliat, arity, default-list, and foreign-values. The returned list has one element for each parameter of command command.

This example demonstrates how to create a HTML-form for the ‘build’ command.

(require (in-vicinity (implementation-vicinity) "build.scm"))
(call-with-output-file "buildscm.html"
  (lambda (port)
    (display
     (string-append
      (html:head 'commands)
      (html:body
       (sprintf #f "<H2>%s:</H2><BLOCKQUOTE>%s</BLOCKQUOTE>\\n"
                (html:plain 'build)
                (html:plain ((comtab 'get 'documentation) 'build)))
       (html:form
        'post
        (or "http://localhost:8081/buildscm" "/cgi-bin/build.cgi")
        (apply html:delimited-list
               (apply map form:delimited
                      (command->p-specs build '*commands* 'build)))
        (form:submit 'build)
        (form:reset))))
     port)))

Next: , Previous: , Up: Textual Conversion Packages   [Contents][Index]