Added ability to accept microformats that are not at the beginning of a class string for attributes

This commit is contained in:
Shane Becker 2011-06-28 20:04:15 -07:00
parent ea8a526da3
commit 601a65d1db
3 changed files with 8 additions and 3 deletions

View file

@ -6,7 +6,7 @@
<body>
<h1 class="h-card">
<a class="p-fn u-url" href="http://factoryjoe.com/">
<span class="p-given-name">Chris</span>
<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>

View file

@ -23,6 +23,11 @@ class TestMicroformats2 < Test::Unit::TestCase
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_hcard_from_html
hcard = <<-END