html-schema.js
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Simplified Interface to the Overly-Complex Microdata and Microformat HTML Standards
# HTMLSchema.js

## Install

### For Node

```
npm install html-schema
```

### For the Browser

``` html

```

## Usage

The main goal is to simplify adding semantic attributes to your markup.  So in HTML you might want this:

``` html

```

That's a lot to remember.  If you're using a templating framework, say jQuery.tmpl, you can do something like this:

``` javascript

```

``` html



```

You can compile out just the schema you are using for optimal performance:

``` coffeescript
HTMLSchema  = require 'html-schema'
fs          = require 'fs'

task 'html-schema', ->
  fs.writeFile 'html-schema.json', JSON.stringify HTMLSchema.compile("address", "contact")

expect(HTMLSchema.compile("address", "contact")).toEqual
  address:
    id:              { itemtype: 'http://schema.org/PostalAddress', class: 'adr' }
    street:          { itemprop: 'streetAddress', class: 'street-address' }
    city:            { itemprop: 'addressLocality', class: 'locality' }
    state:           { itemprop: 'addressRegion', class: 'region' }
    country:         { itemprop: 'addressCountry', class: 'country-name' }
    kind:            { itemprop: 'contactType' }
    email:           { itemprop: 'email' }
    fax:             { itemprop: 'faxNumber' }
    phone:           { itemprop: 'telephone' }
    name:            { itemprop: 'name' }
    title:           { itemprop: 'title' }
    description:     { itemprop: 'description' }
    image:           { itemprop: 'image' }
    url:             { itemprop: 'url' }
    suite:           { class: 'extended-address' }
    postalCode:      { itemprop: 'postalCode', class: 'postal-code' }
    postOfficeBox:   { itemprop: 'postOfficeBoxNumber', class: 'post-office-box' }
  contact:
    id:              { itemtype: 'http://schema.org/Contact' }
    kind:            { itemprop: 'contactType' }
    email:           { itemprop: 'email' }
    fax:             { itemprop: 'faxNumber' }
    phone:           { itemprop: 'telephone' }
    name:            { itemprop: 'name' }
    title:           { itemprop: 'title' }
    description:     { itemprop: 'description' }
    image:           { itemprop: 'image' }
    url:             { itemprop: 'url' }
```

You can also just use the library directly.

``` coffeescript
HTMLSchema.address.id #=> { itemtype : 'http://schema.org/PostalAddress', class : 'adr' }
```

## Real-World Usage



## Development

```
./node_modules/coffee-script/bin/coffee -o lib -w src
./node_modules/jasmine-node/bin/jasmine-node --coffee ./spec
```

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。