1. Microformats Helper Cheat Sheet

    September 6th, 2006

    microformats.png

    And a cheat sheet for the Microformats Helper, so now you have no excuse but to use it.

    Download as HTML, PDF, or if you’re using cheat: cheat microformats_helper.

  2. Microformat helper for Ruby on Rails

    August 25th, 2006

    microformat-for-rails.png

    1. Start here, it’s a great introduction to microformats. Of head over to microformats.org.

    2. Install the microformats helper plugin:

    ./script/plugin install http://labnotes.org/svn/public/ruby/rails_plugins/microformat_helper

    3. Include the helper in your controller:

    helper :microformat

    4. Try it out with an hAtom feed:

    <% render_hfeed do
      posts.each do |post|
        render_hentry "post-#{post.id}" do %>
          <%= hentry_title post.title %>
          <%= hentry_content post.content %>
          <p>Published on <%= post.created_on.microformat :published %> by
            <%= hcard :fn=>post.author, :url=>post.author_url, :class=>"author" %>
          </p><%
        end
      end
    end %>

    The plugin currently provides helper methods for hAtom, basic hCard, and the datetime design pattern.

  3. Microformat Ruby Parser

    August 6th, 2006

    Check out what Andrew is doing for Microformat parsing:

    Now, there is a base-class Microformat that provides a structure for any sub-class to be created that specifies a Microformat that you want to parse.

    It’s a great way to parse different microformats, and keep the code simple and DRY.

    Andrew also fixed a bug in Scraper::Base, so grab a fresh copy from SVN or svn update. It will let you use the same technique to write reusable scrapers.

  4. The seven phases of dealing with microformats

    March 17th, 2006

    Just an observation …

    1. Disbelief. You just can’t make structured data accessible without using XML, RDF and WSDL. Structured data is inheritly complex and requires complex tools.
    2. Interest. Well, if this thing works, and the example looks so easy, I think I want to give it a try.
    3. Grokking. I get it! See, I just created my first event, and it only took five minutes of changing my blog template. Now I want to sit here posting events all day long. Anything good happening this week? When is your birthday?
    4. Hyping. Microformats are the next best thing since the last next best thing. We need microformats for weather and traffic reports. And maps with driving directions. And concert tickets. And a microformat for microformats.
    5. Overuse. I just created a microformat for my stamp collection, using the microformats microformat, and uploaded my entire collection. Bring on the crawlers!
    6. Reality. Someone else should do it. Unless it’s really useful, I just don’t have the time to look at it right now. Do we really need a microformat for laundry machines?
    7. Realization. If you have a common problem, then you need a simple solution. If you need a simple solution, look no further than microformats.
  5. Classifieds for bloggers

    February 7th, 2006

    Have something to sell? Looking for a place to rent? A date? Have an open position in your company? Post it on your blog.

    You’re probably asking, “if I post it on my blog, how will people find it?” We all know classifieds sites are where you go, so other people can find your listing. What if we changed that?

    Imagine a classifieds listing that searches millions of blogs and collects listings from all of them. Post it anywhere and peope can find it. Selling your old couch? Post it on your blog. Have an open position and need to hire? Post it on your company blog.

    You get the power of classifieds search: you can search listings from around the Internet, but also narrow it by category, price, location. And you get the power of blogging. Tell people who you are, what other great things you have to offer. Say it in your own words and pictures.

    To make this happen you’ll need a way to publish listings on your blog. And your blog needs a way to show the listing, so people can read it, and classifieds search engines can find it. So there are two parts to this solution.

    For WordPress users, we’ve made a plugin you can install and use to publish listings. Your listings won’t be discovered, not quite yet. This is a prototype of work in progress. It shows what can be done, but it also lets you participate. Try it out and tell us what you think, what you like, what you would change. All we know is, we want it to be simple, useful and fun.

    For the more technically inclined, join the Microformats discussion and give us ideas on how to make hListing better. Here’s a proposal from Assaf Arkin, Craig Donato and Rohit Khare.

    And if you’re not sure what I’m talking about, watch this screencast. It runs for 1 minute 20 seconds, and will give you a good idea of what we’re working on.

    You can download the plugin here.

    Credits: I want to thank Craig Donato of Oodle and Rohit Khare of CommerceNet for making this happen. It wouldn’t be possible without you.

    Picture of an old couch by Will Bragg.

  6. Screencast: Posting events with WordPress 2.0

    January 10th, 2006

    Want to post events on your blog? I wrote a WordPress plug-in that does just that. Here’s the screencast showing the plugin in action. It’s 4.68MB long and runs for 3:30.

    Specifying when the event starts

    Apparently, it’s not that complicated. Most of the smarts are in the UI: making it simple and intuitive to use, with simple AJAX to make up for JavaScript’s shortcomings (date/time validation).

    The event I’m posting about is the SD Forums Microformats round table taking place tonight. And here’s the blog post about it (the same one I’m screencasting).

    Update: Added a link to the uPress plug-in page.

  7. Microformat Parser for Ruby

    November 20th, 2005

    A Ruby library for creating parsers that can be used to extract microcontent from (X)HTML documents in a variety of microformats.

    This library has been out for a while, but now it has an official documentation page, and a RubyGem you can download from RubyForge.

    Oh, and gem install uformatparser is coming up, as soon as I figure out how to make it work.

    Update: Thanks to Tom Copeland of RubyForge for pointing me at the source of the problem. You can now install the Microformat Parser as a Gem with

    gem install uformatparser 

    Do I need to mention that RubyForge/RubyGem is one of the killer features of Ruby?

    Image by mollyeh11.

  8. Ruby Microcontent Parser

    September 5th, 2005

    That took a while longer than I expected to, but finally it’s here.

    Basically, it’s a framework for writing microcontent parsers. A microcontent parser is a class with a set of rules for extracting interesting content from (X)HTML documents. You create your own parser by writing a class with a set of rules.

    The magic happens in the _parse_ method which taks an (X)HTML document or element, runs all the rules on it, and returns new object that holds the extracted valus.

    Here’s an example:

    class MyParser
    include MicrocontentParser
    
    rule :links, "a", "a@href"
    rule :tags, "a[rel~=tag]“, “text()”
    end
    
    content = MyParser.parse(doc)
    puts “Found ” + content.links.size + ” links” if content.links
    puts “Tagged with ” + content.tags.join(’, ‘) if content.tags

    The class _MyParser_ is a microcontent parser with two rules. The first rule extracts the URLs of all the links in the document, and adds them to the _links_ array. The second rule extracts all the tag names in the document, and adds them to the _tags_ array.

    The call to _parse_ returns an object of type _MyParser_ with all links and tags extracted from the document.

    The documentation (and there’s a lot more features to learn about) and source code are all here: http://trac.labnotes.org/cgi-bin/trac.cgi/wiki/MicroParserRuby