The HTML4 spec is rather ambiguous about how the LINK element should
be handled. In an attempt to reduce the ensuing confusion, I have
tried to write this document (amongst others), which gives a way of
implementing the LINK element for graphical browsers. -- Ian
See also:
http://www.bath.ac.uk/%7Epy8ieh/internet/discussion/metadata.txt
http://www.bath.ac.uk/%7Epy8ieh/internet/discussion/linkelement.txt
===========================================================================
Have a new toolbar, whose background and foreground colours follow the
colours of the document's :canvas frame.
On this toolbar, have:
A button ("Navigation") with a pull down menu.
A set of default buttons (which exactly is debatable).
Each default button (not the Navigation button) has a set of "rel"
values that are appropriate for it (the exact list is also debatable).
For each LINK do:
If "stylesheet" is present in the REL attribute, skip to the next
LINK element.
Take each REL and REV values one at a time, and do the following:
If the keyword is "alternate", perform some special logic on the
other attributes and come up with an appropriate menu item. [XXX
*+* currently not discussed in detail!!!]
Otherwise:
Make a menu item (which will be placed in a second) containing:
An icon (one for "rel" links and another for "rev" links).
A translation of the "rel" ("rev") value into the local
language. If no translation is possible (for example, a
non-standard "rel" type) then use the "rel" ("rev") type
verbatim.
If there is a "title" attribute, then a colon or
equivalent (depends on the local language), followed by
whitespace and the title, verbatim.
Note that in some languages, the title would come before the rel
value -- this has to be easily customisable for different
languages!
If the protocol given by the "href" attribute is not followed by
"://", but only by ":", (for example, a "mailto:", "jabber:", or
"msg-id:" URI, rather than one such as "http://", "ftp://", or
"https://") then the menu item's text should be drawn in a
different way, for example in italics (this should, of course,
be skinnable).
Give each menu item some status line text containing the
following, separated by commas or whatever is appropriate in the
local language:
A translation of the "hreflang" value into the local language,
A translation of the "media" value into the local language,
A translation of the "type" value into the local language.
The "href" attribute, in brackets or equivalent.
If the "rel" or "rev" value in question is associated with a
particular menu-button, then it should be included in the menu
for that button.
The link should also be included in the "Navigation" button's
menu, regardless of whether it was included anywhere else or
not.
The link should also be included in the "Go" menu item.
Each button is a menu-button when it has more than 1 menu item
associated with it (see below) and just a simple button otherwise,
with the exception of the "Navigation" button which is always a menu
and has no default action except dropping down the menu.
For each menu-button, if there is was a REL link added to its menu
then make a click on that button (i.e., its default action) go to the
first such link. If there is no REL link, but there are REV links,
then the default action of the button should be to drop down the menu
(the default action should never be to follow a REV link!). Once
again, note that the Navigation button's default should always be to
drop down the menu.
If there are no links in the menu of the button (including the
Navigation button here), then the button should be disabled.
Each button has a tooltip which shows the contents of the menu item
associated with the default action.
Each button has status line text which shows the same as the status
line text of the menu item associated with the default action.
To translate the "type" value into the local language, services
provided by the OS should be used. Failing that, the "type" value may
be used verbatim.
To translate the "media" value, a table will have to be used. If the
"media" value is not recognised, it may be used verbatim.
To translate the "hreflang" value, use the following algorithm.
The hreflang attribute
----------------------
To convert a language code (as used in lang and hreflang) to a
friendly name, I would recommend the following algorithm (this is just
an idea and would have to be refined by examining the relevant specs):
If the first name token (recall that language codes are simply a
hyphen separated list of name tokens) is either 'x' or 'i', then take
the second token and capitalize it, and then include all remaining
tokens (if any) in a parenthesised section after it, replacing the
hyphens with spaces. Leave the case of these other tokens untouched.
e.g., "x-klingon" -> "Klingon"
"x-minbari-warrior-caste" -> "Minbari (warrior caste)"
"i-default" -> "Default"
Otherwise, the first token should be expanded as per ISO639. If the
second token is two letters long and in capitals, then it should be
substituted for a country name as per RFC 1766 (I think), and
prepended to any other tokens, which should all be placed in a
parenthesised section afterwards, replacing the hyphens with spaces,
and again leaving the case of these other tokens untouched.
e.g., "en-US" -> "English (United States)"
"en-GB" -> "English (Great Britain)"
"en-gb" -> "English (gb)"
"en-cockney" -> "English (cockney)"
"fr-CH-slang" -> "French (Switzerland slang)"
"az" -> "Azerbaijani"
See also:
http://info.internet.isi.edu/in-notes/rfc/files/rfc1766.txt
ftp://dkuug.dk/i18n/ISO_639
Note that this last section should be carefully checked once
implemented to make sure the relevant RFCs are followed.
===========================================================================
Contributors:
Ian Hickson
Tim Hill
Matthew Thomas