1.0.7 • Published 8 years ago

metaparser v1.0.7

Weekly downloads
8,941
License
ISC
Repository
github
Last release
8 years ago

Metaparser Build Status

A Cheerio helper library for my Node.js automation modules. Installed through NPM with:

npm install metaparser --save-dev

Simply require the module and execute it with an optional array of configuration.

  • Source: HTML file to write to.
  • Add: String, Array or Object of elements to add (literal elements)
  • Remove: String, Array or Object of elements to remove (pseudo selectors)
  • Callback: Function to execute upon completion (parameters are 'error' and 'html').

Defaults are shown below:

var metaparser = require('metaparser');
metaparser({
    source: null,
    add: null,
    remove: null,
    out: null,
    callback: null
});

Example usage:

metaparser({
    source: 'test/index.html',
    add: '<link rel="author" href="humans.txt" />',
    remove: 'link[rel="author"]',
    out: 'test/index2.html',
    callback: function (error, data) {
        console.log(error, data);
    }
});

Data can be provided directly:

metaparser({
    data: '<html><head><meta name="author" content="Superman"></head></html>',
    add: '<link rel="author" href="humans.txt" />',
    remove: 'link[rel="author"]',
    out: 'test/index2.html',
    callback: function (error, data) {
        console.log(error, data);
    }
});
1.0.7

8 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago