Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const lastModified = $('meta[property="article:modified_time"]')
.attr('content');
// Wordpress distinguishes predefined "categories" and free-form "tags".
// We are likely to make Wordpress categories into featured sets, and
// Wordpress tags non-featured. For now, we will mark the tag IDs of
// Wordpress tags with "tag:".
const wpCategory = $('meta[property="article:section"]')
.attr('content');
const wpTags = $('meta[property="article:tag"]')
.map(function () { return $(this).attr('content'); })
.get();
const tags = wpTags.map(t => `tag:${t}`);
tags.unshift(wpCategory);
const dom = JSDOM.jsdom($.html(), {
features: {ProcessExternalResources: false},
});
const facts = rules.against(dom);
const html = facts.get('content')
.filter(fnode => fnode.scoreFor('paragraphish') > 0)
.map(fnode => fnode.element.outerHTML).join('');
// Load the DOM back into Cheerio
$ = Cheerio.load('<article>');
$('article').append(html);
const postAsset = new Libingester.BlogArticle();
postAsset.set_title(title);
postAsset.set_synopsis(synopsis);
postAsset.set_canonical_uri(link);
if (lastModified)</article>
const lastModified = $('meta[property="article:modified_time"]')
.attr('content');
// Wordpress distinguishes predefined "categories" and free-form "tags".
// We are likely to make Wordpress categories into featured sets, and
// Wordpress tags non-featured. For now, we will mark the tag IDs of
// Wordpress tags with "tag:".
const wpCategory = $('meta[property="article:section"]')
.attr('content');
const wpTags = $('meta[property="article:tag"]')
.map(function () { return $(this).attr('content'); })
.get();
const tags = wpTags.map(t => `tag:${t}`);
tags.unshift(wpCategory);
const dom = JSDOM.jsdom($.html(), {
features: {ProcessExternalResources: false},
});
const facts = rules.against(dom);
const html = facts.get('content')
.filter(fnode => fnode.scoreFor('paragraphish') > 0)
.map(fnode => fnode.element.outerHTML).join('');
// Load the DOM back into Cheerio
$ = Cheerio.load('<article>');
$('article').append(html);
const postAsset = new Libingester.BlogArticle();
postAsset.set_title(title);
postAsset.set_synopsis(synopsis);
postAsset.set_canonical_uri(link);
if (lastModified)</article>
import testrunner from 'nodeunit/lib/reporters/default';
import { jsdom } from 'jsdom/lib/old-api';
global.document = jsdom();
global.window = global.document.defaultView;
global.navigator = global.window.navigator;
testrunner.run(['tests'], {
error_prefix: '\u001B[31m',
error_suffix: '\u001B[39m',
ok_prefix: '\u001B[32m',
ok_suffix: '\u001B[39m',
bold_prefix: '\u001B[1m',
bold_suffix: '\u001B[22m',
assertion_prefix: '\u001B[35m',
assertion_suffix: '\u001B[39m',
}, (err) => {
if (err) {
process.exit(1);
}
import { jsdom } from 'jsdom/lib/old-api'
const document = jsdom('', {
features: {
FetchExternalResources : ['img']
}
})
global.document = document
global.window = document.defaultView
global.navigator = global.window.navigator
global.Image = global.window.Image
global.MouseEvent = global.window.MouseEvent
Object.keys(document.defaultView).forEach((property) => {
if (typeof global[property] === 'undefined') {
global[property] = document.defaultView[property]
}
})
function staticDom(html) {
return jsdom(html, {features: {ProcessExternalResources: false,
FetchExternalResources: false}});
}
import { jsdom } from 'jsdom/lib/old-api';
global.document = jsdom('<div id="app"></div>');
global.window = document.defaultView;
global.navigator = global.window.navigator;
function staticDom(html) {
return jsdom(html, {features: {ProcessExternalResources: false,
FetchExternalResources: false}});
}