final commit

This commit is contained in:
Shane Becker 2013-04-18 21:34:08 -07:00
parent 0627c5a4d7
commit 19e8c25f6c
10 changed files with 2 additions and 823 deletions

View file

@ -1,19 +0,0 @@
=== 1.0.2 / 2011-06-28
* 2 bug fix
* parse d-duration as a string not a date
* change "class" to "klass" on elements with "class='p-class'"
=== 1.0.1 / 2011-06-28
* 1 bug fix
* fixed duplicate microformat problem
=== 1.0.0 / 2011-06-14
* 1 major enhancement
* Birthday!

View file

@ -1,10 +0,0 @@
.autotest
History.txt
Manifest.txt
README.md
Rakefile
bin/microformats2
lib/microformats2.rb
test/test_microformats2.rb
test/simple.html
test/IndieWebCamp.html

View file

@ -1,52 +1,6 @@
# Microformats
# MOVED!
For all future versions, go to:
**https://github.com/G5/microformats2**
# Microformats
http://github.com/veganstraightedge/microformats2
## DESCRIPTION
Generic Microformats 2 Extractor
## FEATURES/PROBLEMS
* parses and extracts [Microformats 2](http://microformats.org/wiki/microformats-2) syntax
* needs more test cases
* needs better docs
* needs to deal with nested microformats
* needs to deal with class-value pattern
## SYNOPSIS
Microformats2.parse(File.open("example.html"))
## REQUIREMENTS
* Hoe
* Nokogiri
## INSTALL
sudo gem install microformats2
## DEVELOPERS
After checking out the source, run:
rake newb
This task will install any missing dependencies,
run the tests/specs, and generate the RDoc.
## LICENSE
**PUBLIC DOMAIN.**
Your heart is as free as the air you breathe.
The ground you stand on is liberated territory.

View file

@ -1,13 +0,0 @@
# -*- ruby -*-
require 'rubygems'
require 'hoe'
Hoe.spec 'microformats2' do
developer('Shane Becker', 'veganstraightedge@gmail.com')
extra_deps << ['nokogiri', ">= 0"]
self.readme_file = "README.md"
end
# vim: syntax=ruby

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
abort "you need to write me"

View file

@ -1,121 +0,0 @@
require 'nokogiri'
require 'time'
require 'date'
module Microformats2
VERSION = "1.0.2"
class LoadError < StandardError; end
def self.parse(html)
raise LoadError, "argument must be a String or File" unless [String, File].include?(html.class)
html = html.read if IO === html
doc = Nokogiri::HTML(html)
microformats = Hash.new{|hash, key| hash[key] = Array.new}
doc.css("*[class*=h-]").each do |microformat|
microformat.attribute("class").to_s.split.each do |mf_class|
if mf_class =~ /^h-/
constant_name = mf_class.gsub("-","_").gsub(/^([a-z])/){$1.upcase}.gsub(/_(.)/) { $1.upcase }
if Object.const_defined?(constant_name)
klass = Object.const_get(constant_name)
else
klass = Class.new
Object.const_set constant_name, klass
end
obj = klass.new
add_properties(microformat, obj)
microformats[constant_name.downcase.to_sym] << obj
end
end
end
microformats
end
def self.add_method(obj, method_name)
unless obj.respond_to?(method_name)
obj.class.class_eval { attr_accessor method_name }
end
obj
end
def self.populate_method(obj, method_name, value)
if cur = obj.send(method_name)
if cur.kind_of? Array
cur << value
else
obj.send("#{method_name}=", [cur, value])
end
else
obj.send("#{method_name}=", value)
end
end
class Stripper
def transform(property)
property.text.gsub(/\n+/, " ").gsub(/\s+/, " ").strip
end
end
class URL
def transform(property)
(property.attribute("href") || property.text).to_s
end
end
class Date
def transform(property)
value = (property.attribute("title") || property.text).to_s
if value[0..0] =~ /[a-zA-Z]/
value
else
DateTime.parse(value)
end
end
end
class TimeThingy
def transform(property)
Time.parse((property.attribute("title") || property.text).to_s)
end
end
FormatClass = {
"p" => Stripper.new,
"n" => Stripper.new,
"e" => Stripper.new,
"i" => Stripper.new,
"u" => URL.new,
"d" => Date.new,
"t" => TimeThingy.new
}
def self.add_properties(mf, obj)
FormatClass.each do |letter, trans|
mf.css("*[class*=#{letter}-]").each do |property|
property.attribute("class").to_s.split.each do |css_class|
if css_class[0..1] == "#{letter}-"
css_class = css_class[2..-1].gsub("-","_")
method_name = css_class.gsub("-","_")
value = trans.transform(property)
if method_name == "class"
method_name = "klass"
end
add_method(obj, method_name)
populate_method(obj, method_name, value)
end
end
end
end
end
end

View file

@ -1,351 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="MediaWiki 1.15.4" />
<meta name="keywords" content="Main Page,Guest List,Schedule,Projects,Sessions,Planning,Issues,Why,Contribute,why,Session Notes" />
<link rel="alternate" type="application/x-wiki" title="Edit" href="/wiki/index.php?title=Main_Page&amp;action=edit" />
<link rel="edit" title="Edit" href="/wiki/index.php?title=Main_Page&amp;action=edit" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="search" type="application/opensearchdescription+xml" href="/wiki/opensearch_desc.php" title="IndieWebCamp (en)" />
<link title="Creative Commons" type="application/rdf+xml" href="/wiki/index.php?title=Main_Page&amp;action=creativecommons" rel="meta" />
<link rel="copyright" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" />
<link rel="alternate" type="application/rss+xml" title="IndieWebCamp RSS feed" href="/wiki/index.php?title=Special:RecentChanges&amp;feed=rss" />
<link rel="alternate" type="application/atom+xml" title="IndieWebCamp Atom feed" href="/wiki/index.php?title=Special:RecentChanges&amp;feed=atom" />
<title>IndieWebCamp</title>
<style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "/wiki/skins/indieweb/gumax_main.css?207"; /*]]>*/</style>
<link rel="stylesheet" type="text/css" media="print" href="/wiki/skins/common/commonPrint.css?207" />
<link rel="stylesheet" type="text/css" media="handheld" href="/wiki/skins/indieweb/handheld.css?207" />
<link rel="stylesheet" type="text/css" media="print" href="/wiki/skins/indieweb/print.css?207" />
<!--[if lt IE 5.5000]><style type="text/css">@import "/wiki/skins/indieweb/IE50Fixes.css?207";</style><![endif]-->
<!--[if IE 5.5000]><style type="text/css">@import "/wiki/skins/indieweb/IE55Fixes.css?207";</style><![endif]-->
<!--[if IE 6]><style type="text/css">@import "/wiki/skins/indieweb/IE60Fixes.css?207";</style><![endif]-->
<!--[if IE 7]><style type="text/css">@import "/wiki/skins/indieweb/IE70Fixes.css?207";</style><![endif]-->
<!--[if lt IE 7]><script type="text/javascript" src="/wiki/skins/common/IEFixes.js?207"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<meta property="og:title" content="IndieWebCamp" />
<meta property="og:type" content="event" />
<meta property="og:url" content="http://indiewebcamp.com" />
<meta property="og:image" content="http://indiewebcamp.com/wiki/skins/indieweb/images/indiewebcamp_logo_color.png" />
<meta property="og:site_name" content="IndieWebCamp" />
<meta property="fb:admins" content="11500459,31600719,214611" />
<script language="javascript" type="text/javascript" src="/files/jquery.js"></script>
<script type= "text/javascript">/*<![CDATA[*/
var skin = "IndieWeb";
var stylepath = "/wiki/skins";
var wgArticlePath = "/$1";
var wgScriptPath = "/wiki";
var wgScript = "/wiki/index.php";
var wgVariantArticlePath = false;
var wgActionPaths = {};
var wgServer = "http://indiewebcamp.com";
var wgCanonicalNamespace = "";
var wgCanonicalSpecialPageName = false;
var wgNamespaceNumber = 0;
var wgPageName = "Main_Page";
var wgTitle = "Main Page";
var wgAction = "view";
var wgArticleId = "1";
var wgIsArticle = true;
var wgUserName = "Iamshane.com";
var wgUserGroups = ["*", "user", "autoconfirmed"];
var wgUserLanguage = "en";
var wgContentLanguage = "en";
var wgBreakFrames = false;
var wgCurRevisionId = 428;
var wgVersion = "1.15.4";
var wgEnableAPI = true;
var wgEnableWriteAPI = true;
var wgSeparatorTransformTable = ["", ""];
var wgDigitTransformTable = ["", ""];
var wgRestrictionEdit = [];
var wgRestrictionMove = [];
var wgAjaxWatch = {"watchMsg": "Watch", "unwatchMsg": "Unwatch", "watchingMsg": "Watching...", "unwatchingMsg": "Unwatching..."};
/*]]>*/</script>
<script type="text/javascript" src="/wiki/skins/common/wikibits.js?207"><!-- wikibits js --></script>
<script type="text/javascript" src="/wiki/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;useskin=IndieWeb"><!-- site js --></script>
<!-- Head Scripts -->
<script type="text/javascript" src="/wiki/skins/common/ajax.js?207"></script>
<script type="text/javascript" src="/wiki/skins/common/ajaxwatch.js?207"></script>
<style type="text/css">/*<![CDATA[*/ .firstHeading, .subtitle, #siteSub, #contentSub, .pagetitle { display:none; } /*]]>*/</style>
</head>
<body class="mediawiki ltr ns-0 ns-subject page-Main_Page">
<div class="gumax-center" align="center">
<div id="gumax-rbox" align="left">
<div class="gumax-rbroundbox"><div class="gumax-rbtop"><div><div>
<a href="/" class="headContent"><h1>IndieWebCamp</h1></a>
</div></div></div>
<div class="gumax-rbcontentwrap"><div class="gumax-rbcontent">
<!-- =================== gumax-page =================== -->
<div id="gumax-page">
<!-- ===== Header ===== -->
<div id="gumax-header">
<div id="header-text"> IndieWebCamp is a 2-day dev camp in Portland, Oregon focused on building a more open Web.</div>
<a id="topHeader"></a>
<!-- Search -->
<!--
<div id="gumax-p-search" class="gumax-portlet">
<div id="gumax-searchBody" class="gumax-pBody">
<form action="/Special:Search" id="searchform"><div>
<input id="searchInput" name="search" type="text" accesskey="f" value="" />
<input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go" />
<input type='submit' name="fulltext" class="searchButton" id="mw-searchButton" value="Search" />
</div></form>
</div>
</div> --> <!-- end of gumax-p-search DIV -->
<!-- end of Search -->
</div> <!-- end of header DIV -->
<!-- ===== end of Header ===== -->
<!-- ===== Content body ===== -->
<div id="gumax-content-body">
<table id="gumax-content-body-table"><tr><td class="gumax-content-left">
<!-- Navigation Menu -->
<div id="gumax-p-navigation-wrapper">
<div class='gumax-portlet' id='p-navigation'>
<h5>Navigation</h5>
<div class="gumax-p-navigation">
<ul>
<li id="n-mainpage-description"><a href="/Main_Page">Main page</a></li>
<li id="n-Log-in-with-your-OpenID"><a href="/Special:OpenIDLogin">Log in with your OpenID</a></li>
<li id="n-Guest-List"><a href="/Guest_List">Guest List</a></li>
<li id="n-Schedule"><a href="/Schedule">Schedule</a></li>
<li id="n-Sessions"><a href="/Sessions">Sessions</a></li>
<li id="n-Sponsors"><a href="/Sponsors">Sponsors</a></li>
<li id="n-recentchanges"><a href="/Special:RecentChanges">Recent changes</a></li>
</ul>
</div>
</div>
<div class='gumax-portlet' id='p-Resources'>
<h5>Resources</h5>
<div class="gumax-p-navigation">
<ul>
<li id="n-Projects"><a href="/Projects">Projects</a></li>
<li id="n-Set-up-your-domain"><a href="/How_to_set_up_OpenID_on_your_own_domain">Set up your domain</a></li>
<li id="n-search"><a href="/Special:Search">Search</a></li>
</ul>
</div>
</div>
<div class="gumax-portlet" id="p-Links">
<div class="gumax-p-navigation banners">
<ul style="border: 0;">
<li style="border: 0; margin-top: 20px;">
<a href="/Sponsors"><img src="http://indiewebcamp.com/wiki/images/thumb/1/1f/ualogo.png/160px-ualogo.png" alt="Urban Airship" border="0" width="160" /></a>
</li>
<li style="border: 0; margin-top: 20px;">
<a href="/Sponsors"><img src="http://indiewebcamp.com/wiki/images/thumb/4/41/tropologo-vert.png/110px-tropologo-vert.png" alt="Tropo" border="0" width="110" /></a>
</li>
<li style="border: 0; margin-top: 20px;">
<a href="/Sponsors"><img src="http://indiewebcamp.com/wiki/images/5/54/wklogo.png" alt="Wieden+Kennedy" border="0" width="157" /></a>
</li>
</ul>
</div>
</div>
</div>
<!-- end of Navigation Menu -->
</td><td class="gumax-content-right"> <!-- Main Content TD -->
<!-- Main Content -->
<div id="content">
<a name="top" id="top"></a>
<h1 class="firstHeading">Main Page</h1>
<div id= "bodyContent" class="gumax-bodyContent">
<div id="contentSub"></div>
<!-- start content -->
<p><br />
</p>
<div class="vevent h-event">
<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#IndieWebCamp"><span class="tocnumber">1</span> <span class="toctext">IndieWebCamp</span></a></li>
<li class="toclevel-1"><a href="#Session_Notes"><span class="tocnumber">2</span> <span class="toctext">Session Notes</span></a></li>
<li class="toclevel-1"><a href="#When"><span class="tocnumber">3</span> <span class="toctext">When</span></a></li>
<li class="toclevel-1"><a href="#Where"><span class="tocnumber">4</span> <span class="toctext">Where</span></a>
<ul>
<li class="toclevel-2"><a href="#Travel"><span class="tocnumber">4.1</span> <span class="toctext">Travel</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Who"><span class="tocnumber">5</span> <span class="toctext">Who</span></a></li>
<li class="toclevel-1"><a href="#What"><span class="tocnumber">6</span> <span class="toctext">What</span></a></li>
<li class="toclevel-1"><a href="#Why"><span class="tocnumber">7</span> <span class="toctext">Why</span></a></li>
<li class="toclevel-1"><a href="#How"><span class="tocnumber">8</span> <span class="toctext">How</span></a></li>
<li class="toclevel-1"><a href="#More"><span class="tocnumber">9</span> <span class="toctext">More</span></a></li>
</ul>
</td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<a name="IndieWebCamp" id="IndieWebCamp"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: IndieWebCamp">edit</a>]</span> <span class="mw-headline"> <span class="summary p-summary p-name">IndieWebCamp</span> </span></h2>
<div class="description p-description">
<p>Rather than posting content on many third-party silos of data, we should all begin owning the data we're creating. Publish short status updates on your own domain, and syndicate to Twitter. Publish photos on your own domain, syndicate to Flickr, etc, etc.
</p><p>This is the basis of the "Indie Web" movement (see <a href="/why" title="why">why</a> for more). We'll get together for a weekend to talk about what has been done in the field, and what still needs to be done. There will be workshops and breakout sessions.
</p>
</div>
<p><a href="/Planning" title="Planning">Planners</a>: <span class="organizer vcard p-organizer h-card"><span class="fn"><a href="http://tantek.com" class="external text" title="http://tantek.com">Tantek Çelik</a></span></span>, <span class="organizer vcard p-organizer h-card"><span class="fn"><a href="http://aaron.pk" class="external text" title="http://aaron.pk">Aaron Parecki</a></span></span>, <span class="organizer vcard p-organizer h-card"><span class="fn"><a href="http://caseorganic.com" class="external text" title="http://caseorganic.com">Amber Case</a></span></span>, and <span class="organizer vcard p-organizer h-card"><span class="fn"><a href="http://skinnywhitegirl.com" class="external text" title="http://skinnywhitegirl.com">Crystal Beasley</a></span></span>. Want to help? <a href="/Planning" title="Planning">Sign up to volunteer!</a>.
</p>
<a name="Session_Notes" id="Session_Notes"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=2" title="Edit section: Session Notes">edit</a>]</span> <span class="mw-headline"> Session Notes </span></h2>
<p>See the <b><a href="/Schedule" title="Schedule">Schedule</a></b> to read and add session notes. Click on the session title to add notes to the page. To see all session notes, see <b><a href="/Category:Session_Notes" title="Category:Session Notes">Category:Session Notes</a></b>
</p>
<a name="When" id="When"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=3" title="Edit section: When">edit</a>]</span> <span class="mw-headline"> When </span></h2>
<p>IndieWebCamp was on <span class="dtstart d-start">2011-06-25</span> and <span class="dtend d-end">2011-06-26</span>. See the <a href="/Schedule" title="Schedule">Schedule</a> for more details. Note: <a href="http://opensourcebridge.org/" class="external text" title="http://opensourcebridge.org/">OSBridge</a> was June 21-24 immediately beforehand, consider attending that as well.
</p>
<a name="Where" id="Where"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=4" title="Edit section: Where">edit</a>]</span> <span class="mw-headline"> Where </span></h2>
<p><b><span class="location vcard p-location h-card"><span class="fn org p-name p-org">Urban Airship</span>, <span class="adr p-adr"><a href="http://maps.google.com/maps?q=334+NW+11th+Ave.,+Portland,+Oregon" class="external text" title="http://maps.google.com/maps?q=334+NW+11th+Ave.,+Portland,+Oregon">334 NW 11th Ave., Portland, Oregon</a></span></span></b>.
</p><p><a href="http://urbanairship.com/company/" class="external text" title="http://urbanairship.com/company/">Urban Airship</a> is graciously providing the space for IndieWebCamp.
</p>
<a name="Travel" id="Travel"></a><h3><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=5" title="Edit section: Travel">edit</a>]</span> <span class="mw-headline"> Travel </span></h3>
<p>Flights: If you're flying from the SF/Bay Area to Portland (PDX), Alaska Airlines and Southwest Airlines are recommended and have frequent flights to PDX.
</p>
<a name="Who" id="Who"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=6" title="Edit section: Who">edit</a>]</span> <span class="mw-headline"> Who </span></h2>
<p>To get on the <a href="/Guest_List" title="Guest List">guest list</a>, <a href="/Special:OpenIDLogin" title="Special:OpenIDLogin">log in</a> to this wiki with your personal OpenID and <a href="/Guest_List" title="Guest List">add yourself</a>!
</p><p><i>IndieWebCamp is for active builders only in order to focus the limited time we have on productive real world discussions and code/design/ux sharing that will help us move forward.</i>
</p><p>Attendees must have a personal URL enabled with OpenID, or be an apprentice to someone who has one in order to attend.
</p>
</div>
<a name="What" id="What"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=7" title="Edit section: What">edit</a>]</span> <span class="mw-headline"> What </span></h2>
<ul><li> <a href="/Projects" title="Projects">Projects</a>
</li><li> <a href="/Sessions" title="Sessions">Sessions</a>
</li></ul>
<a name="Why" id="Why"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=8" title="Edit section: Why">edit</a>]</span> <span class="mw-headline"> Why </span></h2>
<ul><li> <a href="/Why" title="Why">Why</a>
</li></ul>
<a name="How" id="How"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=9" title="Edit section: How">edit</a>]</span> <span class="mw-headline"> How </span></h2>
<ul><li> How to <a href="/Contribute" title="Contribute">Contribute</a>
</li></ul>
<a name="More" id="More"></a><h2><span class="editsection">[<a href="/wiki/index.php?title=Main_Page&amp;action=edit&amp;section=10" title="Edit section: More">edit</a>]</span> <span class="mw-headline"> More </span></h2>
<ul><li> <a href="/Issues" title="Issues">Issues</a> - any problems with the wiki, the website, or anything else to do with IndiWebCamp
</li><li> <a href="/Planning" title="Planning">Planning</a> - want to help out with IndieWebCamp? <a href="/Planning" title="Planning">Volunteer!</a>.
</li><li> <a href="irc://irc.freenode.net/indiewebcamp" class="external free" title="irc://irc.freenode.net/indiewebcamp">irc://irc.freenode.net/indiewebcamp</a>
</li></ul>
<!--
NewPP limit report
Preprocessor node count: 50/1000000
Post-expand include size: 0/2097152 bytes
Template argument size: 0/2097152 bytes
Expensive parser function count: 0/100
-->
<!-- Saved in parser cache with key indiewebcamp:pcache:idhash:1-0!1!0!!en!2 and timestamp 20110627011606 -->
<div class="printfooter">
Retrieved from "<a href="http://indiewebcamp.com/Main_Page">http://indiewebcamp.com/Main_Page</a>"</div>
<!-- end content -->
<div class="visualClear"></div>
</div>
</div>
<!-- end of Main Content -->
</td></tr></table>
</div>
<!-- ===== end of Content body ===== -->
</div> <!-- end of gumax-page DIV -->
<!-- =================== end of gumax-page =================== -->
<!-- ===== gumax-page-actions ===== -->
<div id="gumax-page-actions">
<div id="gumax-content-actions">
<ul>
<li id="ca-nstab-main" class="selected" ><a href="/Main_Page">Page</a> </li>
<li id="ca-talk" class="new" ><a href="/wiki/index.php?title=Talk:Main_Page&amp;action=edit&amp;redlink=1">Discussion</a> </li>
<li id="ca-edit" ><a href="/wiki/index.php?title=Main_Page&amp;action=edit">Edit</a> </li>
<li id="ca-history" ><a href="/wiki/index.php?title=Main_Page&amp;action=history">History</a> </li>
<li id="ca-move" ><a href="/Special:MovePage/Main_Page">Move</a> </li>
<li id="ca-watch" ><a href="/wiki/index.php?title=Main_Page&amp;action=watch">Watch</a> </li>
<!-- show back to top link only if the body is longer than the window height -->
<!--
<script type="text/javascript">
var winheight = parseInt(document.documentElement.clientHeight)
var boheight = parseInt(document.body.clientHeight)
if(winheight <= boheight) {
document.write('<li><a href="#" onclick="window.scrollTo(0,0);return false;" title="Back to the top of the page">Back to top</a></li>');
}
</script>
-->
<!-- end of show back to top link only -->
</ul>
</div>
</div>
<!-- ===== end of gumax-page-actions ===== -->
<!-- =================== gumax-page-footer =================== -->
<div id="gumax-page-footer">
<!-- personal tools -->
<div id="gumax-personal-tools">
<ul>
<li id="t-upload"><a href="/Special:Upload">Upload file</a> | </li>
<li id="t-specialpages"><a href="/Special:SpecialPages">Special pages</a> </li>
<li id="t-permalink"> | <a href="/wiki/index.php?title=Main_Page&amp;oldid=428">Permanent link</a></li>
</ul>
<!-- Login -->
<div id="gumax-footer-login">
<ul>
<li id="gumax-pt-userpage"><a href="/User:Iamshane.com">Iamshane.com</a>
|</li>
<li id="gumax-pt-mytalk"><a href="/User_talk:Iamshane.com" class="new">My talk</a>
|</li>
<li id="gumax-pt-preferences"><a href="/Special:Preferences">My preferences</a>
|</li>
<li id="gumax-pt-watchlist"><a href="/Special:Watchlist">My watchlist</a>
|</li>
<li id="gumax-pt-mycontris"><a href="/Special:Contributions/Iamshane.com">My contributions</a>
|</li>
<li id="gumax-pt-logout"><a href="/wiki/index.php?title=Special:UserLogout&amp;returnto=Main_Page">Log out</a>
</li>
</ul>
</div>
<!-- end of Login -->
</div> <!-- end of personal-tools DIV -->
<!-- end of personal tools -->
<!-- gumax-footer -->
<div id="gumax-footer">
<div id="gumax-f-message">
<span id="f-lastmod"> This page was last modified on 26 June 2011, at 18:16.</span>
<span id="f-viewcount">This page has been accessed 23,017 times. </span>
</div>
</div>
<!-- end of gumax-footer -->
<script type="text/javascript">if (window.runOnloadHook) runOnloadHook();</script>
</div>
<!-- =================== end of gumax-page-footer =================== -->
</div></div>
<div class="gumax-rbbot"><div><div></div></div></div></div>
</div>
</div>
<!-- Served in 0.136 secs. --><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-16359758-21']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body></html>

View file

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>hCalendar test</title>
</head>
<body>
<div class="h-event">
<h2 class="p-summary">Barcamp Brighton 1</h2>
<div>
<abbr class="d-duration" title="P2D">2 day</abbr> event.
</div>
<div>
<abbr class="d-dtstart" title="2007-09-08">8</abbr> -
<abbr class="d-dtend" title="2007-09-09">9 September 2007</abbr>
</div>
<div>Loaction: <span class="p-location">Madgex Office, Brighton</span></div>
<div class="p-description">Barcamp is an ad-hoc gathering born from the desire to share and learn in an open environment.</div>
<a class="u-url" href="http://www.barcampbrighton.org/">http://www.barcampbrighton.org/</a>
<div>This meeting is <strong class="p-class">public</strong>.</div>
<div>Created: <abbr class="d-dtstamp" title="2007-05-01">1 May 2007</abbr></div>
<div>Last modified: <abbr class="d-last-modified" title="2007-05-02">2 May 2007</abbr></div>
<div>Ref: <span class="i-uid">guid1.example.com</span></div>
<div>Status: <span class="p-status">Confirmed</span></div>
<abbr class="n-geo" title="37.77;-122.41">Northern California</abbr>
<div class="p-contact h-card">
Contact: <span class="p-fn">John Doe</span>
</div>
<div class="p-organizer h-card">
Managed by: <span class="p-fn p-org">Example Company</span>
</div>
</div>
</body>
</html>

View file

@ -1,30 +0,0 @@
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<a class="p-fn u-url" href="http://factoryjoe.com/">
<span class="foxtrot echo niner p-given-name">Chris</span>
<abbr class="p-additional-name">R.</abbr>
<span class="p-family-name">Messina</span>
</a>
</h1>
<h1 class="panda h-card">
<a class="p-fn u-url" href="http://iamshane.com">
<span class="p-given-name">Shane</span>
<abbr class="p-additional-name">B</abbr>
<span class="p-family-name">Becker</span>
</a>
</h1>
<h1 class="h-mitch">
<a class="p-snap" href="http://iamshane.com">
<span class="p-krackle">Breakfast</span>
<span class="p-pop">Cereal</span>
</a>
</h1>
</body>
</html>

View file

@ -1,185 +0,0 @@
require "test/unit"
require "microformats2"
class TestMicroformats2 < Test::Unit::TestCase
def test_throw_exception_on_non_string_params
assert_raise Microformats2::LoadError do
Microformats2.parse(nil)
end
end
def test_returns_hash_of_microformat_objects
result = Microformats2.parse("A String")
assert_equal Hash, result.class
end
def test_only_parse_microformats
result = Microformats2.parse("<html><body><p>Something</p></body></html>")
assert_equal 0, result.size
end
def test_extracts_hcard_from_an_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "simple.html")))
assert_equal HCard, result[:hcard].first.class
assert_equal 2, result[:hcard].length
end
def test_extracts_name_from_tag_with_multiple_classes
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "simple.html")))
assert_equal "Chris", result[:hcard].first.given_name
end
def test_extracts_hcalendar_from_an_indiewebcamp_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "IndieWebCamp.html")))
assert_equal 1, result[:hevent].length
assert result[:hcard].map { |h| h.name }.include?("Urban Airship")
end
def test_extracts_dates_in_an_hcalendar_from_an_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "hcalendar.html")))
assert_equal result[:hevent].first.dtstart, DateTime.parse("2007-09-08")
end
def test_extracts_date_durations_as_a_string_from_an_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "hcalendar.html")))
assert_equal result[:hevent].first.duration, "P2D"
end
def test_turns_class_values_of_class_to_klass_from_an_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "hcalendar.html")))
assert_equal result[:hevent].first.klass, "public"
end
def test_extracts_hcalendar_from_an_html_file
result = Microformats2.parse(File.open(File.join(File.dirname(__FILE__), "IndieWebCamp.html")))
assert_equal 1, result[:hevent].length
assert result[:hcard].map { |h| h.name }.include?("Urban Airship")
end
def test_extracts_hcard_from_html
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">Chris</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
assert_equal HCard, result[:hcard].first.class
end
def test_constructs_properties_from_hcard
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<a class="p-fn u-url" href="http://factoryjoe.com/">
<span class="p-given-name">Chris</span>
<abbr class="p-additional-name">R.</abbr>
<span class="p-family-name">Messina</span>
</a>
</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
mycard = result[:hcard].first
assert_equal "Chris", mycard.given_name
assert_equal "R.", mycard.additional_name
assert_equal "Messina", mycard.family_name
assert_equal "Chris R. Messina", mycard.fn
end
def test_constructs_dates
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<span class="d-bday">1979-09-18</span>
<span class="d-epoch" title="1970-01-01">EPOCH!</span>
</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
mycard = result[:hcard].first
assert_equal DateTime.parse("1979-09-18"), mycard.bday
assert_equal DateTime.parse("1970-01-01"), mycard.epoch
end
def test_constructs_times
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<span class="t-start">09:30</span>
<span class="t-end" title="6:00">Leaving time</span>
</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
mycard = result[:hcard].first
assert_equal Time.parse("09:30"), mycard.start
assert_equal Time.parse("06:00"), mycard.end
end
def test_ignores_pattern_matches_not_at_the_beginning_of_class
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<span class="p-n-x">Chris</span>
</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
mycard = result[:hcard].first
assert_equal "Chris", mycard.n_x
assert mycard.n_x.is_a?(String)
end
def test_constructs_urls_from_hcard
hcard = <<-END
<html>
<head>
<title>Simple hCard</title>
</head>
<body>
<h1 class="h-card">
<a class="p-fn u-url" href="http://factoryjoe.com/">Chris</a>
</h1>
</body>
</html>
END
result = Microformats2.parse(hcard)
mycard = result[:hcard].first
assert_equal "http://factoryjoe.com/", mycard.url
end
end