New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

antwar-rss-plugin

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antwar-rss-plugin - npm Package Compare versions

Comparing version 0.3.1 to 0.8.1-alpha.5859eb8d

8

package.json
{
"name": "antwar-rss-plugin",
"version": "0.3.1",
"version": "0.8.1-alpha.5859eb8d",
"description": "RSS plugin for antwar",

@@ -12,3 +12,3 @@ "main": "src",

"type": "git",
"url": "https://github.com/antwarjs/rss-plugin.git"
"url": "https://github.com/antwarjs/antwar.git"
},

@@ -22,5 +22,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/antwarjs/rss-plugin/issues"
"url": "https://github.com/antwarjs/antwar/issues"
},
"homepage": "https://github.com/antwarjs/rss-plugin",
"homepage": "https://github.com/antwarjs/antwar",
"dependencies": {

@@ -27,0 +27,0 @@ "absolutify": "0.0.2",

@@ -1,30 +0,26 @@

'use strict';
var _url = require('url');
var _ = require('lodash');
var moment = require('moment');
var absolutify = require('absolutify')
var urljoin = require('url-join');
const _url = require('url');
const _ = require('lodash');
const moment = require('moment');
const absolutify = require('absolutify');
const urljoin = require('url-join');
exports.feed = function (children) {
return e('feed', {xmlns: 'http://www.w3.org/2005/Atom'}, children);
}
return e('feed', { xmlns: 'http://www.w3.org/2005/Atom' }, children);
};
exports.title = function (title) {
return e('title', {}, escapeHTML(title));
}
};
exports.link = function (target, rel) {
target = target || '';
rel = rel || '';
exports.link = function (target = '', rel = '') {
return e('link', { href: target, rel }, '');
};
return e('link', {href: target, rel: rel}, '');
}
exports.updated = function (date) {
return e('updated', {}, date);
}
};
exports.id = function (value) {
return e('id', {}, value);
}
};

@@ -34,10 +30,10 @@ exports.author = function (author) {

e('name', {}, author ? escapeHTML(author.name || author) : ''),
e('email', {}, author ? author.email || '' : ''),
e('email', {}, author ? author.email || '' : '')
]);
}
};
exports.entries = function (baseUrl, sections, pages) {
return _.map(pages, function(page, name) {
if(!_.includes(sections, page.section) || !page.title) {
return;
return _.map(pages, function (page, name) {
if (!_.includes(sections, page.section) || !page.title) {
return null;
}

@@ -50,27 +46,36 @@

{},
'a' + _.camelCase(_.escape(_.deburr(page.title))).toLowerCase() +
'a' + _.camelCase(_.escape(_.deburr(page.title))).toLowerCase() +
moment(page.date, 'YYYY-MM-DD').format().toLowerCase()
),
e('link', {href: _url.resolve(baseUrl, name)}, ''),
e('updated', {}, moment(page.date, 'YYYY-MM-DD').format()),
e('content', {type: 'html'}, escapeHTML(resolveUrls(baseUrl, page.section, page.content))),
]);
e('link', { href: _url.resolve(baseUrl, name) }, ''),
e(
'updated',
{},
moment(page.date, 'YYYY-MM-DD').format()
),
e(
'content',
{ type: 'html' },
escapeHTML(resolveUrls(baseUrl, page.section, page.content))
)
]);
}).filter(_.identity).join('');
}
};
function e(name, attributes, content) {
var attrStr = _.map(attributes, function(val, key) {
return key + '=' + '"' + val + '"';
let attrStr = _.map(attributes, function (val, key) {
return key + '="' + val + '"';
});
let ret = content;
attrStr = attrStr.length ? ' ' + attrStr.join(' ') : '';
if(_.isArray(content)) {
content = content.join('');
if (_.isArray(content)) {
ret = content.join('');
}
return '<' + name + attrStr + '>' + content + '</' + name + '>';
};
return '<' + name + attrStr + '>' + ret + '</' + name + '>';
}
function resolveUrls (baseUrl, section, content) {
function resolveUrls(baseUrl, section, content) {
return absolutify(content, function (url, attrName) {

@@ -89,3 +94,7 @@ if (!url.indexOf('./')) {

function escapeHTML (input) {
function escapeHTML(input) {
if (!input) {
return '';
}
return input.replace(/&/g, '&amp;')

@@ -92,0 +101,0 @@ .replace(/</g, '&lt;')

@@ -1,10 +0,7 @@

'use strict';
var url = require('url');
var e = require('./element');
const url = require('url');
const e = require('./element');
// TODO: simplify interface -> object format
// TODO: Push to another package or use a pre-existing one over this
module.exports = function (baseUrl, sections, updated, pages, config) {
sections = sections || [];
module.exports = function (baseUrl, sections = [], updated, pages, config) {
return e.feed([

@@ -11,0 +8,0 @@ e.title(config.title),

@@ -1,9 +0,8 @@

'use strict';
var generate = require('./generate');
var moment = require('moment');
const generate = require('./generate');
const moment = require('moment');
// Antwar wrapper
module.exports = function(o) {
module.exports = function (o) {
return {
extra: function(paths, config) {
extra(paths, config) {
return {

@@ -10,0 +9,0 @@ 'atom.xml': generate(

@@ -1,6 +0,5 @@

'use strict';
var test = require('tape');
var marked = require('marked');
var moment = require('moment');
var element = require('../src/element');
const test = require('tape');
const marked = require('marked');
const moment = require('moment');
const element = require('../src/element');

@@ -10,3 +9,3 @@ test('entries generate xml', function (t) {

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['demoSection'];

@@ -26,5 +25,5 @@ const pages = {

'<title>' + pages.demo.title + '</title>' +
'<id>ademotitle2016-02-01t00:00:00+02:00</id>' +
'<id>ademotitle' + moment(pages.demo.date, 'YYYY-MM-DD').format().toLowerCase() + '</id>' +
'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">' + pages.demo.content + '</content>' +

@@ -39,3 +38,3 @@ '</entry>';

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['demoSection'];

@@ -57,3 +56,3 @@ const pages = {

'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">&lt;p&gt;#test\n&lt;a href=&quot;http://google.com&quot;&gt;check out&lt;/a&gt;&lt;/p&gt;\n</content>' +

@@ -68,3 +67,3 @@ '</entry>';

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['demoSection'];

@@ -84,5 +83,5 @@ const pages = {

'<title>' + pages.demo.title + '</title>' +
'<id>ademotitle2016-02-01t00:00:00+02:00</id>' +
'<id>ademotitle' + moment(pages.demo.date, 'YYYY-MM-DD').format().toLowerCase() + '</id>' +
'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">&lt;p&gt;#test\n&lt;a href=&quot;http://demo.com/blog/demo-interview&quot;&gt;check out&lt;/a&gt;&lt;/p&gt;\n</content>' +

@@ -97,3 +96,3 @@ '</entry>';

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['demoSection'];

@@ -113,5 +112,5 @@ const pages = {

'<title>' + pages.demo.title + '</title>' +
'<id>ademotitle2016-02-01t00:00:00+02:00</id>' +
'<id>ademotitle' + moment(pages.demo.date, 'YYYY-MM-DD').format().toLowerCase() + '</id>' +
'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">&lt;p&gt;#test\n&lt;a href=&quot;http://demo.com/blog/demo-interview&quot;&gt;check out&lt;/a&gt;&lt;/p&gt;\n</content>' +

@@ -126,3 +125,3 @@ '</entry>';

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['blog'];

@@ -142,5 +141,5 @@ const pages = {

'<title>' + pages.demo.title + '</title>' +
'<id>ademotitle2016-02-01t00:00:00+02:00</id>' +
'<id>ademotitle' + moment(pages.demo.date, 'YYYY-MM-DD').format().toLowerCase() + '</id>' +
'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">&lt;p&gt;#test\n&lt;a href=&quot;http://demo.com/blog/demo-interview&quot;&gt;check out&lt;/a&gt;&lt;/p&gt;\n</content>' +

@@ -147,0 +146,0 @@ '</entry>';

@@ -1,5 +0,4 @@

'use strict';
var test = require('tape');
var moment = require('moment');
var generate = require('../src/generate');
const test = require('tape');
const moment = require('moment');
const generate = require('../src/generate');

@@ -9,3 +8,3 @@ test('generates dummy xml', function (t) {

const baseUrl = 'http://demo.com/'
const baseUrl = 'http://demo.com/';
const sections = ['demoSection'];

@@ -38,3 +37,3 @@ const pages = {

'<link href="' + baseUrl + 'demo"></link>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<updated>' + moment(pages.demo.date, 'YYYY-MM-DD').format() + '</updated>' +
'<content type="html">' + pages.demo.content + '</content>' +

@@ -41,0 +40,0 @@ '</entry>' +

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc