Synopsis:
There is a single function in Meta-HTML which performs pattern matching, substring extraction, and substring deletion. For convenience, a blind substring extraction function is supplied as well. Three functions perform the three most common case changes. Finally, the pad function allows alignment of fixed-width text.
Commands:
Function Documentation
<base64decode STRING>
|
Simple
|
Performs the translation operation commonly known as Base64 Decoding on STRING, and returns the results of that decoding.
Base64 encoding is a common transfer encoding for binary data and for Basic Authorization values -- this function can be used to turn such strings into their original, pre-encoded state.
<set-var the-data = "YmZveDpmcm9ibml0eg==">
<base64decode <get-var the-data>>
produces:
bfox:frobnitz
<capitalize STRING>
|
Simple
|
Changes the case of each character in STRING to uppercase or lowercase depending on the surrounding characters.
<capitalize "This is a list">
produces:
This Is A List
Also see downcase, and upcase.
Converts all of the uppercase characters in STRING to lowercase.
<downcase "This is Written in Meta-HTML">
produces:
this is written in meta-html
Also see upcase, and capitalize.
<match STRING REGEXP [ACTION=(REPORT|DELETE|EXTRACT|STARTPOS|ENDPOS|LENGTH)]>
|
Simple
|
Matches REGEXP against STRING and then performs ACTION. The default ACTION is report; when the expression matches the string match returns the text true.
Here are some examples:
<match "foobar" ".*"> --> "true"
<match "foobar" "foo"> --> "true"
<match "foobar" "foo" action=extract> --> "foo"
<match "foobar" "oob" action=delete> --> "far"
<match "foobar" "oob" action=startpos>--> "1"
<match "foobar" "oob" action=endpos> --> "4"
<match "foobar" "oob" action=length> --> "3"
<match "foobar" "[0-9]*"> --> ""
<pad STRING TOTAL-SIZE [ALIGN=(RIGHT|LEFT|MIDDLE)] [TRUNCATE]>
|
Simple
|
Pads STRING to a length of TOTAL-SIZE. ALIGN can
be one of LEFT, MIDDLE, or
RIGHT (the default).
PAD inserts the correct number of spaces to make the
input argument take the desired number of spaces (presumably for use
in a <pre> ... </pre> statement).
The optional arg TRUNCATE says to force the string to be
the specified length.
Before any padding is done, leading and trailing whitespace is removed
from STRING.
Examples:
<pad "Hello" 10> --> " Hello"
<pad "Hello" 10 align=left> --> "Hello "
<pad "Hello" 10 align=middle> --> " Hello "
<pad " Heckle " 4 truncate> --> "Heck"
<plain-text [FIRST-CHAR=EXPR] [NOBR=TRUE]> body </plain-text>
|
Complex
|
Performs the following steps:
- Replace occurrences of pairs of newline characters with a
single
<P> tag.
- Applies the function EXPR to the first character of every
paragraph, and inserts the closing tag after that character.
The output will start with a <P> tag, unless the
optional argument NOBR=TRUE is given.
<plain-text first-char=<font size="+1"> nobr=true>
This is line 1.
This is line 2.
</plain-text>
produces:
This is line 1.
This is line 2.
<small-caps [UPPER=SIZE] [LOWER=SIZE] [OTHER=SIZE]>
|
Simple
|
Modify the characters in BODY raising lower-case
characters to upper-case, and changing the size of fonts as directed.
For example, this is how ``HELLO
THERE'' can be produced:
<small-caps lower=-1>Hello There</small-caps>
<string-eq STRING1 STRING2 [CASELESS=TRUE]>
|
Simple
|
Compare STRING1 to STRING2 and return the string "true" if they are character-wise identical.
The optional keyword argument CASELESS=TRUE indicates that no consideration should be given to the case of the characters during comparison.
<string-eq "foo" "FOO"> -->
<string-eq "foo" "foo"> -->true
<string-eq <upcase "foo"> "FOO"> -->true
<string-eq "foo" "FOO" caseless=true> -->true
<subst-in-string STRING REGEXP REPLACEMENT [REGEXP] [REPLACEMENT] ...>
|
Simple
|
<set-var foo="This is a list">
<subst-in-string <get-var foo> "is" "HELLO">
--> "ThHELLO HELLO a lHELLOt"
<subst-in-string "abc" "([a-z])" "\\1 "> --> "a b c "
<substring STRING START [END]>
|
Simple
|
Extracts the substring of STRING whose first character starts at offset START, and whose last character ends at offset END. The indexing is zero-based, so that:
<substring "Hello" 1 2> --> "e"
This function is useful when you know in advance which part of the string you would like to extract, and do not need the pattern matching facilities of match.
Converts all of the lowercase characters in STRING to uppercase.
<upcase "This is a list">
produces:
THIS IS A LIST
Also see downcase and capitalize.
<word-wrap STRING [WIDTH=CHARWIDTH]>
|
Simple
|
Produce paragraphs of text from the string STRING with the text filled to a width of CHARWIDTH.
This is provided for convenience only, and is of use when you need to present some free form text in pre-formatted fashion, such as when sending an E-mail message, or the like.
Edit Section
Function Index
Variable Index

The
META-HTML
Reference Manual V1.4
Copyright © 1995, 1996,
Brian J. Fox,
1996, 1997 Universal Access Inc.
Found a bug? Send mail to
bug-manual@metahtml.com