canner-extract
A html extractor for canner
Install
npm install -g canner-extract
Usage
Usage: canner-extract <html_file, default value: "index.html">
Options:
-h, --help output usage information
-V, --version output the version number
-m, --manually manually naming text node
Auto-extracting
extracting a html
file to canner.json and layout automatically.
canner-extract index.html
Before
A sample html:
This is text 1 This is text 2 This is text 3 This is text 4 This is text 5 This is text 6
AFTER extract-html
test_after.html
:
{{0}} {{1}} {{2}} {{3}}{{4}} {{5}}
test_output.json
:
Manually-extracting
extracting a html
file to canner.json and layout manually.
canner-extract -m index.html
This will prompt some messages for you to fill in, which will set the values in canner.json
.
Preview
Result
canner.json
:
layout.hbs
:
...... <!-- Header --> {{name}} {{side-title1}} {{side-title2}} {{side-tab1}} {{side-tab2}} {{side-tab3}} {{side-tab4}} ...
API
autoParse(html path, opt)
- html path: should be the absolute path to your html file.
return a promise
canner_extract;
manuallyParse(html, opt)
- html path: should be the absolute path to your html file.
return a promise
canner_extract;
Example
https://github.com/Canner/readonly-can
License
MIT