|
|
Overview of Meta-HTML
Sections contained within:The Purpose of Meta-HTMLHTML is a
Meta-HTML is an A quick example for the impatient is in order. The text: You are connected to ``metahtml.sourceforge.net'' and reading text written by Brian J. Fox. is produced in Meta-HTML by:
<b>You are connected to ``<get-var ENV::SERVER_NAME>'' and
reading text written by <get-var the-author>.</b>
As the WWW grows, more and more document providers are realizing that stateless connections are only useful for retrieving documents full of static information, and that, at times, it can be very useful to remember state pertaining to the browser that is connecting. The problem of keeping state for a particular browser user has been resolved by various individuals; all of the solutions require information to be passed back and forth between the browser and the server. For example, to play a WWW Blackjack game could involve the passing back and forth of information including the current wins/losses of the user, which cards have been dealt from the deck so far, and so forth. This information is most often passed to and fro in the form of a "magic" URL. The problems with passing information in this way are two-fold:
Another mechanism can be taken advantage of when both the server and browser being used support HTTP Cookies. While this solves the problem of "ugly" URLs, (this mechanism does not place information in the URL) it generates a new problem: the user must be in possession of a compliant browser, and be communicating with a compliant server. In addition, the information can be changed by the user before sending it back. Meta-HTML solves the problem of keeping state for a particular session, and it does it in a server and browser independent manner. Our method requires no additional CGI programs to be written. You can read about the technical details in the Session Operators section of this manual. ImplementationInitially, the vast majority of World Wide Web (WWW) documents consisted of static
Connections are made from a browser to a WWW Meta-HTML is currently implemented as a CGI program which can be executed every time the server is ready to retrieve a document. As before, the document to be retrieved can be a file of HTML, an image, or a CGI program to be executed. However, the document can also be a file of Meta-HTML code, in which case the benefits of dynamic variables and flow-control statements are fully realized. Although this implementation method is not server-specific, you still must make a couple of configuration changes to your HTTP server in order to hide the Meta-HTML program from the user. Details are in the Installation Guide. Syntax OverviewA Meta-HTML document consists of plain text, HTML directives, and Meta-HTML statements.
The syntax of the Meta-HTML language was designed to be as similar
to HTML as possible, so as to not sacrifice readability of the total
document. All of the Meta-HTML statements are delivered as a form
of HTML A simple tag begins with an open angle bracket (<) and ends with a corresponding close angle bracket (>). The text enclosed within the brackets is called the body; it can contain assigned variables and positional arguments. A complex tag begins with what looks exactly like a simple tag, continues throughout the body of the text, and ends with the a matching closing tag. This is analogous to the use of tags within HTML. The body of a complex tag is all of the text which appears between the opening tag and the closing tag, exclusive of those tags themselves.
Here is an example of using the simple tag
<set-var foo=bar>
Here is an example of using the complex tag
<when <get-var foo>>
The value of `foo' is <get-var foo>.
</when>
Note that both the
Additionally note that ``simple'' and ``complex'' do not refer to the
complexity of the function performed; they simply refer to the syntax
used to write the form in a document. For example, the simple tag
Variables assigned in the opening (or simple) tag have the form:
name=value
This gives the variable referred to as
<with-open-database db "/phones.db" mode=<get-var db-mode>>
...
</with-open-database>
Quoting Syntax
At times, you will need to quote the expressions that you pass to
various Meta-HTML functions. You do this with double quotes
(
<if <get-var "Space Name">
<get-var "Space Name[space index]">
<set-var space-name-present=false>>
For most cases, quoting is unnecessary, because open braces are expected to match close braces, and doubles quotes are expected to come in pairs. This is the usual case. For example:
<ifeq <get-var foo[index]> <get-var bar>
<set-var array[index]=<get-var bar>-found>
<set-var array[index]=<get-var bar>-missing>>
In the above example, no quoting was required because the only whitespace which appeared in the expression was within a set of matched braces.
![]() The META-HTML Reference Manual V2.0 Copyright © 1995, 1998, Brian J. Fox Found a bug? Send mail to bug-manual@metahtml.org |