https://github.com/hubgit/extract
Extract data from HTML using a JSON template
https://github.com/hubgit/extract
Last synced: 4 months ago
JSON representation
Extract data from HTML using a JSON template
- Host: GitHub
- URL: https://github.com/hubgit/extract
- Owner: hubgit
- Created: 2014-02-06T15:37:11.000Z (about 12 years ago)
- Default Branch: gh-pages
- Last Pushed: 2014-02-27T20:04:12.000Z (almost 12 years ago)
- Last Synced: 2025-09-09T01:24:14.669Z (5 months ago)
- Language: JavaScript
- Homepage: http://git.macropus.org/extract/extract.js
- Size: 145 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# About
Extract is a template language that lets you declaratively transform HTML nodes into
Javascript objects using JSON markup and CSS selectors. The idea is to write
some JSON markup that looks like the object that you want to end up with, and then
add selectors to tell Extract where the data should come from.
# Usage
**Turn:**
Hello
Goodbye
**into:**
[
{ id: "1", message: "Hello" },
{ id: "3", message: "Goodbye" }
]
**using:**
var template = [ '.example', { id: '@id', message: 'h2' } ];
var node = document.getElementById('test');
var result = Extract.parse(template, node);
# Demonstration
[Demo](http://git.macropus.org/extract/demo/)
# History
Derived from [Jath](https://github.com/dnewcome/jath)
# License
[MIT license](http://git.macropus.org/mit-license/)