[uf-dev] Preventing false positives

Toby A Inkster mail at tobyinkster.co.uk
Sat May 3 02:15:04 PDT 2008


Zachary Carter wrote:

> To help elaborate my situation:
>
>        <div class="vcard">
>          <h1 class="fn n">
>            <span class="honorific-prefix">Dr.</span>
>            <span class="given-name">Marvin</span>
>            <span class="family-name">Candle</span>
>          </h1>
>          <p>
>            <span class="label">Website:</span> <a
> href="http://example.org" class="url">http://example.org</a>
>          </p>
>          <h2 class="title">Applications</h2>
>          <p class="applications">
>            [... third party content ...]
>          </p>
>        </div>
>
> Title and label classes are not being used as hcard properties, so I
> would want to exclude them.

Well, TITLE is a singular property, so it should be easy to force  
microformat parsers to ignore your title class -- simply include a  
blank title:

	<span class="title" style="display:none"></span>

earlier on in the vCard (before your <h2> element). Parsers should  
just pick up the first title and ignore the later one. LABEL is a  
plural property, so this approach will not work for that.

MFO as implemented by Cognition (and I emphasise that the MFO effort  
is still in the brainstorming stage, so the final MFO spec, if any,  
may be completely different) can be used to provide a solution for  
both the TITLE and LABEL:

    <div class="vcard">
      <h1 class="fn n">
        <span class="honorific-prefix">Dr.</span>
        <span class="given-name">Marvin</span>
        <span class="family-name">Candle</span>
      </h1>
      <p>
        <span class="mfo"><span class="label">Website:</span></span>
        <a href="http://example.org" class="url">http://example.org</a>
      </p>
      <div class="mfo">
        <h2 class="title">Applications</h2>
        <p class="applications">
          [... third party content ...]
        </p>
      </div>
    </div>

Of course the most obvious solution is simply:

    <div class="vcard">
      <h1 class="fn n">
        <span class="honorific-prefix">Dr.</span>
        <span class="given-name">Marvin</span>
        <span class="family-name">Candle</span>
      </h1>
      <a href="http://example.org" class="url" style="display:none"></a>
    </div>
    <p>
      <span class="label">Website:</span>
      <a href="http://example.org">http://example.org</a>
    </p>
    <h2 class="title">Applications</h2>
    <p class="applications">
      [... third party content ...]
    </p>

Which should work in all present-day parsers.

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>





More information about the microformats-dev mailing list