Anchor, Link, Base

  1. Anchor

    A link is a connection from one web resource to another. Anchor is the end of a link. A link pointers from source anchor to destination anchor. Users may visit the destination resource by activating a link (e.g. clicking mouse button). The destination anchor may be a resource on the Internet or an element with the id on the XHTML document.

    _a command declares a link in the Snaml. It can only appear as the content of the _body. The content of _a command is a source anchor. A browser will display the content as an underline text or an image in normal. By clicking the text user can switch to the destination anchor that is specified by 'href' attribute with a URL. The 'id' attribute of _a command declares its anchor. Other links may refer to it with #idvalue. Any block commands may specify 'id' attribute for its anchor. The 'title' attribute is used to display an anchor's tooltip. The attribute of _a command can belong to the COMMON attribute set and be other attributes: accesskey, charset, href, hreflang, rel, rev, tabindex, and type. You can use accesskey attribute to define a key shortcut.

    _a "id='token' href='http://www.neatware.com/'"
      quote "Anchor to href URL with Name token"
    _a "href='#token' title='here is the token'"
      quote "Anchor to token in the document"
    _h1 "id='token2'"
      quote "Destination anchor with id"
  2. Link

    __link command defines a relationship between current document and other resources. It may appear in the _head and _body of a Snaml program. __link command may describe the position of a document within a series of documents. The 'rel' (relationship) and 'rev' (reverse) attributes are used for this purpose. __link command may also refer to the external style sheets.

      _title; quote "Chapter 2"; title_; # current        
      __link "rel='prev' href='chapter1.html'"; # forward
      __link "rev='next' href='chapter3.html'"; # backward
  3. Base

    URL (Universal Resource Locator) may be absolute, relative, and internal. Absolute URL has the full path. Relative URL has only relative path that will be resolved according to the base address. The internal URL in the document starts with the '#' character followed by a string that is an id value of a command or a name value of _a command.

    _base command specifies a document's URL explicitly. Its default value is the current document.

    absolute URL:   http://www.neatware.com/dest.html#one
    relative URL:   dest.html#one
    internal URL:   #one