microformats_helper icon indicating copy to clipboard operation
microformats_helper copied to clipboard

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

=Microformats Helper

{}[https://travis-ci.org/shadowmaru/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 (http://microformats.org).

Currently only hCard and hReview microformats are 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:

Ricardo Yasuda

A more complicated example:

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

The output is:

Ricardo Yasuda Brazil

An example with telephone numbers:

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

The output is:

John Doe Fax: 544-5544 Home: 555-5555

==Credits

Many thanks to Carsten Zimmermann [carpodaster] (hReview and Rails 3 support) and arnaud sellenet [demental] (gem creation). Contributions are always welcome.