Generated: September 15, 2004, 10:52:16 | Copyright © 2004 , Kurt Nørmark | ![]() |
The collection in this library can be regarded as personal convenience stuff. You can use it if you find it useful - or you can develop your own convenience stuff on top of the XHTML mirror library.
The collection also serves as backward compatibility functions in relation to older LAML software. Many functions in this library originally served as ad hoc Scheme markup functions. As of this library, the functions have been reimplemented on top of the XHTML libraries.
a-name | (a-name name) | Name the current place by means of an a tag with name attribute |
a-tag | (a-tag url . optional-parameter-list) | Return an a tag constructructed from the URL and the anchor. |
a-tag-target | (a-tag-target url anchor target) | A variant of a tag which supports a target attribute of the a-tag (where in browser to show the result). |
alphabetic-link-array | (alphabetic-link-array) | Return an 'array' of letter links to #letter |
alphabetic-link-array-1 | (alphabetic-link-array-1 target-file-prefix alphabet . emphasis-letter) | Return an 'array' of letter links to (string-append target-file-prefix "-" letter ".html") for all letters in alphabet. |
box | (box text [width]) | Embed text in an invisible (border-less) table with one cell. |
br-list | (br-list lst) | Return a flat list, separate by breaks. |
brl | (brl lst) | A convenient alias for br-list |
center-frame | (center-frame indentation text) | Embed text into a centered frame |
character-entity | (character-entity x) | If x is a number return a numbered character entity. |
checkbox | (checkbox name . checked) | Return an input tag of type checkbox. |
color-frame | (color-frame text color) | Embed text into a color frame. |
color-frame-width | (color-frame-width text color width) | As color-frame, but this function supports and extra widht parameter. |
colorize-substrings | (colorize-substrings str region-color-list) | This is an advanced function which make font changes to substrings of str. |
copyright | copyright | The copyright character entity |
copyright-owner | (copyright-owner x) | Embed x into a copyright indication |
definition-list | (definition-list lst) | Make a definition list. |
file-upload | (file-upload name) | Return an input tag of type file. |
font-1 | (font-1 size color x) | Returns a font tag with size and color attributes. |
font-color | (font-color color x) | Like font, but only supports color. |
font-rise | (font-rise str base-size) | Return a html fonted version of str. |
font-size | (font-size size x) | Like font, but only supports size. |
form-1 | (form-1 cgi-url x) | Embed x in to form of kind POST, which activates url upon form completion. |
frame-1 | (frame-1 text) | Shown text in a simple frame. |
frame-width | (frame-width text width) | Like frame, but with an extra width parameter. |
h | (h i x) | Returns h tags, h1 if i=1, h2 if i=2, etc. |
hidden-line | (hidden-line name value) | Return an input tag of type hidden. |
horizontal-space | horizontal-space | Return n space special characters |
html-appender | (html-appender element) | Generate a function which appends element. |
html-protect | (html-protect str) | Protect HTML tags such that an HTML document can be shown verbatim in a browser. |
image-file | (image-file file-name) | Return the full path/address of the image file named file-name. |
image-file-path | (image-file-path) | Determination of the actual file path to images in html files. |
img-0 | (img-0 file-name . width) | Return an img tag, in which a file on file-name is presented. |
img-with-border | (img-with-border file-name . width) | A variant of img which presents an image with a border |
in-danish | (in-danish str) | Translate the Danish letters in str to a string with appropriate use of HTML character entities. |
indent-pixels | (indent-pixels p text) | Indent text with p pixels |
js-call | (js-call function-name parameters) | Return a Javascript calling form, given function function-name and parameters. |
js-string-array | (js-string-array elements) | Return a manifest javascript array given its elements |
kn-internet-image-path | kn-internet-image-path | The URL where the author of this library keeps a number of images (icons). |
laml-home-button | (laml-home-button extra-level text-or-image . start-dir) | Return an HTML a tag (anchor) which links to the LAML software home page via an small gif icon. |
laml-top-banner | (laml-top-banner) | Return the standard LAML top banner with time of generation, copyright, and home icon |
left-middle-right-banner | (left-middle-right-banner left middle right) | Return a banner with left, middle, and right justified contributions. |
left-right-banner | (left-right-banner left right) | Return a banner with left and right justified contributions. |
mail-link | (mail-link email-adr [anchor-name]) | Return a mail link by means of the mailto facility in an a tag. |
mini-menu | (mini-menu mini-menu-list dark-color) | Makes a horizontal menu in terms of a table with links. |
multi-column-list | (multi-column-list columns elements total-width) | Return a multi-column list, row major, with columns columns. |
multipart-form | (multipart-form cgi-url target-directory target-directory-url x) | Embed x into a multipart form. |
n-column-list | (n-column-list n elements total-width) | Return an n column list, column-major, of the element list (second parameter). |
narrow | (narrow separator-fn width . contents-list) | Present the contents-list, which is a list of elements, in a narrow column of width, separated with activations of separator-fn. |
narrow-with-pixels | (narrow-with-pixels p text) | Show text in a column, narrowed from both left and right with p pixels |
password-line | (password-line name size value) | Return an input tag of type password. |
radio-button | (radio-button value group-name . checked) | Return an input tag of type radio. |
reset | (reset value) | Return an input tag of type reset. |
select-1 | (select-1 name value-list contents-list . selected-value) | Return a select tag, defining multiple choice menu. |
set-image-file-path! | (set-image-file-path! mode) | Set the image-file-access variable. |
space | (space n) | Return n space special characters (horizontal space) |
submit | (submit value [name]) | Return an input tag of type submit. |
table-0 | (table-0 list-of-list . optional-parameter-list) | Return a table with elements from list-of-list. |
table-1 | (table-1 border cell-width-list cell-color-list-1 list-of-list . optional-parameter-list) | A more versatile variant of table-0. |
table-2 | (table-2 border cell-width-list cell-color-list-1 header-list list-of-list) | A variant of table and table-1 which supports a header row. |
table-3 | (table-3 border cell-width-list list-of-list . optional-parameter-list) | A transparant variant of table-1 - without specification of a column color list. |
table-4 | (table-4 border cell-width-list row-color-list list-of-list . optional-parameter-list) | A variant of table-1 with a row color list instead of a column color list. |
table-5 | (table-5 border cell-width-list list-of-color-list list-of-list . optional-parameter-list) | A variant of table-4 that allows individual background coloring of table cells. |
text-line | (text-line name size value) | Return an input tag of type text. |
textarea-1 | (textarea-1 name rows cols contents) | Return a textarea form. |
two-column-list | (two-column-list elements total-width) | Return a two column list, column major. |
ul-tree | (ul-tree tree) | Show tree as an indented, bulleted list. |
vertical-space | (vertical-space n) | Return n vertical spaces, i.e., n instances of the p tag. |
![]() ![]() ![]() 1 Basic HTML extension stuff. | |||
In this section we implement mirrors of HTML stuff such as comment and character entities. Also there are a number of convenient white space functions (horizontal and vertical). As a special, but very useful function, we include an html-protect function which provides for presentation of verbatim HTML documents in a browser. There is also some basic javascript support in this section. | |||
character-entity | |||
Form | (character-entity x) | ||
Description | If x is a number return a numbered character entity. If x is a symbol og string, return a named character entity. | ||
copyright | |||
Form | copyright | ||
Description | The copyright character entity | ||
space | |||
Form | (space n) | ||
Description | Return n space special characters (horizontal space) | ||
horizontal-space | |||
Form | horizontal-space | ||
Description | Return n space special characters | ||
vertical-space | |||
Form | (vertical-space n) | ||
Description | Return n vertical spaces, i.e., n instances of the p tag. | ||
html-protect | |||
Form | (html-protect str) | ||
Description | Protect HTML tags such that an HTML document can be shown verbatim in a browser. Transliterate angle brackets in str to the particular html character entities. In normal XML-in-LAML you should not use this function. Only use in the rare cases where HTML markup is handled as text. | ||
Note | The intended functionality of html-protect is integrated in every XML-in-LAML mirror function due to the use of the standard HTML transformation table. | ||
in-danish | |||
Form | (in-danish str) | ||
Description | Translate the Danish letters in str to a string with appropriate use of HTML character entities. | ||
js-call | |||
Form | (js-call function-name parameters) | ||
Description | Return a Javascript calling form, given function function-name and parameters. Returns a string of the form: function-name(parameters). This function adds commas between the actual Javascript parameters. | ||
js-string-array | |||
Form | (js-string-array elements) | ||
Description | Return a manifest javascript array given its elements | ||
![]() ![]() ![]() 2 Convenience variants of the HTML mirror functions. | |||
The functions in this section are either quite close to the HTML mirror functions or very simple. | |||
a-tag | |||
Form | (a-tag url . optional-parameter-list) | ||
Description | Return an a tag constructructed from the URL and the anchor. If no anchor is provided uses the url as anchor text. | ||
a-tag-target | |||
Form | (a-tag-target url anchor target) | ||
Description | A variant of a tag which supports a target attribute of the a-tag (where in browser to show the result). | ||
a-name | |||
Form | (a-name name) | ||
Description | Name the current place by means of an a tag with name attribute | ||
mail-link | |||
Form | (mail-link email-adr [anchor-name]) | ||
Description | Return a mail link by means of the mailto facility in an a tag. | ||
h | |||
Form | (h i x) | ||
Description | Returns h tags, h1 if i=1, h2 if i=2, etc. If i is higher than 6, use size 6. | ||
font-1 | |||
Form | (font-1 size color x) | ||
Description | Returns a font tag with size and color attributes. size is a number or the symbol normal. color is a rgb list of three, decimal integers or a color symbol from the color library. Corresponds to the old function font in the ad hoc html library. | ||
font-size | |||
Form | (font-size size x) | ||
Description | Like font, but only supports size. size is a number and color is a rgb list of three, decimal integers or a color symbol. | ||
font-color | |||
Form | (font-color color x) | ||
Description | Like font, but only supports color. color is a rgb list of three, decimal integers | ||
html-appender | |||
Form | (html-appender element) | ||
Description | Generate a function which appends element. As an example use, (html-appender (p)) is a function of one parameter, which appends a p tag to the argument of the function. | ||
font-rise | |||
Form | (font-rise str base-size) | ||
Description | Return a html fonted version of str. Initial letter is sized base-size+1. The rest is size base-size. Returns a list, not an ast. If rendered directly, use render-1. | ||
![]() ![]() ![]() 3 Lists and trees. | |||
In this section there are various convenient functions which renders lists and trees. | |||
br-list | |||
Form | (br-list lst) | ||
Description | Return a flat list, separate by breaks. The parameter lst is a list of items. In this version, returns a list, which cannot be rendered directly. However, render-1 works on the result. | ||
brl | |||
Form | (brl lst) | ||
Description | A convenient alias for br-list | ||
See also | see also | br-list | |
definition-list | |||
Form | (definition-list lst) | ||
Description | Make a definition list. lst is a list of lists. Each inner list must be of length two, dt and dd respectively. I.e. definition terms and the defintion proper, resp. As a special case supported, the inner list can be of lenght one, in which case the dd is considered empty. | ||
ul-tree | |||
Form | (ul-tree tree) | ||
Description | Show tree as an indented, bulleted list.
A tree is a list.
The first element of the list is the root.
The tail of the list is the list of subtrees.
A subtree, which is a leaf, can be given as a string (cdata) or a contents element.
Example (a (b c d) (e (f g) h)) a / \ b e / \ / \ c d f h | g | ||
![]() ![]() ![]() 4 Table functions. | |||
In this section there is a number of table functions which maps a list of rows (list of lists) to an HTML table. Older LAML software depends on these. I do not recommend use of these functions in new software. Use the table mirror functions directly. | |||
table-0 | |||
Form | (table-0 list-of-list . optional-parameter-list) | ||
Description | Return a table with elements from list-of-list. The sublists of list represent the rows in the table. The border is an optional parameter. Corresponds to the old function table in the ad hoc html library. | ||
Parameters | list-of-list | the list of table row lists. | |
table-1 | |||
Form | (table-1 border cell-width-list cell-color-list-1 list-of-list . optional-parameter-list) | ||
Description | A more versatile variant of table-0. A variant of table-0 which requires border (an integer, 0 if no border), a list of cell widths, a list of column colors, the table contents (list-of-list - list of rows), and an optional valign parameter. The valign parameter corresponds to the HTML valign attribute, the possible value of which are "top", "middle", "bottom", and "baseline" (a string). | ||
table-2 | |||
Form | (table-2 border cell-width-list cell-color-list-1 header-list list-of-list) | ||
Description | A variant of table and table-1 which supports a header row. | ||
table-3 | |||
Form | (table-3 border cell-width-list list-of-list . optional-parameter-list) | ||
Description | A transparant variant of table-1 - without specification of a column color list. The cell color becomes identical with the background. | ||
table-4 | |||
Form | (table-4 border cell-width-list row-color-list list-of-list . optional-parameter-list) | ||
Description | A variant of table-1 with a row color list instead of a column color list. The length of row-color-list must be the number of rows in the table. | ||
table-5 | |||
Form | (table-5 border cell-width-list list-of-color-list list-of-list . optional-parameter-list) | ||
Description | A variant of table-4 that allows individual background coloring of table cells. The parameter list-of-color-list is a list of row colors, whereas row-color-list in table-4 is a fixed list of colors that apply to a row. Thus, the structure of list-of-color-list is identical to the structure of list-of-list. | ||
See also | similar function | table-4 | |
left-middle-right-banner | |||
Form | (left-middle-right-banner left middle right) | ||
Description | Return a banner with left, middle, and right justified contributions. | ||
left-right-banner | |||
Form | (left-right-banner left right) | ||
Description | Return a banner with left and right justified contributions. | ||
laml-top-banner | |||
Form | (laml-top-banner) | ||
Description | Return the standard LAML top banner with time of generation, copyright, and home icon | ||
mini-menu | |||
Form | (mini-menu mini-menu-list dark-color) | ||
Description | Makes a horizontal menu in terms of a table with links. The table is made on the basis of parameter mini-menu-list, which is a list of menu entries. A menu entry is a list of anchor-text and URL pairs (lists of two strings). Dark-color must be some dark color. | ||
![]() ![]() ![]() 5 HTML input form functions. | |||
A number of convenient functions which supports the work with HTML input forms. | |||
form-1 | |||
Form | (form-1 cgi-url x) | ||
Description | Embed x in to form of kind POST, which activates url upon form completion. Corresponds to the old function form in the ad hoc html library. | ||
multipart-form | |||
Form | (multipart-form cgi-url target-directory target-directory-url x) | ||
Description | Embed x into a multipart form. Activate cgi-url when the form is submitted. A multipart form is used for file uploading. Files are written into target-directory when uploaded. The parameter target-directory-url gives the URL of the directory, in which the file is uploaded. This is used for subsequent WWW retrival of the file. | ||
See also | accompanying function | multipart-decode | |
checkbox | |||
Form | (checkbox name . checked) | ||
Description | Return an input tag of type checkbox. The name is a string or symbol which identifies the checkbox. Checked is an optional boolean parameter. If checked is #t, the checkbox will be checked initially. Returns the string true to the form processing application if checked. | ||
radio-button | |||
Form | (radio-button value group-name . checked) | ||
Description | Return an input tag of type radio. checked is a boolean parameter, i.e. true or false (in Scheme sense). | ||
text-line | |||
Form | (text-line name size value) | ||
Description | Return an input tag of type text. The name is a string of symbol which identifies the text line. Size is the text line width in character positions. Value is the initial value on the text line. | ||
hidden-line | |||
Form | (hidden-line name value) | ||
Description | Return an input tag of type hidden. The name is a string or symbol which identifies the hidden line. Value is the string contents of the hidden line. | ||
file-upload | |||
Form | (file-upload name) | ||
Description | Return an input tag of type file. Such an input tag is used for file uploading. The name of the uploading is name. | ||
password-line | |||
Form | (password-line name size value) | ||
Description | Return an input tag of type password. The name is a string of symbol which identifies the password. Size is the line width in character positions. Value is the initial contents of the password field (not very useful...). | ||
submit | |||
Form | (submit value [name]) | ||
Description | Return an input tag of type submit. Renders a button. Value is the string label of the button. If the optional parameter name is given it identifies a particular submit button with a name, value pair in the submitted data. | ||
reset | |||
Form | (reset value) | ||
Description | Return an input tag of type reset. Value is the string label of the button. | ||
select-1 | |||
Form | (select-1 name value-list contents-list . selected-value) | ||
Description | Return a select tag, defining multiple choice menu. Name is a string or symbol which identifies the selection. Value-list is a list of the values to be returned upon selection. Contents-list is the list of contents to be shown in the menu. Selected-value is an optional value, which is to be selected initially. This value should be a member of value-list. Corresponds to the old function select in the ad hoc html library. | ||
textarea-1 | |||
Form | (textarea-1 name rows cols contents) | ||
Description | Return a textarea form. Rows is the number of rows of the text area. Cols is the number of columns measured in characters. Contents is the initial contents of the text area. Corresponds to the old function textarea in the ad hoc html library. | ||
![]() ![]() ![]() 6 Multi column lists. | |||
The functions in this section return multi-column lists. Given a list of elements the functions return a table in which the elements have been arranged in a number of columns. The first function, multi-column-list, arranges the elements in row major order. The two last functions arrange the the elements in column major order. These are the most advanced functions due to the way tables are organized in HTML. | |||
multi-column-list | |||
Form | (multi-column-list columns elements total-width) | ||
Description | Return a multi-column list, row major, with columns columns. Columns (the first parameter) must be at least 2. The total width (sum of column widths) is given as the last parameter. Internally, a HTML table with zero border is formed and returned. | ||
two-column-list | |||
Form | (two-column-list elements total-width) | ||
Description | Return a two column list, column major. total-width (sum of column widths) is the width you want the resulting table to have. Internally, a HTML table with zero border is formed and returned. | ||
n-column-list | |||
Form | (n-column-list n elements total-width) | ||
Description | Return an n column list, column-major, of the element list (second parameter). This is a generalized version of two-column-list. total-width (sum of column widths) is the width you want the resulting table to have. n is the number of columns. Internally, a HTML table with zero border is formed and returned. | ||
![]() ![]() ![]() 7 Images and image file access. | |||
The functions in this section determine how images are accessed from this and other libraries. | |||
kn-internet-image-path | |||
Form | kn-internet-image-path | ||
Description | The URL where the author of this library keeps a number of images (icons). This variable is used if image-file-access is the symbol net. | ||
image-file-path | |||
Form | (image-file-path) | ||
Description | Determination of the actual file path to images in html files. This function depends on the variable image-file-access, which MUST be defined external to this library. The value of image-file-access can be changed via the procedure set-image-file-access! One of the following symbols apply: local, parent, net, sub-directory, or fixed. Default is local. local means that images are taken from the current directory. parent means that images are tagen from ../images. sub-directory means that images are taken from ./images. fixed means that images are taken from fixed-image-directory (a variable which must be defined external to this library). Finally, net means that images are taken from kn-internet-image-path (a variable). | ||
set-image-file-path! | |||
Form | (set-image-file-path! mode) | ||
Description | Set the image-file-access variable. mode is symbol, either local, parent, sub-directory, net, or fixed. Relative to the hmtl directory, where the target files are written. | ||
image-file | |||
Form | (image-file file-name) | ||
Description | Return the full path/address of the image file named file-name. Relies of the setting of the variable image-file-access via the procedure set-image-file-path! File name must include file extension | ||
img-0 | |||
Form | (img-0 file-name . width) | ||
Description | Return an img tag, in which a file on file-name is presented. An optional width parameter is supported. Corresponds to the old function img in the ad hoc html library. | ||
img-with-border | |||
Form | (img-with-border file-name . width) | ||
Description | A variant of img which presents an image with a border | ||
laml-home-button | |||
Form | (laml-home-button extra-level text-or-image . start-dir) | ||
Description | Return an HTML a tag (anchor) which links to the LAML software home page via an small gif icon. If possible, a relative URL is used as the href attribute. The parameter extra-level is an extra level to add. Normally, extra-level is 0 (zero). As an example, extra-level should be 1 in case HTML files are organized in a sub-directory relative to the laml source file. Text-or-image is either the symbol 'text or 'image, or a string. If 'text, a textual anchor is used. if 'image, a small 'laml house' is used as image. If text-or-image is a string it is a name of an image file in the laml image directory (including file name extension, excluding any file path). The optional start-dir gives the directory, in which the home button is to be placed; It defaults to (startup-directory). | ||
![]() ![]() ![]() 8 Indenting, boxing, and framing. | |||
Here is a number of functions of indentation and frame making. | |||
indent-pixels | |||
Form | (indent-pixels p text) | ||
Description | Indent text with p pixels | ||
narrow-with-pixels | |||
Form | (narrow-with-pixels p text) | ||
Description | Show text in a column, narrowed from both left and right with p pixels | ||
frame-1 | |||
Form | (frame-1 text) | ||
Description | Shown text in a simple frame. Has nothing to do with HTML frames. Corresponds to the old function frame in the ad hoc html library. | ||
box | |||
Form | (box text [width]) | ||
Description | Embed text in an invisible (border-less) table with one cell. The optional parameter, width, can be used to control the width of the table cell (defaults to "*"). | ||
narrow | |||
Form | (narrow separator-fn width . contents-list) | ||
Description | Present the contents-list, which is a list of elements, in a narrow column of width, separated with activations of separator-fn. | ||
color-frame | |||
Form | (color-frame text color) | ||
Description | Embed text into a color frame. It is the background which is colored. | ||
color-frame-width | |||
Form | (color-frame-width text color width) | ||
Description | As color-frame, but this function supports and extra widht parameter. This is an integer: the with of the frame in pixels. | ||
frame-width | |||
Form | (frame-width text width) | ||
Description | Like frame, but with an extra width parameter. This is an integer: the with of the frame in pixels. | ||
center-frame | |||
Form | (center-frame indentation text) | ||
Description | Embed text into a centered frame | ||
![]() ![]() ![]() 9 Alphabetical index arrays. | |||
The alphabetic index arrays are useful for presentation of alphabets linking to separate pages in a large index. | |||
alphabetic-link-array | |||
Form | (alphabetic-link-array) | ||
Description | Return an 'array' of letter links to #letter | ||
alphabetic-link-array-1 | |||
Form | (alphabetic-link-array-1 target-file-prefix alphabet . emphasis-letter) | ||
Description | Return an 'array' of letter links to (string-append target-file-prefix "-" letter ".html") for all letters in alphabet. This is a generalized version of alphabetic-link-array. target-file-prefix is a prefix of the file names, in which the index files are located. alphabet is a list of letters, for which to generate index links from the alphabet arrays. Some letters may be missing from the alphabet compared with a complete alphabet. emphasis-letter is an optional letter which we emphasize in the link array | ||
![]() ![]() ![]() 10 Substring Coloring. | |||
The function colorize-substring in this section is able to colorize specified substrings of a given string. | |||
colorize-substrings | |||
Form | (colorize-substrings str region-color-list) | ||
Description | This is an advanced function which make font changes to substrings of str.
Surround substrings of str, as specified by the third parameter, in font tags.
Region-color-list is a list of coloring descriptors. Each color descriptor is of the form: (from-string to-string color face multiplicity). Face and multiplicity are optional. From-string and to-strings delimits and identifies a substring of str to colorize etc. color is a list of three integers: a rgb list. We support the following face symbols: italic, bold, typewriter, underlined, plain (default bold). Multiplicity is an integer telling how many times to to attempt the colorization on str (default 1). NB: In strange situations, the fontification of an early region-color-element may affect the searching for latter region-color-elements. This is not an error, but a consequence of the way font tags are puted into str. | ||
![]() ![]() ![]() 11 Miscelaneous | |||
copyright-owner | |||
Form | (copyright-owner x) | ||
Description | Embed x into a copyright indication | ||