json_ml
JsonML parse/stringify function.
Last updated 5 years ago by 59naga .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install json_ml 
SYNC missed versions from official npm registry.

Json_ml NPM version Build Status Coverage Status

Sauce Test Status

JsonML parse/stringify function

Installation

Via npm

$ npm install json_ml --save
var JsonML= require('json_ml');
console.log(JsonML); //object

Via bower

$ bower install json_ml --save
<script src="bower_components/json_ml/json_ml.min.js"></script>
<script>
  console.log(JsonML); //object
</script>

API

See: http://www.jsonml.org/

JsonML.parse(html, trim=true) -> [Element,Element,...]

Convert HTML string to JsonML Elements.

JsonML.parse('<ul><li style="color:red">First Item</li><li title="Some hover text." style="color:green">Second Item</li><li><span class="code-example-third">Third</span>Item</li></ul>');
//[
//  [
//    "ul",
//    [
//      "li",
//      {
//        "style": "color:red"
//      }
//    ],
//    [
//      "li",
//      {
//        "title": "Some hover text.",
//        "style": "color:green"
//      }
//    ],
//    [
//      "li",
//      [
//        "span",
//        {
//          "class": "code-example-third"
//        }
//      ]
//    ]
//  ]
//]

JsonML.stringify(object, replacer, indent) -> HTML

Convert JsonML Elements to HTML string.

JsonML.stringify([['ul',['li',{style:"color:red"}],['li',{title:"Some hover text.",style:"color:green"}],['li',['span',{class:'code-example-third'}]]]],null,2);
//<ul>
//  <li style="color:red"></li>
//  <li title="Some hover text." style="color:green"></li>
//  <li><span class="code-example-third"></span></li>
//</ul>

License

MIT

Current Tags

  • 0.0.2                                ...           latest (5 years ago)

10 Versions

  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
  • 0.0.1-beta.1                                ...           5 years ago
  • 0.0.1-alpha.4                                ...           5 years ago
  • 0.0.1-alpha.3                                ...           5 years ago
  • 0.0.1-alpha.2                                ...           5 years ago
  • 0.0.1-alpha.1                                ...           5 years ago
  • 0.0.1-alpha.0                                ...           5 years ago
  • 0.0.0                                ...           5 years ago
  • 0.0.0-beta                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 10
This Month 10
Last Day 10
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (8)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |