An open API service indexing awesome lists of open source software.

https://github.com/tenphi/jml

Data-driven content generation library
https://github.com/tenphi/jml

Last synced: about 1 year ago
JSON representation

Data-driven content generation library

Awesome Lists containing this project

README

          

JML
===

Data-driven content generation library

## Getting started
Install via NPM...

```
$ npm install jml
```

... or add script to your web page.

```html

```

... or install script via bower and add via requirejs.

```bash
bower install git://github.com/tenphi/jml.git
```

```javascript
require(['./components/jml/jml'], function(jml) {
jml.render(/* view *//*, state */);
});
```

## Simple usage

```javascript
jml.render([
['div',
{ class: 'container' },
['a', {
class: 'link',
href: 'http://tenphi.me'
}, 'Link text'],
['img', {
src: '/myphoto.jpg',
alt: '',
style: {
width: '100px'
}
}]
]
]);
```

output:

```html


```

### Render with state
Create template:

```javascript
var link = jml.view([
['a', {
href: 'http://tenphi.me',
target: function() {
return this.target;
}
}, function() {
return this.body;
}]
]);
```

and render it with state:

```javascript
link({
body: 'text',
target: '_blank'
});
```

output:

```html
text
```