[uf-discuss] changing abbr-design-pattern to title-design-pattern?
Jeremy Keith
jeremy at adactio.com
Sat Apr 28 03:16:18 PDT 2007
James Craig wrote:
> Due to opening up the pattern a bit more, there will also need to
> be a flag to indicate when to use title attribute versus contents.
> Something like this "useTitle" class:
No, this smells like a really bad idea. That class is now an
instruction for machines.
One of the fundamental tenets of microformats is that ease of
publishing should trump ease of parsing ("people first, machines
second"). A class like "useTitle" would make parsing easier but it's
a pain in the butt for publishers. I think we can come up with a rule
for parsers that doesn't require any superfluous classes (even if it
means that the parsers have to work harder).
The problem:
Right now it is perfectly valid to encode a datetime like this:
<span class="dtstart">2007-05-01</span>
see http://microformats.org/wiki/abbr-design-pattern
Under the proposed title design pattern, this would also be a valid
way of encoding a datetime:
<span class="dtstart" title="2007-05-01">May 1st 2007</span>
Now a parser must figure out where the machine-readable datetime is.
In this example, it's pretty straightforward: look in the title
attribute first; if there is no title attribute, look at the value
enclose between the tags.
The tricky bit is when this occurs:
<span class="dtstart" title="a day of fun on the streets of
Berlin">2007-05-01</span>
If a parser looks at the title attribute first, it won't find the
machine-readable data. This is where something like James's class
suggestion would clarify the situation. But I believe this to be an
edge case. I think we'll get more than 80% of cases by simply saying
"for dtstart, dtend and geo values, look in the title attribute first
and between the tags second." And to cover the edge cases, I think
the onus is on the parsers to figure out whether a string looks like
a machine-readable piece of data. For datetime patterns, that's
simply a case of using a regular expression already documented on the
wiki:
http://microformats.org/wiki/datetime-design-pattern#Code
In short, I don't think any kind of flag is necessary to indicate
where the machine-readable data is being stored. I think that any
such flag would unnecessary complexity for humans. The patterns are
enough.
Bye,
Jeremy
--
Jeremy Keith
a d a c t i o
http://adactio.com/
More information about the microformats-discuss
mailing list