h-card parsing tests

This page was design to test the parsing of h-card. These tests are part of the micorformats 2 test suite.

Just a name (h-card parsing test)

Frances Berriman

The expected JSON output:


{
    "items": [{
        "type": ["h-card"],
        "properties": {
            "name": ["Frances Berriman"]
        }
    }]
}

Just a hyperlink (h-card parsing test)

Ben Ward

The expected JSON output:


{
    "items": [{
        "type": ["h-card"],
        "properties": {
            "name": ["Ben Ward"],
            "url": ["http://benward.me/"]
        }
    }]
}

A hyperlinked photo (h-card parsing test)

Rohit Khare

The expected JSON output:


{
    "items": [{
        "type": ["h-card"],
        "properties": {
            "name": ["Rohit Khare"],
            "photo": ["https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg"],
            "url": ["http://rohit.khare.org/"]
        }
    }]
}

Single child implied pattern (h-card parsing test)

Håkon Wium Lie

The expected JSON output:


{
    "items": [{
        "type": ["h-card"],
        "properties": {
            "name": ["Håkon Wium Lie"],
            "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/H%C3%A5kon-Wium-Lie-2009-03.jpg/215px-H%C3%A5kon-Wium-Lie-2009-03.jpg"],
            "url": ["http://people.opera.com/howcome/"]
        }
    }]
}

An extended description (h-card parsing test)

photo of Mitchell

Mitchell Baker (@MitchellBaker) Mozilla Foundation

Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.

Strategy and Leadership

The expected JSON output:


{
    "items": [{
        "type": ["h-card"],
        "properties": {
            "photo": ["http://blog.mozilla.org/press/files/2012/04/mitchell-baker.jpg"],
            "url": ["http://blog.lizardwrangler.com/", "https://twitter.com/MitchellBaker"],
            "name": ["Mitchell Baker"],
            "org": ["Mozilla Foundation"],
            "note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."],
            "category": ["Strategy", "Leadership"]
        }
    }]
}

Organization marked-up with h-card (h-card parsing test)

The expected JSON output:


    {
        "items": [{ 
            "type": ["h-card"],
            "properties": {
                "url": ["http://blog.lizardwrangler.com/"],
                "name": ["Mitchell Baker"],
                "org": [{
                    "value": "Mozilla Foundation",
                    "type": ["h-card"],
                    "properties": {
                        "name": ["Mozilla Foundation"],
                        "url": ["http://mozilla.org/"]
                    }
                }]
            }
        },{
            "type": ["h-card"],
            "properties": {
                "name": ["Mozilla Foundation"],
                "url": ["http://mozilla.org/"]
            }
        }]
    }

Organization marked-up with h-card and h-org (h-card parsing test)

The expected JSON output:


{
    "items": [{ 
        "type": ["h-card"],
        "properties": {
            "name": ["Mitchell Baker"],
            "url": ["http://blog.lizardwrangler.com/"],
            "org": [{
                "value": "Mozilla Foundation",
                "type": ["h-card", "h-org"],
                "properties": {
                    "name": ["Mozilla Foundation"],
                    "url": ["http://mozilla.org/"]
                }
            }]
        }
    },{
        "type": ["h-card"],
        "properties": {
            "name": ["Mozilla Foundation"],
            "url": ["http://mozilla.org/"]
        }
    },{
        "type": ["h-org"],
        "properties": {
            "name": ["Mozilla Foundation"]
        }
    }]
}

Additional nested microformats (h-card parsing test)

The expected JSON output:


{
    "items": [{ 
        "type": ["h-card"],
        "properties": {
            "name": ["Mitchell Baker"],
            "url": ["http://blog.lizardwrangler.com/"]
        },
        "children": [{
            "type": ["h-card", "h-org"],
            "properties": {
                "name": ["Mozilla Foundation"],
                "url": ["http://mozilla.org/"]
            }
        }]
    },{
        "type": ["h-card"],
        "properties": {
            "name": ["Mozilla Foundation"],
            "url": ["http://mozilla.org/"]
        }
    },{
        "type": ["h-org"],
        "properties": {
            "name": ["Mozilla Foundation"]
        }
    }]
}

p-property (h-card parsing test)

John P Doe
BSc

BA PHD company logos Madgex Mozilla

The expected JSON output:


{
    "items": [{ 
        "type": ["h-card"],
        "properties": {
            "name": ["John Doe"],
            "given-name": ["John"],
            "additional-name": ["Peter"],
            "family-name": ["Doe"],
            "honorific-suffix": ["MSc","PHD"],
            "org": ["Madgex", "Mozilla"]
        }
    }]
}

Note: This test the parse order of elements and attributes as laid out in http://microformats.org/wiki/microformats2-parsing wiki page.

Change log:

Contributors :