Link attribute for actions

Shaun McCance <shaunm at gnome.org>
Thu Jul 1 13:19:38 EDT 2010

Hi all,

Mallard allows xref and href attributes on all inline elements.
The xref attribute is defined to link to another page within
the same document, whereas the href attribute links to an
external resource.

The core Mallard spec defines an xref attribute to look like
one of the following:

  page
  page#anchor
  #anchor

However, it explicitly allows extensions to extend this by
using either the / or : character. Processing tools that
do not understand a particular extended xref attribute are
to ignore it, possibly falling back to href if present.

I added an experimental feature to Yelp a while back to
allow you to provide link to install software from your
package manager, using links that look like this:

  install:packagename

This works reasonably well, but I don't like using the
href or the xref attribute for these. I don't like using
href, because I'd like to use href as a fallback URL,
like so:

  <link ...="install:foo"
  href="http://foo.example.com/download">Install Foo</link>

And even though Mallard allows xref to be extended with
the : character, I don't like using it for something that
isn't a link to a page. It feels dirty.

I could use an extension attribute, like so:

  xmlns:yelp="http://projects.gnome.org/yelp/"
  <link yelp:install="foo" href="...">Install Foo</link>

But I think it might be better to provide a generic way
of specifying (implementation-dependent) actions. So I'd
like to add the action attribute to Mallard:

  <link action="install:foo"
  href="http://foo.example.com/download">Install Foo</link>

There would be no specific requirements for the content of
the action attribute, but we'd recommend implementations to
use things that look sort of like a URI, for consistency.
Support for actions is entirely up to the discretion of
implementations. I'd define the order as such:

1) If there's an action attribute, and the implementation
   understands it, it uses that.
2) Otherwise, if there's an xref attribute, and it points
   to something the implementation understands, it uses that.
3) Otherwise, if there's an href attribute, that's used.

Here's some other things I could imagine the action attribute
being used for:

* If there's a scripting framework present, it could be used
  for "do it for me" links that can e.g. open preference
  tools or click menu items.
* It could be used to allow users to submit feedback, ratings,
  or corrections on pages.
* It could be used to interact with social media and presence
  technologies, e.g. "Share this page".

And so on. All of these are "links" in the sense that they're
things a user would click on to do something. But none of them
are pages or external resources, strictly speaking.

Thoughts?

--
Shaun