abbr-design-pattern: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
No edit summary
m (Reverted edits by Heecfyahoo.ca (Talk) to last version by Frantorres)
Line 1: Line 1:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<entry-title> abbr design pattern </entry-title>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
== Purpose ==
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Use the [[abbr-design-pattern]] when you have localized, language, or design-specific human readable information that you want to markup and also provide a more globally human and machine readable alternative.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* Authors {{mustnot}} use the [[abbr-design-pattern]] to hide data.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* The contents of the <code>&lt;abbr></code> tag's <code>title</code> attribute {{must}} be both human-readable and human-listenable (e.g. for screenreaders), and {{should}} use a globally/internationally human readable format.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* For dates and times, authors {{should}} use the HTML5 <code>&lt;time></code> element instead of <code>&lt;abbr></code>. (ed: Once common tools like [[chrome-extensions]], [[h2vx]], [[operator]] all support the HTML5 time element, let's upgrade this statement to a {{must}}).
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
== How to use it ==
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* enclose the preferred local human readable text that you want to make globally human & machine readable with <code>&lt;abbr></code>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* add the relevant microformats property names to the <code>&lt;abbr></code> tag's <code>class</code> attribute
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* add a <code>title</code> attribute to the <code>abbr</code> element with the globally human & machine readable data as the value
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
* The end result {{must}} be human readable & listenable, when reading/speaking the abbr element's contents and its surroundings ''and'' when reading/speaking the abbr element's title attribute with its surrounding text.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
== Example ==
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The [[date-design-pattern]] formally encodes globally human readable ISO dates into an <code>abbr</code> element. Per the documentation/research on the [[date-design-pattern]] page, ISO8601 dates, e.g. of the form YYYY-MM-DD, are the most globally/internationally date format.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Note: that dates and times {{should}} be marked up with the HTML5 time element. These examples illustrate both span/abbr markup for pre-HTML5 tools, and time element support for HTML5-capable tools.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Before:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#EEE">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict style="background:none">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is on the 10th.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
After:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#FFE;border:solid .17em yellow">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is on <abbr class="dtstart" title="2005-10-10">the 10th</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Better (with HTML5 time instead of abbr)
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#EFE;border:double .5em green">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is on <time class="dtstart" datetime="2005-10-10">the 10th</time>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
You could also use the abbr-design-pattern to markup colloquial time references, but those should also use the HTML5 time element, e.g.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Before:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#EEE">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is at 10 o'clock.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
After:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#FFE;border:solid .17em yellow">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is at <abbr class="dtstart" title="10:00">10 o'clock</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Better (with HTML5 time instead of abbr)
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#EFE;border:double .5em green">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
The party is at <time class="dtstart" datetime="10:00">10 o'clock</time>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
==Alternative presentations==
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Note that the following are all equivalent, to a microformat parser:
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<div style="background:#FFE;border:solid .17em yellow">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang="html4strict">
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<span class="dtstart">2007-05-01</span>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">1 May 2007</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">1st May 2007</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">May 1st 2007</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">The first of May, 2007</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">2007-05-01</abbr>.
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">Tuesday, 1 May 2007</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">2007, day 121</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">May Day, 2007</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01" lang="FR">1er mai, 2007</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01" lang="ES">1 de mayo, 2007</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
and the following may be used in, say, a list, table, or page, headed "2007":
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<source lang=html4strict>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
<abbr class="dtstart" title="2007-05-01">1 May</abbr>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</source>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
</div>
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
Better (with HTML5 time element)
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
 
<div style="background:#EFE;border:double .5em green">
<source lang="html4strict">
<time class="dtstart">2007-05-01</time>
 
<time class="dtstart" datetime="2007-05-01">1 May 2007</time>
 
<time class="dtstart" datetime="2007-05-01">1st May 2007</time>.
 
<time class="dtstart" datetime="2007-05-01">May 1st 2007</time>.
 
<time class="dtstart" datetime="2007-05-01">The first of May, 2007</time>.
 
<time class="dtstart" datetime="2007-05-01">2007-05-01</time>.
 
<time class="dtstart" datetime="2007-05-01">Tuesday, 1 May 2007</time>
 
<time class="dtstart" datetime="2007-05-01">2007, day 121</time>
 
<time class="dtstart" datetime="2007-05-01">May Day, 2007</time>
 
<time class="dtstart" datetime="2007-05-01" lang="FR">1er mai, 2007</time>
 
<time class="dtstart" datetime="2007-05-01" lang="ES">1 de mayo, 2007</time>
 
<time class="dtstart" datetime="2007-05-01">1 May</time>
</source>
</div>
 
=== anti-patterns ===
These are all past examples that are usages to '''avoid'''.
 
Authors {{mustnot}} use the <code>abbr</code> element as shown in these examples, as either the element text or the <code>title</code> attribute text are not easily human readable.
 
<div style="background:#FEE;border:dashed .17em red">
<source lang=html4strict>
<span class="dtstart">20070501</span>
<abbr class="dtstart" title="20070501">1 May 2007</abbr>
<abbr class="dtstart" title="20070501">1st May 2007</abbr>.
<abbr class="dtstart" title="20070501">May 1st 2007</abbr>.
<abbr class="dtstart" title="20070501">The first of May, 2007</abbr>.
<abbr class="dtstart" title="20070501">2007-05-01</abbr>.
<abbr class="dtstart" title="20070501">Tuesday, 1 May 2007</abbr>
<abbr class="dtstart" title="20070501">2007, day 121</abbr>
<abbr class="dtstart" title="20070501">May Day, 2007</abbr>
<abbr class="dtstart" title="20070501" lang="FR">1er mai, 2007</abbr>
<abbr class="dtstart" title="20070501" lang="ES">1 de mayo, 2007</abbr>
<abbr class="dtstart" title="20070501">1 May</abbr>
</source>
</div>
 
The lack of dashes in "20070501" makes it read like a large number, not a date, both when viewing it, and when listening to it being read by a screenreader.
 
== Discussion ==
=== about datetimes ===
'''Avoid''' using the [[abbr-design-pattern]] for datetimes.
 
E.g. Authors {{must}} avoid doing this:
 
<div style="background:#FEE;border:dashed .17em red">
<source lang=html4strict>
<abbr class="dtstart" title="20051012T11:10-0100">10 past 11 o'clock on the 12th</abbr>
</source>
</div>
 
Ideally use the HTML5 time element:
 
<div style="background:#EFE;border:double .5em green">
<source lang=html4strict>
<time class="dtstart" datetime="2005-10-12T11:10-0100">10 past 11 o'clock on the 12th</time>
</source>
</div>
 
Note the use of the hyphenated date to make it more human readable, as the more readable that even machine data is made, the greater the chance that a human will be able to accurately check it and verify that it matches the locale/language-specific contents of the time element.
 
Alternatively, if the microformats tools you're using don't support HTML5 (yet), you may use the [[value-class-pattern]] with the [[abbr-design-pattern]]:
 
<div style="background:#FFE;border:solid .17em yellow">
<source lang=html4strict>
<span class="dtstart">
<abbr class="value" title="11:10">10 past 11 o'clock</abbr> on
<abbr class="value" title="2005-10-10">the 10th</abbr>
</span>
</source>
</div>
 
=== informal names ===
Using ABBR to encode more formal human data around something less formal:
 
<source lang=html4strict>
<abbr class="author" title="Danny Ayers">Danny</abbr>
</source>
 
This use is discouraged under the [http://c2.com/cgi-bin/wiki?DontRepeatYourself Don't Repeat Yourself principle], as it is a case of *more* information being less visibly present, namely, the family name in this case.  
If someone is not willing to make some information visible, then we
shouldn't be encouraging them to store that information invisibly or less visibly,
for all the same reasons that invisible metadata is bad/futile in the first place."
 
=== screen readers ===
The <code>title</code> attribute of the <code>&lt;abbr></code> tag {{must}} always be human readable and ''speakable''.  
 
Screenreaders such as JAWS and others which use title attributes from abbr, and when used properly (as in this example below from the WCAG group), pronounce words which would otherwise be unreadable or confusing.  
 
<source lang=html4strict>
<p>Sugar is commonly sold in 5 <abbr title="pound">lb.</abbr> bags.</p>
<p>Welcome to the <abbr title="World Wide Web">WWW</abbr>!</p>
</source>
 
If screen readers are unable to turn title content into something comprehensible, this will lead to accessibility failures. Here is a bad example:
 
<div style="background:#FEE;border:dashed .17em red">
<source lang=html4strict>
we're having a party on
<abbr class="dtstart" title="20070312T1700-06">
March 12, 2007 at 5 PM
</abbr>
</source>
</div>
 
would be read by Jaws as
 
<pre>
we're having a party on Twenty million seventy-thousand three-hundred twelve tee seventeen-hundred dash zero six.  
</pre>
 
The [http://www.webstandards.org/2007/04/27/haccessibility/ accessibility task force] from webstandards.org recommended:
 
<div style="background:#EEE">
<source lang=html4strict>
<span class="dtstart" title="20070312T1700-06">
March 12, 2007 at 5 PM, Central Standard Time
</span>
</source>
</div>
 
or
 
<div style="background:#EEE">
<source lang=html4strict>
<span class="dtstart">
March 12, 2007 at 5 PM, Central Standard Time
<span class="value" title="20070312T1700-06"></span>
</span>
</source>
</div>
 
But both these approaches are problematic due to the title attribute being not easily human readable/verifiable because of:
* unhyphenated date, e.g. bad: 20070312; good:2007-03-12
* uncoloned time, e.g. bad: 1700; good: 17:00
* timezone offset without minutes, e.g. bad: -06; better: -0600
* combining date, time, and timezone into a single string without human-friendly separators
 
However, based on this input and subsequent research into better alternatives, the microformats community developed the [[value-class-pattern]] with the following two alternatives:
 
<div style="background:#FFE;border:solid .17em yellow">
<source lang=html4strict>
<span class="dtstart">
<abbr class="value" title="2007-03-12">March 12, 2007</abbr>
at <abbr class="value" title="17:00">5 PM</abbr>,
<abbr class="value" title="-0600">Central Standard Time</abbr>
</span>
</source>
</div>
 
or
 
<div style="background:#FFE;border:solid .17em yellow">
<source lang=html4strict>
<span class="dtstart"><span class="value-title" title="2007-03-12T17:00-0600"></span>
March 12, 2007 at 5 PM, Central Standard Time
</span>
</source>
</div>
 
And again, the even better alternative is to use the HTML5 time element:
 
<div style="background:#EFE;border:double .5em green">
<source lang=html4strict>
<time class="dtstart" datetime="2007-03-12 17:00-0600">
March 12, 2007 at 5 PM, Central Standard Time
</time>
</source>
</div>
 
== See Also ==
* [[abbr-design-pattern-issues]]
* [[Main_Page#Design_Patterns|All microformat design patterns]]
* [[datetime-design-pattern]] uses [[abbr-design-pattern]]
* [http://www.w3.org/TR/REC-html40/struct/text.html#edef-ABBR HTML 4.01 definition]

Revision as of 07:39, 22 February 2013

<entry-title> abbr design pattern </entry-title>

Purpose

Use the abbr-design-pattern when you have localized, language, or design-specific human readable information that you want to markup and also provide a more globally human and machine readable alternative.

  • Authors MUST NOT use the abbr-design-pattern to hide data.
  • The contents of the <abbr> tag's title attribute MUST be both human-readable and human-listenable (e.g. for screenreaders), and SHOULD use a globally/internationally human readable format.
  • For dates and times, authors SHOULD use the HTML5 <time> element instead of <abbr>. (ed: Once common tools like chrome-extensions, h2vx, operator all support the HTML5 time element, let's upgrade this statement to a MUST).

How to use it

  • enclose the preferred local human readable text that you want to make globally human & machine readable with <abbr>
  • add the relevant microformats property names to the <abbr> tag's class attribute
  • add a title attribute to the abbr element with the globally human & machine readable data as the value
  • The end result MUST be human readable & listenable, when reading/speaking the abbr element's contents and its surroundings and when reading/speaking the abbr element's title attribute with its surrounding text.

Example

The date-design-pattern formally encodes globally human readable ISO dates into an abbr element. Per the documentation/research on the date-design-pattern page, ISO8601 dates, e.g. of the form YYYY-MM-DD, are the most globally/internationally date format.

Note: that dates and times SHOULD be marked up with the HTML5 time element. These examples illustrate both span/abbr markup for pre-HTML5 tools, and time element support for HTML5-capable tools.

Before:

The party is on the 10th.

After:

The party is on <abbr class="dtstart" title="2005-10-10">the 10th</abbr>.

Better (with HTML5 time instead of abbr)

The party is on <time class="dtstart" datetime="2005-10-10">the 10th</time>.

You could also use the abbr-design-pattern to markup colloquial time references, but those should also use the HTML5 time element, e.g.

Before:

The party is at 10 o'clock.

After:

The party is at <abbr class="dtstart" title="10:00">10 o'clock</abbr>.

Better (with HTML5 time instead of abbr)

The party is at <time class="dtstart" datetime="10:00">10 o'clock</time>.

Alternative presentations

Note that the following are all equivalent, to a microformat parser:

<span class="dtstart">2007-05-01</span>

<abbr class="dtstart" title="2007-05-01">1 May 2007</abbr>

<abbr class="dtstart" title="2007-05-01">1st May 2007</abbr>.

<abbr class="dtstart" title="2007-05-01">May 1st 2007</abbr>.

<abbr class="dtstart" title="2007-05-01">The first of May, 2007</abbr>.

<abbr class="dtstart" title="2007-05-01">2007-05-01</abbr>.

<abbr class="dtstart" title="2007-05-01">Tuesday, 1 May 2007</abbr>

<abbr class="dtstart" title="2007-05-01">2007, day 121</abbr>

<abbr class="dtstart" title="2007-05-01">May Day, 2007</abbr>

<abbr class="dtstart" title="2007-05-01" lang="FR">1er mai, 2007</abbr>

<abbr class="dtstart" title="2007-05-01" lang="ES">1 de mayo, 2007</abbr>

and the following may be used in, say, a list, table, or page, headed "2007":

<abbr class="dtstart" title="2007-05-01">1 May</abbr>

Better (with HTML5 time element)

<time class="dtstart">2007-05-01</time>

<time class="dtstart" datetime="2007-05-01">1 May 2007</time>

<time class="dtstart" datetime="2007-05-01">1st May 2007</time>.

<time class="dtstart" datetime="2007-05-01">May 1st 2007</time>.

<time class="dtstart" datetime="2007-05-01">The first of May, 2007</time>.

<time class="dtstart" datetime="2007-05-01">2007-05-01</time>.

<time class="dtstart" datetime="2007-05-01">Tuesday, 1 May 2007</time>

<time class="dtstart" datetime="2007-05-01">2007, day 121</time>

<time class="dtstart" datetime="2007-05-01">May Day, 2007</time>

<time class="dtstart" datetime="2007-05-01" lang="FR">1er mai, 2007</time>

<time class="dtstart" datetime="2007-05-01" lang="ES">1 de mayo, 2007</time>

<time class="dtstart" datetime="2007-05-01">1 May</time>

anti-patterns

These are all past examples that are usages to avoid.

Authors MUST NOT use the abbr element as shown in these examples, as either the element text or the title attribute text are not easily human readable.

<span class="dtstart">20070501</span> 
<abbr class="dtstart" title="20070501">1 May 2007</abbr>
<abbr class="dtstart" title="20070501">1st May 2007</abbr>.
<abbr class="dtstart" title="20070501">May 1st 2007</abbr>.
<abbr class="dtstart" title="20070501">The first of May, 2007</abbr>.
<abbr class="dtstart" title="20070501">2007-05-01</abbr>.
<abbr class="dtstart" title="20070501">Tuesday, 1 May 2007</abbr>
<abbr class="dtstart" title="20070501">2007, day 121</abbr>
<abbr class="dtstart" title="20070501">May Day, 2007</abbr>
<abbr class="dtstart" title="20070501" lang="FR">1er mai, 2007</abbr>
<abbr class="dtstart" title="20070501" lang="ES">1 de mayo, 2007</abbr>
<abbr class="dtstart" title="20070501">1 May</abbr>

The lack of dashes in "20070501" makes it read like a large number, not a date, both when viewing it, and when listening to it being read by a screenreader.

Discussion

about datetimes

Avoid using the abbr-design-pattern for datetimes.

E.g. Authors MUST avoid doing this:

<abbr class="dtstart" title="20051012T11:10-0100">10 past 11 o'clock on the 12th</abbr>

Ideally use the HTML5 time element:

<time class="dtstart" datetime="2005-10-12T11:10-0100">10 past 11 o'clock on the 12th</time>

Note the use of the hyphenated date to make it more human readable, as the more readable that even machine data is made, the greater the chance that a human will be able to accurately check it and verify that it matches the locale/language-specific contents of the time element.

Alternatively, if the microformats tools you're using don't support HTML5 (yet), you may use the value-class-pattern with the abbr-design-pattern:

<span class="dtstart">
 <abbr class="value" title="11:10">10 past 11 o'clock</abbr> on 
 <abbr class="value" title="2005-10-10">the 10th</abbr>
</span>

informal names

Using ABBR to encode more formal human data around something less formal:

<abbr class="author" title="Danny Ayers">Danny</abbr>

This use is discouraged under the Don't Repeat Yourself principle, as it is a case of *more* information being less visibly present, namely, the family name in this case. If someone is not willing to make some information visible, then we shouldn't be encouraging them to store that information invisibly or less visibly, for all the same reasons that invisible metadata is bad/futile in the first place."

screen readers

The title attribute of the <abbr> tag MUST always be human readable and speakable.

Screenreaders such as JAWS and others which use title attributes from abbr, and when used properly (as in this example below from the WCAG group), pronounce words which would otherwise be unreadable or confusing.

<p>Sugar is commonly sold in 5 <abbr title="pound">lb.</abbr> bags.</p>
<p>Welcome to the <abbr title="World Wide Web">WWW</abbr>!</p>

If screen readers are unable to turn title content into something comprehensible, this will lead to accessibility failures. Here is a bad example:

we're having a party on 
<abbr class="dtstart" title="20070312T1700-06">
 March 12, 2007 at 5 PM
</abbr>

would be read by Jaws as

we're having a party on Twenty million seventy-thousand three-hundred twelve tee seventeen-hundred dash zero six. 

The accessibility task force from webstandards.org recommended:

<span class="dtstart" title="20070312T1700-06">
 March 12, 2007 at 5 PM, Central Standard Time
</span>

or

<span class="dtstart">
 March 12, 2007 at 5 PM, Central Standard Time
 <span class="value" title="20070312T1700-06"></span>
</span>

But both these approaches are problematic due to the title attribute being not easily human readable/verifiable because of:

  • unhyphenated date, e.g. bad: 20070312; good:2007-03-12
  • uncoloned time, e.g. bad: 1700; good: 17:00
  • timezone offset without minutes, e.g. bad: -06; better: -0600
  • combining date, time, and timezone into a single string without human-friendly separators

However, based on this input and subsequent research into better alternatives, the microformats community developed the value-class-pattern with the following two alternatives:

<span class="dtstart">
<abbr class="value" title="2007-03-12">March 12, 2007</abbr>
 at <abbr class="value" title="17:00">5 PM</abbr>, 
<abbr class="value" title="-0600">Central Standard Time</abbr>
</span>

or

<span class="dtstart"><span class="value-title" title="2007-03-12T17:00-0600"></span>
 March 12, 2007 at 5 PM, Central Standard Time
</span>

And again, the even better alternative is to use the HTML5 time element:

<time class="dtstart" datetime="2007-03-12 17:00-0600">
 March 12, 2007 at 5 PM, Central Standard Time
</time>

See Also