diff --git a/h-entry.html b/h-entry.html index dbf008d..5c458e7 100644 --- a/h-entry.html +++ b/h-entry.html @@ -117,7 +117,10 @@

The expected JSON output:

"properties": { "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], "name": ["microformats.org at 7"], - "content": ["\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n "], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], "updated": ["2012-06-25T17:08:26"], "author": [{ "value": "Tantek", diff --git a/h-news.html b/h-news.html index 38b427b..cdbb1fa 100644 --- a/h-news.html +++ b/h-news.html @@ -71,7 +71,10 @@

The expected JSON output:

"properties": { "name": ["microformats.org at 7"], "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], - "content": ["\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n "], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], "updated": ["2012-06-25T17:08:26"], "author": { "value": "Tantek", @@ -157,7 +160,10 @@

The expected JSON output:

"properties": { "name": ["microformats.org at 7"], "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], - "content": ["\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n "], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], "summary": ["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."], "updated": ["2012-06-25T17:08:26"], "author": { diff --git a/h-product.html b/h-product.html index c03a8ec..f795a14 100644 --- a/h-product.html +++ b/h-product.html @@ -106,7 +106,10 @@

The expected JSON output:

"properties": { "name": ["Raspberry Pi"], "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], - "description": ["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], "url": ["http://www.raspberrypi.org/"], "price": ["£29.95"], "category": ["Computer","Education"], @@ -165,7 +168,10 @@

The expected JSON output:

"properties": { "name": ["Raspberry Pi"], "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], - "description": ["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], "url": ["http://www.raspberrypi.org/"], "price": ["£29.95"], "review": [{ diff --git a/h-recipe.html b/h-recipe.html index 5aeb59e..bedeef7 100644 --- a/h-recipe.html +++ b/h-recipe.html @@ -47,7 +47,13 @@

The expected JSON output:

"type": ["h-recipe"], "properties": { "name": ["Toast"], - "ingredient": ["Slice of bread", "Butter"] + "ingredient": [{ + "value": "Slice of bread", + "html": "Slice of bread" + },{ + "value": "Butter", + "html": "Butter" + }] } }] } @@ -150,16 +156,26 @@

The expected JSON output:

} } ], - "ingredient": [ - "1 egg", - "75g plain flour", - "70ml milk", - "60ml water", - "Pinch of salt" - ], - "instructions": [ - "\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n " - ], + "ingredient": [{ + "value": "1 egg", + "html": "1 egg" + },{ + "value": "75g plain flour", + "html": "75g plain flour" + },{ + "value": "70ml milk", + "html": "70ml milk" + },{ + "value": "60ml water", + "html": "60ml water" + },{ + "value": "Pinch of salt", + "html": "Pinch of salt" + }], + "instructions": [{ + "value": "Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole Yorkshire pudding tins and place in the oven to heat through. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. Gradually add the milk and water while beating the mixture. It should be smooth and without lumps. Finally add a pinch of salt. Make sure the oil is piping hot before pouring the batter evenly into the tins. Place in the oven for 20-25 minutes until pudding have risen and look golden brown", + "html": "\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n " + }], "nutrition": [ "Calories: 125", "Fat: 3.2g", diff --git a/h-review.html b/h-review.html index 40648b4..e068000 100644 --- a/h-review.html +++ b/h-review.html @@ -233,7 +233,10 @@

The expected JSON output:

"name": ["Tantek"] } }], - "description": ["\n <p class=\"p-item h-card\">\n <span class=\"p-name p-org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"p-adr h-adr\"><span class=\"p-locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n "], + "description": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "html": "\n <p class=\"p-item h-card\">\n <span class=\"p-name p-org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"p-adr h-adr\"><span class=\"p-locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n " + }], "item": [{ "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", "type": ["h-card"], diff --git a/hentry.html b/hentry.html index 62c88e5..73d32bd 100644 --- a/hentry.html +++ b/hentry.html @@ -116,7 +116,10 @@

The expected JSON output:

"type": ["h-entry"], "properties": { "name": ["microformats.org at 7"], - "content": ["\n <p class=\"entry-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n "], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"entry-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], "summary": ["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."], "updated": ["2012-06-25T17:08:26"], "author": [{ diff --git a/hproduct.html b/hproduct.html index e78b5d9..392e923 100644 --- a/hproduct.html +++ b/hproduct.html @@ -110,7 +110,10 @@

The expected JSON output:

"properties": { "name": ["Raspberry Pi"], "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], - "description": ["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], "url": ["http://www.raspberrypi.org/"], "price": ["£29.95"], "category": ["Computer","Education"], @@ -174,7 +177,10 @@

The expected JSON output:

"properties": { "name": ["Raspberry Pi"], "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], - "description": ["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], "url": ["http://www.raspberrypi.org/"], "price": ["£29.95"], "review": [{ diff --git a/hreview.html b/hreview.html index eeeea18..4657109 100644 --- a/hreview.html +++ b/hreview.html @@ -238,7 +238,10 @@

The expected JSON output:

"name": ["Tantek"] } }], - "description": ["\n <p class=\"item vcard\">\n <span class=\"fn org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"adr\"><span class=\"locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n "], + "description": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "html": "\n <p class=\"item vcard\">\n <span class=\"fn org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"adr\"><span class=\"locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n " + }], "item": [{ "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", "type": ["h-item", "h-card"], diff --git a/lib/testWriter.js b/lib/testWriter.js index 36a1872..499a628 100644 --- a/lib/testWriter.js +++ b/lib/testWriter.js @@ -146,8 +146,8 @@ console.log('writing test: ' + p.name) if(p['x-output'] && p['x-microformat']){ - var json = p['x-output'][0]; - var html = p['x-microformat'][0]; + var json = p['x-output'][0].html; + var html = p['x-microformat'][0].html; // need to decode html from pre/code block var expected = JSON.parse( json.replace(/</g,"<").replace(/>/g,">") ); diff --git a/mocha-tests/adr-test.js b/mocha-tests/adr-test.js index b3b874a..3a7dbce 100644 --- a/mocha-tests/adr-test.js +++ b/mocha-tests/adr-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: adr.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/geo-test.js b/mocha-tests/geo-test.js index 19d0cb8..286c00a 100644 --- a/mocha-tests/geo-test.js +++ b/mocha-tests/geo-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: geo.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/h-adr-test.js b/mocha-tests/h-adr-test.js index 38c44ed..fe635b5 100644 --- a/mocha-tests/h-adr-test.js +++ b/mocha-tests/h-adr-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-adr.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -67,7 +67,7 @@ describe('Broken into properties (h-adr parsing test)', function() { describe('With geo data (h-adr parsing test)', function() { - var htmlFragment = "\n

\n Bricklayer's Arms\n \n 3 Charlotte Road, \n City of London, \n EC2A 3PE, \n UK \n – \n Geo:(51.526421;-0.081067) \n

\n" + var htmlFragment = "\n

\n Bricklayer's Arms\n \n 3 Charlotte Road, \n City of London, \n EC2A 3PE, \n UK \n – \n Geo:(51.526421;-0.081067) \n

\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-adr"],"properties":{"name":["Bricklayer's Arms"],"label":["3 Charlotte Road, City of London, EC2A 3PE, UK"],"street-address":["3 Charlotte Road"],"locality":["City of London"],"postal-code":["EC2A 3PE"],"country-name":["UK"],"geo":["51.526421;-0.081067"]}}]} diff --git a/mocha-tests/h-card-test.js b/mocha-tests/h-card-test.js index 2d78344..564443b 100644 --- a/mocha-tests/h-card-test.js +++ b/mocha-tests/h-card-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-card.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -247,7 +247,7 @@ describe('Additional nested microformats (h-card parsing test)', function() { describe('p-property (h-card parsing test)', function() { - var htmlFragment = "\n
\n \n \n John \n P \n Doe \n \n \n \n \n
BSc
\n
BA\n \n \n \"PHD\"\n \"company\n \n \"Madgex\"\n \"Mozilla\"\n \n
\n" + var htmlFragment = "\n
\n \n \n John \n P \n Doe \n \n \n \n \n
BSc
\n
BA\n \n \n \"PHD\"\n \"company\n \n \"Madgex\"\n \"Mozilla\"\n \n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"name":["John Doe"],"given-name":["John"],"additional-name":["Peter"],"family-name":["Doe"],"honorific-suffix":["MSc","PHD"],"org":["Madgex","Mozilla"]}}]} diff --git a/mocha-tests/h-entry-test.js b/mocha-tests/h-entry-test.js index aa54e97..51daf9c 100644 --- a/mocha-tests/h-entry-test.js +++ b/mocha-tests/h-entry-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-entry.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -47,9 +47,9 @@ describe('Just a hyperlink (h-entry parsing test)', function() { describe('Entry with summary and content (h-entry parsing test)', function() { - var htmlFragment = "\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n" + var htmlFragment = "\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-entry"],"properties":{"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"name":["microformats.org at 7"],"content":["\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "],"updated":["2012-06-25T17:08:26"],"author":[{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]}},{"type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]} + var expected = {"items":[{"type":["h-entry"],"properties":{"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"name":["microformats.org at 7"],"content":[{"value":"Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service","html":"\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "}],"updated":["2012-06-25T17:08:26"],"author":[{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]}},{"type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-entry"); @@ -63,8 +63,8 @@ describe('Entry with summary and content (h-entry parsing test)', function() { assert.equal(found.items[0].properties["name"][0].toString(), "microformats.org at 7"); }) - it("found.items[0].properties['content'][0]", function(){ - assert.equal(found.items[0].properties["content"][0].toString(), "\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "); + it("found.items[0].properties['content'][0].value", function(){ + assert.equal(found.items[0].properties["content"][0].value, "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service"); }) it("found.items[0].properties['updated'][0]", function(){ @@ -93,7 +93,7 @@ describe('Entry with summary and content (h-entry parsing test)', function() { describe('u-property (h-entry parsing test)', function() { - var htmlFragment = "\n
\n

microformats.org at 7

\n\n \n

\n \n Article permalink\n

\n

\n http://microformats.org/ - \n 2012/06/25/microformats-org-at-7 \n

\n\n

Article permalink

\n\n \"company\n \n \"microformats.org\"\n \n\n \"company\n\n \n\n value-class-pattern \n \n

http://microformats.org/discuss

\n
\n" + var htmlFragment = "\n
\n

microformats.org at 7

\n\n \n

\n \n Article permalink\n

\n

\n http://microformats.org/ - \n 2012/06/25/microformats-org-at-7 \n

\n\n

Article permalink

\n\n \"company\n \n \"microformats.org\"\n \n\n \"company\n\n \n\n value-class-pattern \n \n

http://microformats.org/discuss

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-entry"],"properties":{"name":["microformats.org at 7"],"url":["http://microformats.org/","http://microformats.org/2012/06/25/microformats-org-at-7","http://microformats.org/2012/06/25/microformats-org-at-7","http://microformats.org/","http://microformats.org/wiki/microformats2-parsing","http://microformats.org/wiki/value-class-pattern","http://microformats.org/wiki/","http://microformats.org/discuss"],"photo":["http://example.com/images/logo.gif"]}}]} diff --git a/mocha-tests/h-event-test.js b/mocha-tests/h-event-test.js index a3af3d9..1c0c2f6 100644 --- a/mocha-tests/h-event-test.js +++ b/mocha-tests/h-event-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-event.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/h-geo-test.js b/mocha-tests/h-geo-test.js index 4b1026b..642551d 100644 --- a/mocha-tests/h-geo-test.js +++ b/mocha-tests/h-geo-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-geo.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/h-news-test.js b/mocha-tests/h-news-test.js index 3adf7ed..631787a 100644 --- a/mocha-tests/h-news-test.js +++ b/mocha-tests/h-news-test.js @@ -1,15 +1,15 @@ /* Mocha integration test from: h-news.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; describe('Minimum properties (h-news parsing test)', function() { - var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n

\n microformats.org \n

\n
\n" + var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n

\n microformats.org \n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"content":["\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "],"updated":["2012-06-25T17:08:26"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek microformats.org"]}}]} + var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"content":[{"value":"Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service","html":"\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "}],"updated":["2012-06-25T17:08:26"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek microformats.org"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-news"); @@ -31,8 +31,8 @@ describe('Minimum properties (h-news parsing test)', function() { assert.equal(found.items[0].properties["entry"][0].properties["url"][0].toString(), "http://microformats.org/2012/06/25/microformats-org-at-7"); }) - it("found.items[0].properties['entry'][0].properties['content'][0]", function(){ - assert.equal(found.items[0].properties["entry"][0].properties["content"][0].toString(), "\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "); + it("found.items[0].properties['entry'][0].properties['content'][0].value", function(){ + assert.equal(found.items[0].properties["entry"][0].properties["content"][0].value, "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service"); }) it("found.items[0].properties['entry'][0].properties['updated'][0]", function(){ @@ -65,9 +65,9 @@ describe('Minimum properties (h-news parsing test)', function() { describe('With dateline h-card (h-news parsing test)', function() { - var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n \n (Geo: 37.774921;-122.445202) \n \n microformats.org\n \n

\n

\n Publishing policy\n

\n
\n" + var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n \n (Geo: 37.774921;-122.445202) \n \n microformats.org\n \n

\n

\n Publishing policy\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"content":["\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "],"summary":["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."],"updated":["2012-06-25T17:08:26"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"dateline":[{"value":"San Francisco, CA","type":["h-adr"],"properties":{"locality":["San Francisco"],"region":["CA"],"name":["San Francisco, CA"]}}],"geo":["37.774921;-122.445202"],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"principles":["http://microformats.org/wiki/Category:public_domain_license"],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek San Francisco, CA (Geo: 37.774921;-122.445202) microformats.org Publishing policy"]}}]} + var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"url":["http://microformats.org/2012/06/25/microformats-org-at-7"],"content":[{"value":"Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service","html":"\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "}],"summary":["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."],"updated":["2012-06-25T17:08:26"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"dateline":[{"value":"San Francisco, CA","type":["h-adr"],"properties":{"locality":["San Francisco"],"region":["CA"],"name":["San Francisco, CA"]}}],"geo":["37.774921;-122.445202"],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"principles":["http://microformats.org/wiki/Category:public_domain_license"],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek San Francisco, CA (Geo: 37.774921;-122.445202) microformats.org Publishing policy"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-news"); @@ -89,8 +89,8 @@ describe('With dateline h-card (h-news parsing test)', function() { assert.equal(found.items[0].properties["entry"][0].properties["url"][0].toString(), "http://microformats.org/2012/06/25/microformats-org-at-7"); }) - it("found.items[0].properties['entry'][0].properties['content'][0]", function(){ - assert.equal(found.items[0].properties["entry"][0].properties["content"][0].toString(), "\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "); + it("found.items[0].properties['entry'][0].properties['content'][0].value", function(){ + assert.equal(found.items[0].properties["entry"][0].properties["content"][0].value, "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service"); }) it("found.items[0].properties['entry'][0].properties['summary'][0]", function(){ diff --git a/mocha-tests/h-org-test.js b/mocha-tests/h-org-test.js index f34a946..f21af49 100644 --- a/mocha-tests/h-org-test.js +++ b/mocha-tests/h-org-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-org.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/h-product-test.js b/mocha-tests/h-product-test.js index 6e0a7c0..95ef58d 100644 --- a/mocha-tests/h-product-test.js +++ b/mocha-tests/h-product-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-product.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -49,7 +49,7 @@ describe('Just a hyperlink (h-product parsing test)', function() { describe('With h-review (h-product parsing test)', function() { var htmlFragment = "\n
\n

Raspberry Pi

\n \n

The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.

\n More info about the Raspberry Pi\n

£29.95

\n

4.5 out of 5

\n

Categories: Computer, Education

\n
\n\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"category":["Computer","Education"],"review":[{"value":"4.5 out of 5","type":["h-review"],"properties":{"rating":["4.5"],"name":["4.5 out of 5"]}}]}}]} + var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":[{"value":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.","html":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."}],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"category":["Computer","Education"],"review":[{"value":"4.5 out of 5","type":["h-review"],"properties":{"rating":["4.5"],"name":["4.5 out of 5"]}}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-product"); @@ -63,8 +63,8 @@ describe('With h-review (h-product parsing test)', function() { assert.equal(found.items[0].properties["photo"][0].toString(), "http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); }) it("found.items[0].properties['url'][0]", function(){ @@ -107,7 +107,7 @@ describe('With h-review (h-product parsing test)', function() { describe('With h-review-aggregate (h-product parsing test)', function() { var htmlFragment = "\n
\n

Raspberry Pi

\n \n

The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.

\n More info about the Raspberry Pi\n

£29.95

\n

\n \n 9.2 out of \n 10 \n based on 178 reviews\n \n

\n

Categories: Computer, Education

\n

From: \n The Raspberry Pi Foundation - \n Cambridge \n UK\n

\n
\n\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"review":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-review-aggregate"],"properties":{"rating":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-rating"],"properties":{"average":["9.2"],"best":["10"],"count":["178"],"name":["9.2 out of 10 based on 178 reviews"]}}],"name":["9.2 out of 10 based on 178 reviews"]}}],"category":["Computer","Education"],"brand":[{"value":"From: The Raspberry Pi Foundation - Cambridge UK","type":["h-card"],"properties":{"name":["The Raspberry Pi Foundation"],"org":["The Raspberry Pi Foundation"],"locality":["Cambridge"],"country-name":["UK"]}}]}}]} + var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":[{"value":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.","html":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."}],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"review":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-review-aggregate"],"properties":{"rating":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-rating"],"properties":{"average":["9.2"],"best":["10"],"count":["178"],"name":["9.2 out of 10 based on 178 reviews"]}}],"name":["9.2 out of 10 based on 178 reviews"]}}],"category":["Computer","Education"],"brand":[{"value":"From: The Raspberry Pi Foundation - Cambridge UK","type":["h-card"],"properties":{"name":["The Raspberry Pi Foundation"],"org":["The Raspberry Pi Foundation"],"locality":["Cambridge"],"country-name":["UK"]}}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-product"); @@ -121,8 +121,8 @@ describe('With h-review-aggregate (h-product parsing test)', function() { assert.equal(found.items[0].properties["photo"][0].toString(), "http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); }) it("found.items[0].properties['url'][0]", function(){ diff --git a/mocha-tests/h-recipe-test.js b/mocha-tests/h-recipe-test.js index 63e1a55..0f111c0 100644 --- a/mocha-tests/h-recipe-test.js +++ b/mocha-tests/h-recipe-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-recipe.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -9,7 +9,7 @@ var assert = chai.assert; describe('Minimum properties (h-recipe parsing test)', function() { var htmlFragment = "\n
\n

Toast

\n \n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-recipe"],"properties":{"name":["Toast"],"ingredient":["Slice of bread","Butter"]}}]} + var expected = {"items":[{"type":["h-recipe"],"properties":{"name":["Toast"],"ingredient":[{"value":"Slice of bread","html":"Slice of bread"},{"value":"Butter","html":"Butter"}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-recipe"); @@ -19,12 +19,12 @@ describe('Minimum properties (h-recipe parsing test)', function() { assert.equal(found.items[0].properties["name"][0].toString(), "Toast"); }) - it("found.items[0].properties['ingredient'][0]", function(){ - assert.equal(found.items[0].properties["ingredient"][0].toString(), "Slice of bread"); + it("found.items[0].properties['ingredient'][0].value", function(){ + assert.equal(found.items[0].properties["ingredient"][0].value, "Slice of bread"); }) - it("found.items[0].properties['ingredient'][1]", function(){ - assert.equal(found.items[0].properties["ingredient"][1].toString(), "Butter"); + it("found.items[0].properties['ingredient'][1].value", function(){ + assert.equal(found.items[0].properties["ingredient"][1].value, "Butter"); }) }) @@ -35,7 +35,7 @@ describe('Minimum properties (h-recipe parsing test)', function() { describe('Broken into properties (h-recipe parsing test)', function() { var htmlFragment = "\n
\n

Yorkshire Puddings

\n

Makes 6 good sized Yorkshire puddings, the way my mum taught me

\n\n\n

\n\n \n \n 4.5 stars out 5 based on \n 35 reviews\n \n \n\n
\n

Ingredients

\n \n
\n\n

Time

\n \n\n\n

Instructions

\n
\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n
\n\n

Nutrition

\n \n

(Amount per pudding)

\n\n

\n Published on by \n \n Glenn Jones\n \n

\n Photo by dithie\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-recipe"],"properties":{"name":["Yorkshire Puddings"],"summary":["Makes 6 good sized Yorkshire puddings, the way my mum taught me"],"yield":["6 good sized Yorkshire puddings"],"photo":["http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg"],"review":[{"value":"4.5 stars out 5 based on 35 reviews","type":["h-review-aggregate"],"properties":{"rating":["4.5 stars out 5 based on"],"average":["4.5"],"count":["35"],"name":["4.5 stars out 5 based on 35 reviews"]}}],"ingredient":["1 egg","75g plain flour","70ml milk","60ml water","Pinch of salt"],"instructions":["\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n "],"nutrition":["Calories: 125","Fat: 3.2g","Cholesterol: 77mg"],"published":["2011-10-27"],"author":[{"value":"Glenn Jones","type":["h-card"],"properties":{"name":["Glenn Jones"],"url":["http://glennjones.net"]}}]}}]} + var expected = {"items":[{"type":["h-recipe"],"properties":{"name":["Yorkshire Puddings"],"summary":["Makes 6 good sized Yorkshire puddings, the way my mum taught me"],"yield":["6 good sized Yorkshire puddings"],"photo":["http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg"],"review":[{"value":"4.5 stars out 5 based on 35 reviews","type":["h-review-aggregate"],"properties":{"rating":["4.5 stars out 5 based on"],"average":["4.5"],"count":["35"],"name":["4.5 stars out 5 based on 35 reviews"]}}],"ingredient":[{"value":"1 egg","html":"1 egg"},{"value":"75g plain flour","html":"75g plain flour"},{"value":"70ml milk","html":"70ml milk"},{"value":"60ml water","html":"60ml water"},{"value":"Pinch of salt","html":"Pinch of salt"}],"instructions":[{"value":"Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole Yorkshire pudding tins and place in the oven to heat through. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. Gradually add the milk and water while beating the mixture. It should be smooth and without lumps. Finally add a pinch of salt. Make sure the oil is piping hot before pouring the batter evenly into the tins. Place in the oven for 20-25 minutes until pudding have risen and look golden brown","html":"\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n "}],"nutrition":["Calories: 125","Fat: 3.2g","Cholesterol: 77mg"],"published":["2011-10-27"],"author":[{"value":"Glenn Jones","type":["h-card"],"properties":{"name":["Glenn Jones"],"url":["http://glennjones.net"]}}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-recipe"); @@ -81,28 +81,28 @@ describe('Broken into properties (h-recipe parsing test)', function() { assert.equal(found.items[0].properties["review"][0].properties["name"][0].toString(), "4.5 stars out 5 based on 35 reviews"); }) - it("found.items[0].properties['ingredient'][0]", function(){ - assert.equal(found.items[0].properties["ingredient"][0].toString(), "1 egg"); + it("found.items[0].properties['ingredient'][0].value", function(){ + assert.equal(found.items[0].properties["ingredient"][0].value, "1 egg"); }) - it("found.items[0].properties['ingredient'][1]", function(){ - assert.equal(found.items[0].properties["ingredient"][1].toString(), "75g plain flour"); + it("found.items[0].properties['ingredient'][1].value", function(){ + assert.equal(found.items[0].properties["ingredient"][1].value, "75g plain flour"); }) - it("found.items[0].properties['ingredient'][2]", function(){ - assert.equal(found.items[0].properties["ingredient"][2].toString(), "70ml milk"); + it("found.items[0].properties['ingredient'][2].value", function(){ + assert.equal(found.items[0].properties["ingredient"][2].value, "70ml milk"); }) - it("found.items[0].properties['ingredient'][3]", function(){ - assert.equal(found.items[0].properties["ingredient"][3].toString(), "60ml water"); + it("found.items[0].properties['ingredient'][3].value", function(){ + assert.equal(found.items[0].properties["ingredient"][3].value, "60ml water"); }) - it("found.items[0].properties['ingredient'][4]", function(){ - assert.equal(found.items[0].properties["ingredient"][4].toString(), "Pinch of salt"); + it("found.items[0].properties['ingredient'][4].value", function(){ + assert.equal(found.items[0].properties["ingredient"][4].value, "Pinch of salt"); }) - it("found.items[0].properties['instructions'][0]", function(){ - assert.equal(found.items[0].properties["instructions"][0].toString(), "\n
    \n
  1. Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.
  2. \n \n
  3. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.
  4. \n \n
  5. Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown
  6. \n
\n "); + it("found.items[0].properties['instructions'][0].value", function(){ + assert.equal(found.items[0].properties["instructions"][0].value, "Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole Yorkshire pudding tins and place in the oven to heat through. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. Gradually add the milk and water while beating the mixture. It should be smooth and without lumps. Finally add a pinch of salt. Make sure the oil is piping hot before pouring the batter evenly into the tins. Place in the oven for 20-25 minutes until pudding have risen and look golden brown"); }) it("found.items[0].properties['nutrition'][0]", function(){ diff --git a/mocha-tests/h-resume-test.js b/mocha-tests/h-resume-test.js index 6b1fdfb..0fbf263 100644 --- a/mocha-tests/h-resume-test.js +++ b/mocha-tests/h-resume-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-resume.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -91,7 +91,7 @@ describe('Contact (h-resume parsing test)', function() { describe('Work experience (h-resume parsing test)', function() { - var htmlFragment = "\n
\n

Tim Berners-Lee

\n
\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" + var htmlFragment = "\n
\n

Tim Berners-Lee

\n
\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-resume"],"properties":{"name":["Tim Berners-Lee"],"summary":["Invented the World Wide Web."],"contact":[{"value":"Director of the World Wide Web Foundation","type":["h-card"],"properties":{"name":["Director of the World Wide Web Foundation"],"title":["Director of the World Wide Web Foundation"]}}],"experience":[{"value":"Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)","type":["h-event","h-card"],"properties":{"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}}]}},{"type":["h-card"],"properties":{"name":["Director of the World Wide Web Foundation"],"title":["Director of the World Wide Web Foundation"]}},{"type":["h-event"],"properties":{"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}},{"type":["h-card"],"properties":{"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}}]} @@ -161,7 +161,7 @@ describe('Work experience (h-resume parsing test)', function() { describe('Educational experience (h-resume parsing test)', function() { - var htmlFragment = "\n
\n

Tim Berners-Lee

\n
\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n

\n The Queen's College, Oxford University, \n BA Hons (I) Physics \n –\n \n

\n
\n" + var htmlFragment = "\n
\n

Tim Berners-Lee

\n
\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n

\n The Queen's College, Oxford University, \n BA Hons (I) Physics \n –\n \n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-resume"],"properties":{"name":["Tim Berners-Lee"],"summary":["Invented the World Wide Web."],"contact":[{"value":"Director of the World Wide Web Foundation","type":["h-card"],"properties":{"name":["Director of the World Wide Web Foundation"],"title":["Director of the World Wide Web Foundation"]}}],"education":[{"value":"The Queen's College, Oxford University, BA Hons (I) Physics 1973 - 1976","type":["h-event","h-card"],"properties":{"name":["The Queen's College, Oxford University"],"org":["The Queen's College, Oxford University"],"description":["BA Hons (I) Physics"],"start":["1973-09"],"end":["1976-06"]}}]}},{"type":["h-card"],"properties":{"name":["Director of the World Wide Web Foundation"],"title":["Director of the World Wide Web Foundation"]}},{"type":["h-event"],"properties":{"name":["The Queen's College, Oxford University"],"org":["The Queen's College, Oxford University"],"description":["BA Hons (I) Physics"],"start":["1973-09"],"end":["1976-06"]}},{"type":["h-card"],"properties":{"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}}]} diff --git a/mocha-tests/h-review-aggregate-test.js b/mocha-tests/h-review-aggregate-test.js index 6d10386..1710175 100644 --- a/mocha-tests/h-review-aggregate-test.js +++ b/mocha-tests/h-review-aggregate-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-review-aggregate.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/h-review-test.js b/mocha-tests/h-review-test.js index f9809eb..8e4b18f 100644 --- a/mocha-tests/h-review-test.js +++ b/mocha-tests/h-review-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: h-review.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -47,7 +47,7 @@ describe('Just a hyperlink (h-review parsing test)', function() { describe('Just a photo (h-review parsing test)', function() { - var htmlFragment = "\n\"Crepes\n" + var htmlFragment = "\n\"Crepes\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-review"],"properties":{"name":["Crepes on Cole"],"photo":["http://example.com/images/photo.gif"]}}]} @@ -107,7 +107,7 @@ describe('With implied item name and url (h-review parsing test)', function() { describe('With item (h-review parsing test)', function() { - var htmlFragment = "\n
\n

\n \n Crepes on Cole\n

\n

5 out of 5 stars

\n
\n" + var htmlFragment = "\n
\n

\n \n Crepes on Cole\n

\n

5 out of 5 stars

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-review"],"properties":{"item":[{"value":"Crepes on Cole","type":["h-item"],"properties":{"photo":["http://example.com/images/photo.gif"],"name":["Crepes on Cole"],"url":["http://example.com/crepeoncole"]}}],"rating":["5"]}}]} @@ -147,7 +147,7 @@ describe('With item (h-review parsing test)', function() { describe('With vcard item (h-review parsing test)', function() { var htmlFragment = "\n
\n 5 out of 5 stars\n

Crepes on Cole is awesome

\n \n Reviewer: Tantek - \n \n \n
\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n
\n

Visit date: April 2005

\n

Food eaten: crepe

\n

Permanent link for review: http://example.com/crepe

\n

Creative Commons Attribution-ShareAlike License

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-review"],"properties":{"rating":["5"],"name":["Crepes on Cole is awesome"],"reviewer":[{"value":"Reviewer: Tantek -","type":["h-card"],"properties":{"name":["Tantek"]}}],"description":["\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "],"item":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","type":["h-card"],"properties":{"name":["Crepes on Cole"],"org":["Crepes on Cole"],"adr":[{"value":"San Francisco","type":["h-adr"],"properties":{"locality":["San Francisco"],"name":["San Francisco"]}}]}}],"category":["crepe"],"url":["http://example.com/crepe"]}}]} + var expected = {"items":[{"type":["h-review"],"properties":{"rating":["5"],"name":["Crepes on Cole is awesome"],"reviewer":[{"value":"Reviewer: Tantek -","type":["h-card"],"properties":{"name":["Tantek"]}}],"description":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","html":"\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "}],"item":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","type":["h-card"],"properties":{"name":["Crepes on Cole"],"org":["Crepes on Cole"],"adr":[{"value":"San Francisco","type":["h-adr"],"properties":{"locality":["San Francisco"],"name":["San Francisco"]}}]}}],"category":["crepe"],"url":["http://example.com/crepe"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-review"); @@ -173,8 +173,8 @@ describe('With vcard item (h-review parsing test)', function() { assert.equal(found.items[0].properties["reviewer"][0].properties["name"][0].toString(), "Tantek"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi."); }) it("found.items[0].properties['item'][0].value", function(){ diff --git a/mocha-tests/hcalendar-test.js b/mocha-tests/hcalendar-test.js index 35d0457..465d7c7 100644 --- a/mocha-tests/hcalendar-test.js +++ b/mocha-tests/hcalendar-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hcalendar.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/hcard-test.js b/mocha-tests/hcard-test.js index 2f51014..2e178ec 100644 --- a/mocha-tests/hcard-test.js +++ b/mocha-tests/hcard-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hcard.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -73,7 +73,7 @@ describe('A hyperlinked photo (hcard parsing test)', function() { describe('Name properties (hcard parsing test)', function() { - var htmlFragment = "\n
\n
\n Dr \n John \n P \n Doe \n \n \"PHD\"\n
\n
\n" + var htmlFragment = "\n
\n
\n Dr \n John \n P \n Doe \n \n \"PHD\"\n
\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"honorific-prefix":["Dr"],"given-name":["John"],"additional-name":["Peter"],"family-name":["Doe"],"honorific-suffix":["MSc","PHD"],"name":["Dr John P Doe"]}}]} @@ -233,7 +233,7 @@ describe('Single occurrence properties (hcard parsing test)', function() { describe('Multiple occurrence properties (hcard parsing test)', function() { - var htmlFragment = "\n
\n \n
John Doe
\n Pronunciation of my name\n
\"Photo
\n\n

Nicknames:

\n \n\n

About:

\n

John Doe is one of those names you always have issues with.

\n

It can be a real problem booking a hotel room with the name John Doe.

\n\n

Companies:

\n
\n \"Madgex\n \"Web\n
\n \n \n

Tags: \n design, \n development and\n web\n

\n \n

Phone numbers:

\n \n \n

Emails:

\n \n

John Doe uses PigeonMail 2.1 or Outlook 2007 for email.

\n\n

Addresses:

\n \n \n

In emergency contact: Jane Doe or Dave Doe.

\n

Key: hd02$Gfu*d%dh87KTa2=23934532479

\n
\n" + var htmlFragment = "\n
\n \n
John Doe
\n Pronunciation of my name\n
\"Photo
\n\n

Nicknames:

\n \n\n

About:

\n

John Doe is one of those names you always have issues with.

\n

It can be a real problem booking a hotel room with the name John Doe.

\n\n

Companies:

\n
\n \"Madgex\n \"Web\n
\n \n \n

Tags: \n design, \n development and\n web\n

\n \n

Phone numbers:

\n \n \n

Emails:

\n \n

John Doe uses PigeonMail 2.1 or Outlook 2007 for email.

\n\n

Addresses:

\n \n \n

In emergency contact: Jane Doe or Dave Doe.

\n

Key: hd02$Gfu*d%dh87KTa2=23934532479

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"name":["John Doe"],"given-name":["John"],"family-name":["Doe"],"sound":["http://www.madgex.com/johndoe.mpeg"],"photo":["http://example.com/images/photo.gif"],"nickname":["Man with no name","Lost boy"],"note":["John Doe is one of those names you always have issues with.","It can be a real problem booking a hotel room with the name John Doe."],"url":["http://www.madgex.com/","http://www.webfeetmedia.com/"],"org":["Madgex","Web Feet Media Ltd"],"title":["Creative Director","Owner"],"category":["design","development","web"],"tel":["+1 415 555 100","+1 415 555 200","+1 415 555 300"],"email":["mailto:john.doe@madgex.com","mailto:john.doe@webfeetmedia.com"],"mailer":["PigeonMail 2.1","Outlook 2007"],"adr":[{"value":"Work: North Street, Brighton, United Kingdom","type":["h-adr"],"properties":{"street-address":["North Street"],"locality":["Brighton"],"country-name":["United Kingdom"]}},{"value":"Home: West Street, Brighton, United Kingdom","type":["h-adr"],"properties":{"street-address":["West Street"],"locality":["Brighton"],"country-name":["United Kingdom"]}}],"label":["Work: North Street, Brighton, United Kingdom","Home: West Street, Brighton, United Kingdom"],"agent":["Jane Doe",{"value":"Dave Doe","type":["h-card"],"properties":{"name":["Dave Doe"]}}],"key":["hd02$Gfu*d%dh87KTa2=23934532479"]}}]} diff --git a/mocha-tests/hentry-test.js b/mocha-tests/hentry-test.js index 94d9805..7df981a 100644 --- a/mocha-tests/hentry-test.js +++ b/mocha-tests/hentry-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hentry.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -51,9 +51,9 @@ describe('Just a hyperlink (hentry parsing test)', function() { describe('Entry with summary and content (hentry parsing test)', function() { - var htmlFragment = "\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n" + var htmlFragment = "\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-entry"],"properties":{"name":["microformats.org at 7"],"content":["\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "],"summary":["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."],"updated":["2012-06-25T17:08:26"],"author":[{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]}},{"type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]} + var expected = {"items":[{"type":["h-entry"],"properties":{"name":["microformats.org at 7"],"content":[{"value":"Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service","html":"\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "}],"summary":["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."],"updated":["2012-06-25T17:08:26"],"author":[{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]}},{"type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-entry"); @@ -63,8 +63,8 @@ describe('Entry with summary and content (hentry parsing test)', function() { assert.equal(found.items[0].properties["name"][0].toString(), "microformats.org at 7"); }) - it("found.items[0].properties['content'][0]", function(){ - assert.equal(found.items[0].properties["content"][0].toString(), "\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n "); + it("found.items[0].properties['content'][0].value", function(){ + assert.equal(found.items[0].properties["content"][0].value, "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service"); }) it("found.items[0].properties['summary'][0]", function(){ diff --git a/mocha-tests/hnews-test.js b/mocha-tests/hnews-test.js index b7b0307..fe7c4d0 100644 --- a/mocha-tests/hnews-test.js +++ b/mocha-tests/hnews-test.js @@ -1,13 +1,13 @@ /* Mocha integration test from: hnews.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; describe('Minimum properties (hnews parsing test)', function() { - var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n microformats.org \n

\n
\n" + var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n microformats.org \n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek microformats.org"]}},{"type":["rel"],"properties":{"bookmark":["http://microformats.org/2012/06/25/microformats-org-at-7"]}}]} @@ -53,7 +53,7 @@ describe('Minimum properties (hnews parsing test)', function() { describe('With dateline vcard (hnews parsing test)', function() { - var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n \n \n San Francisco, \n CA \n \n \n (Geo: 37.774921;-122.445202) \n \n microformats.org\n \n

\n

\n Publishing policy\n

\n
\n" + var htmlFragment = "\n
\n
\n

microformats.org at 7

\n
\n

Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.

\n\n

The microformats tagline “humans first, machines second” \n forms the basis of many of our \n principles, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service

\n
\n

Updated \n by\n Tantek\n

\n
\n\n

\n \n \n San Francisco, \n CA \n \n \n (Geo: 37.774921;-122.445202) \n \n microformats.org\n \n

\n

\n Publishing policy\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-news"],"properties":{"entry":[{"value":"microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek","type":["h-entry"],"properties":{"name":["microformats.org at 7"],"summary":["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."],"updated":["2012-06-25T17:08:26"],"author":{"value":"Tantek","type":["h-card"],"properties":{"name":["Tantek"],"url":["http://tantek.com/"]}}}}],"dateline":[{"value":"San Francisco, CA","type":["h-card"],"properties":{"adr":[{"value":"San Francisco, CA","type":["h-adr"],"properties":{"locality":["San Francisco"],"region":["CA"],"name":["San Francisco, CA"]}}],"name":["San Francisco, CA"]}}],"geo":[{"value":"37.774921;-122.445202","type":["h-geo"],"properties":{"name":["37.774921;-122.445202"]}}],"source-org":[{"value":"microformats.org","type":["h-card"],"properties":{"name":["microformats.org"],"url":["http://microformats.org/"]}}],"name":["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek San Francisco, CA (Geo: 37.774921;-122.445202) microformats.org Publishing policy"]}},{"type":["rel"],"properties":{"bookmark":["http://microformats.org/2012/06/25/microformats-org-at-7"],"principles":["http://microformats.org/wiki/Category:public_domain_license"]}}]} diff --git a/mocha-tests/hproduct-test.js b/mocha-tests/hproduct-test.js index 68469eb..94bb409 100644 --- a/mocha-tests/hproduct-test.js +++ b/mocha-tests/hproduct-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hproduct.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -49,7 +49,7 @@ describe('Just a hyperlink (hproduct parsing test)', function() { describe('With h-review (hproduct parsing test)', function() { var htmlFragment = "\n
\n

Raspberry Pi

\n \n

The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.

\n More info about the Raspberry Pi\n

£29.95

\n

4.5 out of 5

\n

Categories: \n Computer, \n Education\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"category":["Computer","Education"],"review":[{"value":"4.5 out of 5","type":["h-review"],"properties":{"rating":["4.5"],"name":["4.5 out of 5"]}}]}}]} + var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":[{"value":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.","html":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."}],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"category":["Computer","Education"],"review":[{"value":"4.5 out of 5","type":["h-review"],"properties":{"rating":["4.5"],"name":["4.5 out of 5"]}}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-product"); @@ -63,8 +63,8 @@ describe('With h-review (hproduct parsing test)', function() { assert.equal(found.items[0].properties["photo"][0].toString(), "http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); }) it("found.items[0].properties['url'][0]", function(){ @@ -107,7 +107,7 @@ describe('With h-review (hproduct parsing test)', function() { describe('With h-review-aggregate (hproduct parsing test)', function() { var htmlFragment = "\n
\n

Raspberry Pi

\n \n

The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.

\n More info about the Raspberry Pi\n

£29.95

\n

\n \n 9.2 out of \n 10 \n based on 178 reviews\n \n

\n

Categories: \n Computer, \n Education\n

\n

From: \n The Raspberry Pi Foundation - \n \n Cambridge \n UK\n \n

\n
\n\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":["The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"review":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-review-aggregate"],"properties":{"rating":["9.2"],"average":["9.2"],"best":["10"],"count":["178"]}}],"category":["Computer","Education"],"brand":[{"value":"From: The Raspberry Pi Foundation - Cambridge UK","type":["h-card"],"properties":{"name":["The Raspberry Pi Foundation"],"org":["The Raspberry Pi Foundation"],"adr":[{"value":"Cambridge UK","type":["h-adr"],"properties":{"locality":["Cambridge"],"country-name":["UK"],"name":["Cambridge UK"]}}]}}]}}]} + var expected = {"items":[{"type":["h-product"],"properties":{"name":["Raspberry Pi"],"photo":["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"],"description":[{"value":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.","html":"The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."}],"url":["http://www.raspberrypi.org/"],"price":["£29.95"],"review":[{"value":"9.2 out of 10 based on 178 reviews","type":["h-review-aggregate"],"properties":{"rating":["9.2"],"average":["9.2"],"best":["10"],"count":["178"]}}],"category":["Computer","Education"],"brand":[{"value":"From: The Raspberry Pi Foundation - Cambridge UK","type":["h-card"],"properties":{"name":["The Raspberry Pi Foundation"],"org":["The Raspberry Pi Foundation"],"adr":[{"value":"Cambridge UK","type":["h-adr"],"properties":{"locality":["Cambridge"],"country-name":["UK"],"name":["Cambridge UK"]}}]}}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-product"); @@ -121,8 +121,8 @@ describe('With h-review-aggregate (hproduct parsing test)', function() { assert.equal(found.items[0].properties["photo"][0].toString(), "http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming."); }) it("found.items[0].properties['url'][0]", function(){ diff --git a/mocha-tests/hresume-test.js b/mocha-tests/hresume-test.js index b9f6933..c433f64 100644 --- a/mocha-tests/hresume-test.js +++ b/mocha-tests/hresume-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hresume.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -103,7 +103,7 @@ describe('Contact (h-resume parsing test)', function() { describe('Work experience (h-resume parsing test)', function() { - var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" + var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-resume"],"properties":{"contact":[{"value":"Tim Berners-Lee Director of the World Wide Web Foundation","type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}}],"summary":["Invented the World Wide Web."],"experience":[{"value":"Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)","type":["h-event","h-card"],"properties":{"title":["Director"],"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}}]}},{"type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}},{"type":["h-event"],"properties":{"name":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}},{"type":["h-card"],"properties":{"title":["Director"],"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"]}}]} @@ -173,7 +173,7 @@ describe('Work experience (h-resume parsing test)', function() { describe('Educational experience (h-resume parsing test)', function() { - var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n

\n The Queen's College, Oxford University, \n BA Hons (I) Physics \n –\n \n

\n
\n" + var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n

\n The Queen's College, Oxford University, \n BA Hons (I) Physics \n –\n \n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-resume"],"properties":{"contact":[{"value":"Tim Berners-Lee Director of the World Wide Web Foundation","type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}}],"summary":["Invented the World Wide Web."],"education":[{"value":"The Queen's College, Oxford University, BA Hons (I) Physics 1973 - 1976","type":["h-event","h-card"],"properties":{"name":["The Queen's College, Oxford University"],"org":["The Queen's College, Oxford University"],"description":["BA Hons (I) Physics"],"start":["1973-09"],"end":["1976-06"]}}]}},{"type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}},{"type":["h-event"],"properties":{"name":["The Queen's College, Oxford University"],"description":["BA Hons (I) Physics"],"start":["1973-09"],"end":["1976-06"]}},{"type":["h-card"],"properties":{"name":["The Queen's College, Oxford University"],"org":["The Queen's College, Oxford University"],"description":["BA Hons (I) Physics"]}}]} diff --git a/mocha-tests/hreview-aggregate-test.js b/mocha-tests/hreview-aggregate-test.js index d553f5f..0898d5f 100644 --- a/mocha-tests/hreview-aggregate-test.js +++ b/mocha-tests/hreview-aggregate-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hreview-aggregate.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; diff --git a/mocha-tests/hreview-test.js b/mocha-tests/hreview-test.js index 2fffb1d..f5c7f6d 100644 --- a/mocha-tests/hreview-test.js +++ b/mocha-tests/hreview-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: hreview.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -47,7 +47,7 @@ describe('Just a hyperlink (hreview parsing test)', function() { describe('Just a photo (hreview parsing test)', function() { - var htmlFragment = "\n\"Crepes\n" + var htmlFragment = "\n\"Crepes\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-review"],"properties":{"name":["Crepes on Cole"],"photo":["http://example.com/images/photo.gif"]}}]} @@ -107,7 +107,7 @@ describe('With implied item name and url (hreview parsing test)', function() { describe('With item (hreview parsing test)', function() { - var htmlFragment = "\n
\n

\n \n Crepes on Cole\n

\n

5 out of 5 stars

\n
\n" + var htmlFragment = "\n
\n

\n \n Crepes on Cole\n

\n

5 out of 5 stars

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-review"],"properties":{"item":[{"value":"Crepes on Cole","type":["h-item"],"properties":{"photo":["http://example.com/images/photo.gif"],"name":["Crepes on Cole"],"url":["http://example.com/crepeoncole"]}}],"rating":["5"]}}]} @@ -147,7 +147,7 @@ describe('With item (hreview parsing test)', function() { describe('With vcard item (hreview parsing test)', function() { var htmlFragment = "\n
\n 5 out of 5 stars\n

Crepes on Cole is awesome

\n \n Reviewer: Tantek - \n \n \n
\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n
\n

Visit date: April 2005

\n

Food eaten: crepe

\n

Permanent link for review: http://example.com/crepe

\n

Creative Commons Attribution-ShareAlike License

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-review"],"properties":{"rating":["5"],"name":["Crepes on Cole is awesome"],"reviewer":[{"value":"Reviewer: Tantek -","type":["h-card"],"properties":{"name":["Tantek"]}}],"description":["\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "],"item":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","type":["h-item","h-card"],"properties":{"name":["Crepes on Cole"],"org":["Crepes on Cole"],"adr":[{"value":"San Francisco","type":["h-adr"],"properties":{"locality":["San Francisco"],"name":["San Francisco"]}}]}}],"category":["crepe"],"url":["http://example.com/crepe"]}}]} + var expected = {"items":[{"type":["h-review"],"properties":{"rating":["5"],"name":["Crepes on Cole is awesome"],"reviewer":[{"value":"Reviewer: Tantek -","type":["h-card"],"properties":{"name":["Tantek"]}}],"description":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","html":"\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "}],"item":[{"value":"Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.","type":["h-item","h-card"],"properties":{"name":["Crepes on Cole"],"org":["Crepes on Cole"],"adr":[{"value":"San Francisco","type":["h-adr"],"properties":{"locality":["San Francisco"],"name":["San Francisco"]}}]}}],"category":["crepe"],"url":["http://example.com/crepe"]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-review"); @@ -173,8 +173,8 @@ describe('With vcard item (hreview parsing test)', function() { assert.equal(found.items[0].properties["reviewer"][0].properties["name"][0].toString(), "Tantek"); }) - it("found.items[0].properties['description'][0]", function(){ - assert.equal(found.items[0].properties["description"][0].toString(), "\n

\n Crepes on Cole is one of the best little \n creperies in San Francisco.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n

\n "); + it("found.items[0].properties['description'][0].value", function(){ + assert.equal(found.items[0].properties["description"][0].value, "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi."); }) it("found.items[0].properties['item'][0].value", function(){ diff --git a/mocha-tests/includes-test.js b/mocha-tests/includes-test.js index d11d5be..4bee47a 100644 --- a/mocha-tests/includes-test.js +++ b/mocha-tests/includes-test.js @@ -1,13 +1,13 @@ /* Mocha integration test from: includes.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; describe('itemref include pattern - h-card (h-card parsing test)', function() { - var htmlFragment = "\n
\n Brendan Eich\n

Mozilla

\n 665 3rd St. \n Suite 207 \n San Francisco, \n CA \n 94107 \n U.S.A. \n

\n
\n Mitchell Baker\n

Mozilla

\n 665 3rd St. \n Suite 207 \n San Francisco, \n CA \n 94107 \n U.S.A. \n

\n\n

Mozilla

\n

\n 665 3rd St. \n Suite 207 \n San Francisco, \n CA \n 94107 \n U.S.A. \n

\n" + var htmlFragment = "\n
\n Brendan Eich\n
\n
\n Mitchell Baker\n
\n\n

Mozilla

\n

\n 665 3rd St. \n Suite 207 \n San Francisco, \n CA \n 94107 \n U.S.A. \n

\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"name":["Brendan Eich"],"org":["Mozilla"],"adr":[{"value":"665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.","type":["h-adr"],"properties":{"street-address":["665 3rd St."],"extended-address":["Suite 207"],"locality":["San Francisco"],"region":["CA"],"postal-code":["94107"],"country-name":["U.S.A."],"name":["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]}}]}},{"type":["h-card"],"properties":{"name":["Mitchell Baker"],"org":["Mozilla"],"adr":[{"value":"665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.","type":["h-adr"],"properties":{"street-address":["665 3rd St."],"extended-address":["Suite 207"],"locality":["San Francisco"],"region":["CA"],"postal-code":["94107"],"country-name":["U.S.A."],"name":["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."]}}]}}]} @@ -65,7 +65,7 @@ describe('itemref include pattern - h-card (h-card parsing test)', function() { describe('itemref include pattern - h-event (h-card parsing test)', function() { - var htmlFragment = "\n
\n Monetizing Android Apps - spaekers: \n Chrix Finne, \n Kenneth Lui - \n \n Room 10\n

\n Moscone Center, \n San Francisco \n

\n

\n Session 01 is between: \n to \n \n

\n
\n New Low-Level Media APIs in Android - spaekers: \n Dave Burke -\n \n Room 11\n

\n Moscone Center, \n San Francisco \n

\n

\n Session 01 is between: \n to \n \n

\n\n

\n Session 01 is between: \n to \n \n

\n

\n Moscone Center, \n San Francisco \n

\n" + var htmlFragment = "\n
\n Monetizing Android Apps - spaekers: \n Chrix Finne, \n Kenneth Lui - \n \n Room 10\n \n
\n
\n New Low-Level Media APIs in Android - spaekers: \n Dave Burke -\n \n Room 11\n \n
\n\n

\n Session 01 is between: \n to \n \n

\n

\n Moscone Center, \n San Francisco \n

\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-event"],"properties":{"name":["Monetizing Android Apps"],"speaker":["Chrix Finne","Kenneth Lui"],"location":[{"value":"Room 10 Moscone Center, San Francisco","type":["h-adr"],"properties":{"extended-address":["Room 10","Moscone Center"],"locality":["San Francisco"],"name":["Room 10 Moscone Center, San Francisco"]}}],"start":["2012-06-27T15:45:00-0800"],"end":["2012-06-27T16:45:00-0800"]}},{"type":["h-event"],"properties":{"name":["New Low-Level Media APIs in Android"],"speaker":["Dave Burke"],"location":[{"value":"Room 11 Moscone Center, San Francisco","type":["h-adr"],"properties":{"extended-address":["Room 11","Moscone Center"],"locality":["San Francisco"],"name":["Room 11 Moscone Center, San Francisco"]}}],"start":["2012-06-27T15:45:00-0800"],"end":["2012-06-27T16:45:00-0800"]}},{"type":["h-adr"],"properties":{"extended-address":["Room 10","Moscone Center"],"locality":["San Francisco"],"name":["Room 10 Moscone Center, San Francisco"]}},{"type":["h-adr"],"properties":{"extended-address":["Room 11","Moscone Center"],"locality":["San Francisco"],"name":["Room 11 Moscone Center, San Francisco"]}}]} @@ -123,7 +123,7 @@ describe('itemref include pattern - h-event (h-card parsing test)', function() { describe('Table header include pattern (h-card parsing test)', function() { - var htmlFragment = "\n\n \n \n \n \n \n \n \n \n \n
Opera
Chris MillsOpera
Erik MöllerOpera
\n" + var htmlFragment = "\n\n \n \n \n \n \n \n \n \n \n
Opera
Chris Mills
Erik Möller
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"name":["Chris Mills"],"url":["http://dev.opera.com/"],"org":["Opera"]}},{"type":["h-card"],"properties":{"name":["Erik Möller"],"url":["http://dev.opera.com/"],"org":["Opera"]}}]} @@ -149,7 +149,7 @@ describe('Table header include pattern (h-card parsing test)', function() { describe('Hyperlink header include pattern (h-card parsing test)', function() { - var htmlFragment = "\n
\n Ben Ward\n Twitter
\n

Twitter

\n

\n 1355 Market St,\n San Francisco, \n CA\n 94103\n

\n
\n
\n
\n Dan Webb\n Twitter
\n

Twitter

\n

\n 1355 Market St,\n San Francisco, \n CA\n 94103\n

\n
\n
\n\n
\n

Twitter

\n

\n 1355 Market St,\n San Francisco, \n CA\n 94103\n

\n
\n" + var htmlFragment = "\n
\n Ben Ward\n Twitter\n
\n
\n Dan Webb\n Twitter\n
\n\n
\n

Twitter

\n

\n 1355 Market St,\n San Francisco, \n CA\n 94103\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-card"],"properties":{"name":["Ben Ward"],"org":["Twitter"],"adr":[{"value":"1355 Market St, San Francisco, CA 94103","type":["h-adr"],"properties":{"street-address":["1355 Market St"],"locality":["San Francisco"],"region":["CA"],"postal-code":["94103"],"name":["1355 Market St, San Francisco, CA 94103"]}}]}},{"type":["h-card"],"properties":{"name":["Dan Webb"],"org":["Twitter"],"adr":[{"value":"1355 Market St, San Francisco, CA 94103","type":["h-adr"],"properties":{"street-address":["1355 Market St"],"locality":["San Francisco"],"region":["CA"],"postal-code":["94103"],"name":["1355 Market St, San Francisco, CA 94103"]}}]}}]} @@ -199,7 +199,7 @@ describe('Hyperlink header include pattern (h-card parsing test)', function() { describe('Object include pattern (h-card parsing test)', function() { - var htmlFragment = "\n
\n HTML5 & CSS3 latest features in action! - \n David Rousset -\n \n
\n

Build Conference

\n

\n Redmond, \n Washington, \n USA\n

\n
\n
\n
\n Building High-Performing JavaScript for Modern Engines -\n John-David Dalton and \n Amanda Silver -\n \n
\n

Build Conference

\n

\n Redmond, \n Washington, \n USA\n

\n
\n
\n\n\n
\n

Build Conference

\n

\n Redmond, \n Washington, \n USA\n

\n
\n" + var htmlFragment = "\n
\n HTML5 & CSS3 latest features in action! - \n David Rousset -\n \n \n
\n
\n Building High-Performing JavaScript for Modern Engines -\n John-David Dalton and \n Amanda Silver -\n \n \n
\n\n\n
\n

Build Conference

\n

\n Redmond, \n Washington, \n USA\n

\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-event"],"properties":{"name":["HTML5 & CSS3 latest features in action!"],"speaker":["David Rousset"],"summary":["Build Conference"],"start":["2012-10-30T11:45:00-0800"],"location":[{"value":"Redmond, Washington, USA","type":["h-adr"],"properties":{"locality":["Redmond"],"region":["Washington"],"country-name":["USA"],"name":["Redmond, Washington, USA"]}}]}},{"type":["h-event"],"properties":{"name":["Building High-Performing JavaScript for Modern Engines"],"speaker":["John-David Dalton","Amanda Silver"],"summary":["Build Conference"],"start":["2012-10-31T11:15:00-0800"],"location":[{"value":"Redmond, Washington, USA","type":["h-adr"],"properties":{"locality":["Redmond"],"region":["Washington"],"country-name":["USA"],"name":["Redmond, Washington, USA"]}}]}}]} diff --git a/mocha-tests/mixed-versions-test.js b/mocha-tests/mixed-versions-test.js index 5b7f2b2..1e92273 100644 --- a/mocha-tests/mixed-versions-test.js +++ b/mocha-tests/mixed-versions-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: mixed-versions.html -The test was built on Thu Sep 19 2013 13:39:02 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -87,7 +87,7 @@ describe('Mixed propertries form different versions (h-card parsing test)', func describe('Mixed roots form different versions (h-resume parsing test)', function() { - var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" + var htmlFragment = "\n
\n
\n

Tim Berners-Lee

\n

Director of the World Wide Web Foundation

\n
\n

Invented the World Wide Web.


\n
\n

Director

\n

World Wide Web Foundation

\n

\n – Present\n \n

\n
\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[{"type":["h-resume"],"properties":{"contact":[{"value":"Tim Berners-Lee Director of the World Wide Web Foundation","type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}}],"summary":["Invented the World Wide Web."],"experience":[{"value":"Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)","type":["h-event","h-card"],"properties":{"org":["World Wide Web Foundation"],"name":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"],"title":["Director"]}}]}},{"type":["h-card"],"properties":{"name":["Tim Berners-Lee"],"title":["Director of the World Wide Web Foundation"]}},{"type":["h-event"],"properties":{"org":["World Wide Web Foundation"],"name":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"],"start":["2009-01-18"],"duration":["P2Y11M"]}},{"type":["h-card"],"properties":{"title":["Director"],"name":["World Wide Web Foundation"],"org":["World Wide Web Foundation"],"url":["http://www.webfoundation.org/"]}}]} diff --git a/mocha-tests/rel-test.js b/mocha-tests/rel-test.js index 50ffb02..9aeddf4 100644 --- a/mocha-tests/rel-test.js +++ b/mocha-tests/rel-test.js @@ -1,6 +1,6 @@ /* Mocha integration test from: rel.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; @@ -47,7 +47,7 @@ describe('A xfn all properties (xfn parsing test)', function() { describe('A rel=alternate (rel=alternate parsing test)', function() { - var htmlFragment = "\n\n" + var htmlFragment = "\n\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') var expected = {"items":[],"alternates":[{"url":"http://tantek.com/updates.atom","type":"application/atom+xml","rel":"updates"}]} diff --git a/mocha-tests/url-test.js b/mocha-tests/url-test.js index 53dd10b..92e0ce3 100644 --- a/mocha-tests/url-test.js +++ b/mocha-tests/url-test.js @@ -1,15 +1,15 @@ /* Mocha integration test from: url.html -The test was built on Thu Sep 19 2013 13:39:01 GMT+0100 (BST) +The test was built on Thu Sep 19 2013 15:25:23 GMT+0100 (BST) */ var assert = chai.assert; describe('Expanding URLs in e-* properties (h-entry parsing test)', function() { - var htmlFragment = "\n
\n

Expanding URLs within HTML content

\n
\n \n \n
\n
\n" + var htmlFragment = "\n
\n

Expanding URLs within HTML content

\n
\n \n \n
\n
\n" var found = helper.parseHTML(htmlFragment,'http://example.com/') - var expected = {"items":[{"type":["h-entry"],"properties":{"name":["Expanding URLs within HTML content"],"content":["\n \n \n "]}}]} + var expected = {"items":[{"type":["h-entry"],"properties":{"name":["Expanding URLs within HTML content"],"content":[{"value":"Should not change: http://www.w3.org/ Should not change: http://example.com/ File relative: test.html = http://example.com/test.html Directory relative: /test/test.html = http://example.com/test/test.html Relative to root: /test.html = http://example.com/test.html","html":"\n \n \n "}]}}]} it("found.items[0].type[0]", function(){ assert.equal(found.items[0].type[0].toString(), "h-entry"); @@ -19,8 +19,8 @@ describe('Expanding URLs in e-* properties (h-entry parsing test)', function() { assert.equal(found.items[0].properties["name"][0].toString(), "Expanding URLs within HTML content"); }) - it("found.items[0].properties['content'][0]", function(){ - assert.equal(found.items[0].properties["content"][0].toString(), "\n \n \n "); + it("found.items[0].properties['content'][0].value", function(){ + assert.equal(found.items[0].properties["content"][0].value, "Should not change: http://www.w3.org/ Should not change: http://example.com/ File relative: test.html = http://example.com/test.html Directory relative: /test/test.html = http://example.com/test/test.html Relative to root: /test.html = http://example.com/test.html"); }) }) diff --git a/testWriter.js b/testWriter.js index 17b3083..a2433fd 100644 --- a/testWriter.js +++ b/testWriter.js @@ -6,32 +6,32 @@ Parser = require('microformat-node').Parser, parser = new Parser(); - urls = ['http://localhost:8888/test/h-adr.html', - 'http://localhost:8888/test/h-card.html', - 'http://localhost:8888/test/h-event.html', - 'http://localhost:8888/test/h-entry.html', - 'http://localhost:8888/test/h-geo.html', - 'http://localhost:8888/test/h-news.html', - 'http://localhost:8888/test/h-org.html', - 'http://localhost:8888/test/h-product.html', - 'http://localhost:8888/test/h-recipe.html', - 'http://localhost:8888/test/h-resume.html', - 'http://localhost:8888/test/h-review-aggregate.html', - 'http://localhost:8888/test/h-review.html', - 'http://localhost:8888/test/rel.html', - 'http://localhost:8888/test/includes.html', - - 'http://localhost:8888/test/adr.html', - 'http://localhost:8888/test/geo.html', - 'http://localhost:8888/test/hcalendar.html', - 'http://localhost:8888/test/hcard.html', - 'http://localhost:8888/test/hnews.html', - 'http://localhost:8888/test/hproduct.html', - 'http://localhost:8888/test/hentry.html', - 'http://localhost:8888/test/hresume.html', - 'http://localhost:8888/test/hreview-aggregate.html', - 'http://localhost:8888/test/hreview.html', - 'http://localhost:8888/test/mixed-versions.html'] + urls = ['http://localhost:8889/test/h-adr.html', + 'http://localhost:8889/test/h-card.html', + 'http://localhost:8889/test/h-event.html', + 'http://localhost:8889/test/h-entry.html', + 'http://localhost:8889/test/h-geo.html', + 'http://localhost:8889/test/h-news.html', + 'http://localhost:8889/test/h-org.html', + 'http://localhost:8889/test/h-product.html', + 'http://localhost:8889/test/h-recipe.html', + 'http://localhost:8889/test/h-resume.html', + 'http://localhost:8889/test/h-review-aggregate.html', + 'http://localhost:8889/test/h-review.html', + 'http://localhost:8889/test/rel.html', + 'http://localhost:8889/test/includes.html', + + 'http://localhost:8889/test/adr.html', + 'http://localhost:8889/test/geo.html', + 'http://localhost:8889/test/hcalendar.html', + 'http://localhost:8889/test/hcard.html', + 'http://localhost:8889/test/hnews.html', + 'http://localhost:8889/test/hproduct.html', + 'http://localhost:8889/test/hentry.html', + 'http://localhost:8889/test/hresume.html', + 'http://localhost:8889/test/hreview-aggregate.html', + 'http://localhost:8889/test/hreview.html', + 'http://localhost:8889/test/mixed-versions.html'] function updateTests(){ @@ -158,47 +158,19 @@ console.log('writing test: ' + p.name) if(p['x-output'] && p['x-microformat']){ - var json = p['x-output'][0]; - var html = p['x-microformat'][0]; - console.log(json) - var expected = JSON.parse( json ); + var json = p['x-output'][0].html; + var html = p['x-microformat'][0].html; + + + // need to decode html from pre/code block + var expected = JSON.parse( json.replace(/</g,"<").replace(/>/g,">") ); + var out = "describe('" + p.name + "', function() {\r\n" out += " var htmlFragment = " + JSON.stringify(html) + "\r\n"; out += " var found = helper.parseHTML(htmlFragment,'http://example.com/')\r\n"; out += " var expected = " + JSON.stringify(expected) + "\r\n\r\n" - - /* if(expected.items[0]){ - - if(expected.items[0].value){ - out += getAssertsStr(expected.items[0].value, 'found.items[0].value'); - } - - if(expected.items[0].type){ - out += getAssertsArr(expected.items[0].type, 'found.items[0].type'); - } - - if(expected.items[0].properties){ - out += getAssertsObj(expected.items[0].properties, 'found.items[0].properties'); - } - } - - if(expected.items[0].children){ - - if(expected.items[0].children.value){ - out += getAssertsStr(expected.items[0].children[0].value, 'found.items[0].children[0].value'); - } - - if(expected.items[0].children.type){ - out += getAssertsArr(expected.items[0].children[0].type, 'found.items[0].children[0].type'); - } - - if(expected.items[0].children.properties){ - out += getAssertsObj(expected.items[0].children[0].properties, 'found.items[0].children[0].properties'); - } - }*/ - out += getAssertsForRootUF(expected.items[0], 'found.items[0]') + "})\r\n\r\n\r\n\r\n\r\n"; } }else{ diff --git a/url.html b/url.html index 74c0372..0204bd9 100644 --- a/url.html +++ b/url.html @@ -55,7 +55,10 @@

The expected JSON output:

"type": ["h-entry"], "properties": { "name": ["Expanding URLs within HTML content"], - "content": ["\n <ul>\n <li><a href=\"http://www.w3.org/\">Should not change: http://www.w3.org/</a></li>\n <li><a href=\"http://example.com/\">Should not change: http://example.com/</a></li>\n <li><a href=\"http://example.com/test.html\">File relative: test.html = http://example.com/test.html</a></li>\n <li><a href=\"http://example.com/test/test.html\">Directory relative: /test/test.html = http://example.com/test/test.html</a></li>\n <li><a href=\"http://example.com/test.html\">Relative to root: /test.html = http://example.com/test.html</a></li>\n </ul>\n <img src=\"http://www.w3.org/2008/site/images/logo-w3c-mobile-lg\"><img src=\"http://example.com/images/test.gif\">\n "] + "content": [{ + "value": "Should not change: http://www.w3.org/ Should not change: http://example.com/ File relative: test.html = http://example.com/test.html Directory relative: /test/test.html = http://example.com/test/test.html Relative to root: /test.html = http://example.com/test.html", + "html": "\n <ul>\n <li><a href=\"http://www.w3.org/\">Should not change: http://www.w3.org/</a></li>\n <li><a href=\"http://example.com/\">Should not change: http://example.com/</a></li>\n <li><a href=\"http://example.com/test.html\">File relative: test.html = http://example.com/test.html</a></li>\n <li><a href=\"http://example.com/test/test.html\">Directory relative: /test/test.html = http://example.com/test/test.html</a></li>\n <li><a href=\"http://example.com/test.html\">Relative to root: /test.html = http://example.com/test.html</a></li>\n </ul>\n <img src=\"http://www.w3.org/2008/site/images/logo-w3c-mobile-lg\"><img src=\"http://example.com/images/test.gif\">\n " + }] } }] }