Intial Commit
This commit is contained in:
46
nodered/rootfs/data/node_modules/html-to-text/bin/cli.js
generated
vendored
Executable file
46
nodered/rootfs/data/node_modules/html-to-text/bin/cli.js
generated
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env node
|
||||
var parseArgs = require('minimist');
|
||||
|
||||
var htmlToText = require('../lib/html-to-text');
|
||||
|
||||
var argv = parseArgs(process.argv.slice(2), {
|
||||
string: [
|
||||
'tables'
|
||||
],
|
||||
boolean: [
|
||||
'noLinkBrackets',
|
||||
'ignoreHref',
|
||||
'ignoreImage'
|
||||
],
|
||||
alias: {
|
||||
'ignore-href': 'ignoreHref',
|
||||
'ignore-image': 'ignoreImage'
|
||||
},
|
||||
default: {
|
||||
'wordwrap': 80
|
||||
}
|
||||
});
|
||||
|
||||
argv.tables = interpretTables(argv.tables);
|
||||
|
||||
var text = '';
|
||||
|
||||
process.title = 'html-to-text';
|
||||
|
||||
process.stdin.resume();
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', function data(data) {
|
||||
text += data;
|
||||
});
|
||||
|
||||
process.stdin.on('end', function end() {
|
||||
text = htmlToText.fromString(text, argv);
|
||||
process.stdout.write(text + '\n', 'utf-8');
|
||||
});
|
||||
|
||||
function interpretTables(tables) {
|
||||
if (!tables || tables === '' || tables === 'false') {
|
||||
return [];
|
||||
}
|
||||
return tables === 'true' || tables.split(',');
|
||||
}
|
||||
Reference in New Issue
Block a user