Mallard 1.1: role attribute on links element

Shaun McCance <shaunm at gnome.org>
Wed Jul 31 21:26:06 EDT 2013

In Mallard, you can have multiple titles in an info element to be
used for different purposes, specified by the type attribute. One
of those types is link titles. Link titles can also take a role
attribute, which gets used in two ways:

1) Inline link elements can specify the title to use for link text
with the role attribute on the link element.

2) Automatic links automatically use a role. For example, topic
links will use (as a first pick) a link title with role="topic".

Sometimes, however, you want to use different titles in one place
where you use automatic links than in another. For example, if a
topic is in two guides, and one of the guides uses thumbnails to
display its topic links, that guide might want to use shorter
titles than a guide that uses a standard list.

Thus, I propose adding the role attribute to the links element as
well. So you could write, for example:

  <links type="topic" role="myrole"/>

The algorithm for getting the right title would then just have one
extra step added to the beginning of what's in Mallard 1.0:

1) Use the link title with a matching role, if it exists.
2) Use the link title with the default role (e.g. "topic"), if it
exists.
3) Use the link title with no role, if it exists.
4) Use the primary title.

I have this working in Yelp, and I've drafted the spec changes in
the 1.1 spec, which is now available on projectmallard.org:

http://projectmallard.org/1.1/mal_links

Feedback please.

--
Shaun