https://github.com/nice-digital/jsonld2html
https://github.com/nice-digital/jsonld2html
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/nice-digital/jsonld2html
- Owner: nice-digital
- Created: 2015-10-05T09:40:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-29T12:42:39.000Z (about 10 years ago)
- Last Synced: 2025-01-08T10:45:33.678Z (over 1 year ago)
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 29
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jsonld2html
> convert JSON-LD graphs into HTML with handlebars view templates
## Getting Started
If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
```shell
npm install https://github.com/nhsevidence/jsonld2html.git --save
```
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
```js
grunt.loadNpmTasks('jsonld2html');
```
## JSONLD2HTML task
_Run this task with the `grunt jsonld2html` command._
Task targets, files and options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide.
### Options
#### helpers
Type: `Object`
Default: `{}`
This provides access to helper methods, such as text formatters, within the Handlebars templates.
_Note: Please, consider the map function before creating complex template logic._
#### metadata
Type: `Object`
Default: `{}`
Provides a way to include cross template dynamic model data for inclusion in all templates.
#### partials
Type: 'String'
Default: './src/views/partials'
Location of view partial templates.
#### views
Type: 'String'
Default: './src/views'
Location of view templates.
#### map
Type: 'Function'
Default: (m) => m
Map function used to transform the JSON-LD Graph into a more viable JSON Model Object.
### Usage Example
```js
jsonld2html: {
models: {
options: {
view: 'model',
map: (m) => m,
},
expand: true,
src: ['path/to/dir/*.json'],
dest: 'wwwroot',
ext: '.html',
}
}
```
#### Globbing Patterns
See documentation [in the Grunt Docs](http://gruntjs.com/configuring-tasks#globbing-patterns), for globbing pattern information
##### Skipping Files
```js
// Process all .json files, but skips index.json file
jsonld2html: {
models: {
src: ["path/to/dir/*.json", "!path/to/dir/index.json"]
}
}
```
###### Options
Options can be specified for all `jsonld2html` tasks and for each `jsonld2html:target` just like in other Grunt tasks.