HTML_LIST Procedure

Generates HTML code for lists of all types.

Usage

    HTML_LIST, list_item

Input Parameters

list_item—A 1D string array of items for the list.

Keywords

Add—Adds more elements to the current list level.

AllClose—Closes off all list levels.

CloseCurrent—Closes the current list level to further entries.

Compact—Renders the list in a compact format.

Note: The HTML compact attribute for lists is not interpreted by some browsers.

Dir—Creates a directory list.

DL—Creates a glossary list of paired items. The glossary list is a special case list interpreted as follows: list items with even-numbered indices (0, 2, 4, ...) are treated as glossary terms (<DT>); list items with odd-numbered indices (1, 3, 5, ...) are treated as definitions (<DD>).

Note: Glossary lists require that the list_item array have an even number of elements.

Menu—Creates a menu list.

Note: The Compact keyword cannot be used with the Menu keyword; menu lists don’t accept the compact attribute.

NoClose—Keeps the list open, so more lists can be added using the Add keyword in subsequent HTML_LIST commands.

OL—Creates an ordered list, where each item is ordered numerically or by ascending letters.

Safe—Handles HTML special characters (see HTML_SAFE).

UL—(The default list type.) Creates an unordered list, where each item is indicated by a special symbol. (Default: usually a bullet; however this is browser-dependent)

Discussion

The HTML_LIST procedure supports all standard HTML list elements. There are two main types of lists in HTML: “glossary” (DL) lists containing paired items; and “regular” (DIR,  MENU, OL, and UL) lists containing individual list items (LI). Unless otherwise specified, the default list type is unordered (UL).

If you want to include a lower-level (sub) list, you must use the NoClose keyword in the top list level. When NoClose is used, one or more new lists can be nested under the current list level. Open lists are closed in a separate HTML_LIST procedure call, using either the CloseCurrent or the AllClose keywords.

Example

This example creates a nested list—one bulleted list of function types (Statistics and Mathematics), with glossary lists of function names and descriptions sublisted under each bullet.

; Open an HTML file.
HTML_OPEN, Title = 'Math Functions'
; Create a bullet item for Statistics functions, and 
; leave the list open.
HTML_LIST, ['Statistics'], /NoClose
; Add DL (glossary) list under "Statistics" bullet to include the
; AVG and STDEV functions and their descriptive phrases as items.
HTML_LIST, ['AVG', 'The mean of the variable', 'STDEV', $
   'The standard deviation'], /DL
; Add a "Mathematics" item to the bullet-level list.
HTML_LIST, ['Mathematics'], /Add, /NoClose
; Add a DL (glossary) list under the "Mathematics" bullet to 
; include the FFT, CONVOL, and CROSSP functions as its items.
HTML_LIST, ['FFT', 'Fast Fourier Transform', 'CONVOL', $
   'Convolution of an array with a kernel', 'CROSSP',$
   'The Cross Product of two vectors'], /DL
; Close all of the lists.
HTML_LIST, /AllClose
; Close the HTML file.
HTML_CLOSE

The resulting HTML nested list output looks like this:

  • Statistics
    AVG
           The mean of the variable
    STDEV
           The standard deviation

  • Mathematics
    FFT
           Fast Fourier Transform
    CONVOL
           Convolution of an array with a kernel
    CROSSP
           The Cross Product of two vectors

See Also

HTML_BLOCK, HTML_HEADING, HTML_HIGHLIGHT, HTML_OPEN, HTML_PARAGRAPH, HTML_SAFE, HTML_TABLE

For a complete discussion of HTML list elements, see HTML Sourcebook, Second Edition, by Ian S. Graham, John Wiley & Sons, Inc., 1996, New York, pp. 172-183.