hypertext is a Water class that contains subclasses for every XHTML tag.
Each tag has a contract that matches the XHTML spec. Older tags and
attributes are not supported by default.
To support HTML tags used in versions prior to XHTML 1.0, execute the
following:
You can create subclasses of HTML tags. When the object is formatted as
HTML, it will print the standard tag name, but all the fields will be
shown. This makes it easy to create HTML-based presentation abstractions.
<DIV>To select multiple things, use the "Ctrl" key.</DIV>
<SELECT.multilist><OPTION "foo"/><OPTION "bar"/></>
By default, any attribute that is not a string will be converted
to a string by calling cxs_medium .
Exceptions: (a higher priority rules are listed first)
Calls cxs_medium on any non-string attribute value of the
value attribute. HTML tags with an attribute named value are:
INPUT, OPTION, and BUTTON.
Calls to_uri for any attributes named src, href, or action that
have a non-string value.
src attribute is found in INPUT, IMG, FRAME, and IFRAME.
href attribute is found in LINK, A, BASE, and AREA.
action is only found in a FORM.
Instances of SCRIPT, STYLE, or color as the value
of an HTML attribute are converted by calling custom to_htm_attr methods
Calls cxs_medium on any non-string attribute value
Water defines every XHTML tag as a subclass of the hypertext class
under thing. Thus thing.hypertext.b is a class for the 'bold' tag.
When you make a call to an html tag, i.e. <b>hi</b> ,
an instance of that tag's class is made containing the content and
attributes specified as fields in the new instance.
XHTML specifies that each tag's attributes must be named and must
have values of strings. Water permits that but also allows you to
have by-position arguments and non-strings as values, just like
other Water calls. Most XHTML attributes are of execution kind "ek_code".
XHTML specifies that all tag names and attribute names are lower case.
Water defines lower case tags as well as an upper case version of
each tag for compatibility with a common practice in html of
upper casing tags. HTML tags that have upper case attribute names
have their attribute names automatically converted to lower case
equivalents upon object creation for compatibility with XHTML. Thus:
<A HREF="abc.com">click</>.href
"abc.com"
but:
<A HREF="abc.com">click</>.HREF
error
errors since there is no
key in the a tag instance that is spelled "HREF".
<A href="abc.com">click</>
is a synonym for the above and the
preferred XHTML syntax.
To explicitly see the HTML formatting of a tag, call the to_htm method
on the object:
<b> hi </>.<to_htm/>"<b> hi </b>"
You can also see the HRML by clicking right in the lower right pane and
choosing to inspect the HTML source.
Use html_to_xhtml to clean up old html code before executing it
in Water.
Caveats: The lower right browser pane in the development environment can't render
every tag, at least in the way that modern browsers do.
Use the tools menu "Browse Latest Result" to see it in a real browser.
See html_to_xhtml for how to convert HTML into XHTML.
Hypertext Subclass
Subclassing a hypertext tag will use the tagname from the original HTML tag.
To show the attributes of the subclass, use copy_down_data in the make
method.