public
Description: Microformats Helper is a plugin for generating content-rich tags in HTML files, following Microformats standards. For more information about Microformats, check its website (http://microformats.org).
Homepage:
Clone URL: git://github.com/shadow11/microformats_helper.git
shadow11 (author)
Fri Sep 04 10:35:50 -0700 2009
commit  d5eb3166e9103d0b79e309d588e4d76f34dd38b0
tree    2f3fea00d7fd4bcfd2c6b7f4f90661f6ed063e9f
parent  e1c7f4224f50006132d4262e5d349c1eae9b6af8
name age message
file LICENSE Thu Jun 12 14:46:17 -0700 2008 Documentation [shadow11]
file README Thu Jun 12 14:46:17 -0700 2008 Documentation [shadow11]
file README.rdoc Fri Sep 04 09:53:31 -0700 2009 Support for multiple phone numbers [shadow11]
file Rakefile Thu Jun 12 13:15:55 -0700 2008 Added some working tests [shadow11]
file init.rb Thu Jun 12 12:11:28 -0700 2008 Initial commit [shadow11]
directory lib/ Fri Sep 04 10:35:50 -0700 2009 Show telephone in reverse order [shadow11]
directory rdoc/ Thu Jun 12 14:46:17 -0700 2008 Documentation [shadow11]
directory test/ Fri Sep 04 10:35:50 -0700 2009 Show telephone in reverse order [shadow11]
README.rdoc

Microformats Helper

Microformats Helper is a plugin for generating content-rich tags in HTML files, following Microformats standards. For more information about Microformats, check its website (microformats.org).

Currently only the hCard microformat is available.

Options

All fields are optional but the name, you are required to provide at least one of the names below.

Name

  • fn - Formal Name: should be used when no other name is provided
  • given - Given Name
  • family - Family Name
  • additional - Additional Name: goes between given and family names
  • prefix - Honorific Prefix: for titles like Dr. or Sir
  • suffix - Honorific Suffix: for titles like M.D. or Jr
  • org - Organization name

Address

  • street - Street Address
  • locality - The city or similar
  • region - The state, county or similar
  • postal_code - ZIP number
  • country - The country

Contact

  • tel - Provide a hash with the phone types and numbers
  • url - Add a link to a site in the name
  • email - Add a link to a mailto: address

Usage

In your views:

  <%= hcard :fn => "Ricardo Yasuda" %>

The output is:

  <span class="vcard">
        <span class="fn n">Ricardo Yasuda</span>
  </span>

A more complicated example:

  <%= hcard :given => "Ricardo", :family => "Yasuda", :url => "http://blog.shadowmaru.org", :country => "Brazil" %>

The output is:

  <span class="vcard">
        <a href="http:blog.shadowmaru.org" class="fn n url">
                <span class="given-name">Ricardo</span> <span class="family-name">Yasuda</span>
        </a>
        <span class="adr">
                <span class="country-name">Brazil</span>
        </span>
  </span>

An example with telephone numbers:

  <%= hcard(:fn => "John Doe", :tel => { "fax" => "544-5544", "home" => "555-5555" }) %>

The output is:

  <span class="vcard">
    <span class="fn n">John Doe</span>
    <span class="tel">
      <span class="tel-label-fax type">Fax: </span><span class="value">544-5544</span>
      <span class="tel-label-home type">Home: </span><span class="value">555-5555</span>
    </span>
  </span>