Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

schema.org/Book and schema.org/CreativeWork types has been added #12

Merged
merged 4 commits into from

2 participants

@umurgdk

I have added Book and CreativeWork types

jquery.microdata.js
@@ -44,7 +44,9 @@
// TODO: check three-letter ISO code for currency: http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes.htm
currency: function(value, el) { return (/^[a-zA-Z]{3}$/).test(value); },
- any: function(value, el) { return true; }
+ any: function(value, el) { return true; },
+
+ boolean: function(value, el) { return (/(True|False)/).test(value); }
@KrofDrakula Owner

Maybe put the i flag on the regular expression to test for "true" and "false" in upper- and lower-case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@KrofDrakula
Owner

If you'll please fix up the indentation from 2 to 4 spaces, I'll gladly merge this pull request.

@umurgdk

Can you check it please.

@KrofDrakula
Owner

Great, thanks.

@KrofDrakula KrofDrakula merged commit dd77224 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 21, 2013
  1. @umurgdk
Commits on May 22, 2013
  1. @umurgdk

    Indentation fixed

    umurgdk authored
  2. @umurgdk

    Revert "Indentation fixed"

    umurgdk authored
    This reverts commit 35e9907.
  3. @umurgdk

    Identation re-fixed

    umurgdk authored
This page is out of date. Refresh to see the latest.
Showing with 69 additions and 3 deletions.
  1. +4 −2 jquery.microdata.js
  2. +65 −1 schemas.js
View
6 jquery.microdata.js
@@ -44,7 +44,9 @@
// TODO: check three-letter ISO code for currency: http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes.htm
currency: function(value, el) { return (/^[a-zA-Z]{3}$/).test(value); },
- any: function(value, el) { return true; }
+ any: function(value, el) { return true; },
+
+ boolean: function(value, el) { return (/(True|False)/i).test(value); }
},
@@ -248,4 +250,4 @@
// init the drop-in script
$(init);
-})(jQuery);
+})(jQuery);
View
66 schemas.js
@@ -176,6 +176,70 @@
])
});
schemaOrg.push({
+ url: "http://schema.org/CreativeWork",
+ fields: extend(findByUrl(schemaOrg, "http://schema.org/Thing"), [
+ {name: "about", required: false, type: "complex", validator: validators.text },
+ {name: "accountablePerson", required: false, type: "complex", validator: validators.text },
+ {name: "aggregateRating", required: false, type: "complex", validator: validators.text },
+ {name: "alternativeHeadline", required: false, type: "text", validator: validators.text },
+ {name: "associatedMedia", required: false, type: "complex", validator: validators.text },
+ {name: "audience", required: false, type: "complex", validator: validators.text },
+ {name: "audio", required: false, type: "complex", validator: validators.complex },
+ {name: "author", required: false, type: "complex", validator: validators.complex },
+ {name: "award", required: false, type: "text", validator: validators.text },
+ {name: "awards", required: false, type: "text", validator: validators.text },
+ {name: "comment", required: false, type: "complex", validator: validators.complex },
+ {name: "contentLocation", required: false, type: "complex", validator: validators.complex },
+ {name: "contentRating", required: false, type: "text", validator: validators.text },
+ {name: "contributor", required: false, type: "complex", validator: validators.complex },
+ {name: "copyrightHolder", required: false, type: "complex", validator: validators.complex },
+ {name: "copyrightYear", required: false, type: "number", validator: validators.number },
+ {name: "creator", required: false, type: "complex", validator: validators.complex },
+ {name: "dateCreated", required: false, type: "datetime", validator: validators.datetime },
+ {name: "dateModified", required: false, type: "datetime", validator: validators.datetime },
+ {name: "datePublished", required: false, type: "datetime", validator: validators.datetime },
+ {name: "discussionUrl", required: false, type: "url", validator: validators.url },
+ {name: "editor", required: false, type: "complex", validator: validators.complex },
+ {name: "educationalAlignment", required: false, type: "complex", validator: validators.complex },
+ {name: "educationalUse", required: false, type: "text", validator: validators.text },
+ {name: "encoding", required: false, type: "complex", validator: validators.complex },
+ {name: "encodings", required: false, type: "complex", validator: validators.complex },
+ {name: "genre", required: false, type: "text", validator: validators.text },
+ {name: "headline", required: false, type: "text", validator: validators.text },
+ {name: "inLanguage", required: false, type: "text", validator: validators.text },
+ {name: "interactionCount", required: false, type: "text", validator: validators.text },
+ {name: "interactivityType", required: false, type: "text", validator: validators.text },
+ {name: "isBasedOnUrl", required: false, type: "url", validator: validators.url },
+ {name: "isFamilyFriendly", required: false, type: "boolean", validator: validators.boolean },
+ {name: "keywords", required: false, type: "text", validator: validators.text },
+ {name: "learningResourceType", required: false, type: "text", validator: validators.text },
+ {name: "mentions", required: false, type: "complex", validator: validators.complex },
+ {name: "offers", required: false, type: "complex", validator: validators.complex },
+ {name: "provider", required: false, type: "complex", validator: validators.complex },
+ {name: "publisher", required: false, type: "complex", validator: validators.complex },
+ {name: "publishingPrinciples", required: false, type: "url", validator: validators.url },
+ {name: "review", required: false, type: "complex", validator: validators.complex },
+ {name: "reviews", required: false, type: "complex", validator: validators.complex },
+ {name: "sourceOrganization", required: false, type: "complex", validator: validators.complex },
+ {name: "text", required: false, type: "text", validator: validators.text },
+ {name: "thumbnailUrl", required: false, type: "url", validator: validators.url },
+ {name: "timeRequired", required: false, type: "duration", validator: validators.duration },
+ {name: "typicalAgeRange", required: false, type: "text", validator: validators.text },
+ {name: "version", required: false, type: "number", validator: validators.number },
+ {name: "video" , required: false, type: "complex", validator: validators.complex }
+ ])
+ });
+ schemaOrg.push({
+ url: "http://schema.org/Book",
+ fields: extend(findByUrl(schemaOrg, "http://schema.org/CreativeWork"), [
+ { name: "bookEdition", required: false, type: "text", validator: validators.text },
+ { name: "bookFormat", required: false, type: "complex", validator: validators.complex },
+ { name: "illustrator", required: false, type: "complex", validator: validators.complex },
+ { name: "isbn", required: false, type: "text", validator: validators.text },
+ { name: "numberOfPages", required: false, type: "int", validator: validators.int }
+ ])
+ });
+ schemaOrg.push({
url: "http://schema.org/Person",
fields: extend(findByUrl(schemaOrg, "http://schema.org/Thing"), [
{ name: "additionalName", required: false, type: "text", validator: validators.text },
@@ -240,4 +304,4 @@
for (var i = 0; i < schemaOrg.length; i++) {
$.microdata.addDefinition(schemaOrg[i].url, schemaOrg[i].fields);
}
-})(jQuery);
+})(jQuery);
Something went wrong with that request. Please try again.