fixed duplicate elements bug
This commit is contained in:
parent
b35a24becc
commit
0903ac0fab
3 changed files with 375 additions and 19 deletions
|
@ -10,9 +10,12 @@ module Microformats2
|
|||
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|
|
||||
|
||||
doc.css("*[class|=h]").each do |microformat|
|
||||
constant_name = classify(microformat.attribute("class").to_s.gsub("-","_"))
|
||||
|
||||
if Object.const_defined?(constant_name)
|
||||
|
@ -33,7 +36,7 @@ module Microformats2
|
|||
microformats[constant_name.downcase.to_sym] << obj
|
||||
end
|
||||
|
||||
return microformats
|
||||
microformats
|
||||
end
|
||||
|
||||
def self.add_method(obj, method_name)
|
||||
|
|
351
test/IndieWebCamp.html
Normal file
351
test/IndieWebCamp.html
Normal file
|
@ -0,0 +1,351 @@
|
|||
<!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&action=edit" />
|
||||
<link rel="edit" title="Edit" href="/wiki/index.php?title=Main_Page&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&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&feed=rss" />
|
||||
<link rel="alternate" type="application/atom+xml" title="IndieWebCamp Atom feed" href="/wiki/index.php?title=Special:RecentChanges&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=-&action=raw&smaxage=0&gen=js&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&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&action=edit&redlink=1">Discussion</a> </li>
|
||||
<li id="ca-edit" ><a href="/wiki/index.php?title=Main_Page&action=edit">Edit</a> </li>
|
||||
<li id="ca-history" ><a href="/wiki/index.php?title=Main_Page&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&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&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&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>
|
|
@ -7,12 +7,12 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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
|
||||
|
@ -30,8 +30,10 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
</body>
|
||||
</html>
|
||||
END
|
||||
|
||||
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_hcard_from_html
|
||||
|
@ -40,7 +42,7 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
<head>
|
||||
<title>Simple hCard</title>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<h1 class="h-card">Chris</h1>
|
||||
</body>
|
||||
|
@ -49,14 +51,14 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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/">
|
||||
|
@ -70,20 +72,20 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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>
|
||||
|
@ -94,18 +96,18 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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>
|
||||
|
@ -116,18 +118,18 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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>
|
||||
|
@ -137,18 +139,18 @@ class TestMicroformats2 < Test::Unit::TestCase
|
|||
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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue