0.0.12 • Published 8 years ago

html-aggregator v0.0.12

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
8 years ago

html-aggregator

Build Status codecov License

Aggregate html snippets from other pages.

Usage

Install with npm install -g html-aggregator.

Run with html-aggregator --templateDir=<directory> --output=<file> --maxLen=<number> input files....

templateDir contains json files that define how to extract data from HTML files:

{
    "selectors": {
        "title": "header.post-header h1",
        "content": "article.post-content"
    },
    "static": {
        "name": "My Name"
    }
}

The values in selectors are CSS selectors that are applied to the input HTML files. static contains static strings.

output is a file defining how to render the scraped data:

<h1>%title%</h1>
<div>By %name%</div>
<div>%content%</div>

The variables defined in a template are referenced by the expression%var%.

For every occurrence of <aggregate url="..." template="..."></aggregate> in every input file

  • the contents of the given URL is fetched
  • the contents is parsed with the given template
  • if the input file name has the form <name>.html.<ext>

    a new file <name>.html is created where all <aggregate>s are replaced by the output file having its variables replaced.

    Otherwise, <aggregate>'s child nodes are replaced with the output file having its variables replaced.

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago