You are looking at historical revision 16508 of this page. It may differ significantly from its current revision.

html-utils

Introduction

html-tags is an extension which provides procedures to ease the generation of some frequently used [X]HTML structures.

Author

Mario Domenech Goulart

Procedures

[procedure] (itemize ITEMS #!key LIST-ID LIST-CLASS QUOTE-PROCEDURE)

Generates an HTML unordered list of ITEMS. The following attributes may be used:

[procedure] (enumerate ITEMS #!key LIST-ID LIST-CLASS QUOTE-PROCEDURE)

Generates an HTML ordered list of ITEMS. See itemize.

[procedure] (html-page CONTENTS #!key CSS TITLE (DOCTYPE "") (HEADERS "") CHARSET)

Generates an HTML page containing CONTENTS (a string). If contents starts with "<body" (case insensitive), html-page won't use the <body> tag to enclose CONTENS. The following keywords arguments may be used to customize the page:

[procedure] (combo-box NAME OPTIONS #!key DEFAULT ID FIRST-EMPTY ONCHANGE ONKEYUP DISABLED LENGTH MULTIPLE SELECTEDINDEX SIZE TABINDEX TYPE CLASS)

Generates an HTML combo box using <select> and <option> tags. The keyword parameters ID, ONCHANGE, ONKEYUP, DISABLED, LENGTH, MULTIPLE, SELECTEDINDEX, SIZE, TABINDEX, TYPE and CLASS are passed to the <select> procedure (from html-tags). DEFAULT is the value from the list of options to be selected. If FIRST-EMPTY is #t, the first option of the combo box will be empty.

<example> <expr>(combo-box "test" '(#(1 1) #(2 2) #(3 3)) first-empty: #t default: 2)</expr> <result>"&lt;select name='test' id='test'>&lt;option>&lt;/option>&lt;option value='1'>1&lt;/option>&lt;option value='2' selected>2&lt;/option>&lt;option value='3'>3&lt;/option>&lt;/select>"</result> </example>

[procedure] (hidden-input NAME/LIST #!optional VALUE ID)

Generates an HTML hidden input field. NAME/LIST can be either a string representing the name attribute of the HTML input tag or an alist mapping names to values to be used by the corresponding input tags. When NAME/LIST is a string, so representing the name of the input tag, the optional values VALUE and ID can be used to be represent the values of their corresponding HTML attributes.

[procedure] (tabularize ITEMS #!key TABLE-ID TABLE-CLASS QUOTE-PROCEDURE EVEN-ROW-CLASS ODD-ROW-CLASS)

Generates an HTML table from ITEMS (a list of lists). The following keyword parameters may be used:

Examples

<example> <expr>(tabularize '((1 2 3) (4 5 6)))</expr> <result>"&lt;table>&lt;tr>&lt;td>1&lt;/td>&lt;td>2&lt;/td>&lt;td>3&lt;/td>&lt;/tr>&lt;tr>&lt;td>4&lt;/td>&lt;td>5&lt;/td>&lt;td>6&lt;/td>&lt;/tr>&lt;/table>"</result> </example>

<example> <expr>(tabularize '((1 2 3) (4 5 6)) table-id: "test" even-row-class: "yellow" odd-row-class: "blue")</expr> <result>"&lt;table id='test'>&lt;tr class='yellow'>&lt;td>1&lt;/td>&lt;td>2&lt;/td>&lt;td>3&lt;/td>&lt;/tr>&lt;tr class='blue'>&lt;td>4&lt;/td>&lt;td>5&lt;/td>&lt;td>6&lt;/td>&lt;/tr>&lt;/table>"</result> </example>

License

BSD

Requirements

html-tags

Version history

0.1
Initial release