Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

akashacms-base

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

akashacms-base - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

60

index.js

@@ -149,4 +149,4 @@ /**

ret.addMahafunc(new AuthorLinkElement());
ret.addMahafunc(new OpenGraphImage());
ret.addMahafunc(new OpenGraphPromoteImages());
ret.addMahafunc(new img2figureImage());
return ret;

@@ -348,16 +348,26 @@ };

class OpenGraphImage extends mahabhuta.Munger {
get selector() { return "html body opengraph-image"; }
async process($, $link, metadata, dirty) {
const href = $link.attr('href');
if (href && $(`meta[content="${href}"]`).get(0) === undefined) {
let txt = await akasha.partial(this.array.options.config, 'ak_metatag.html.ejs', {
tagname: 'og:image',
tagcontent: href
});
if (txt) {
$('head').append(txt);
}
}
$link.remove();
class img2figureImage extends mahabhuta.CustomElement {
get elementName() { return 'html body img[figure]'; }
async process($element, metadata, dirty, done) {
// console.log($element);
const template = $element.attr('template')
? $element.attr('template')
: "ak_figimg.html.ejs";
const id = $element.attr('id');
const clazz = $element.attr('class');
const style = $element.attr('style');
const width = $element.attr('width');
const src = $element.attr('src');
const dest = $element.attr('dest');
const content = $element.attr('caption')
? $element.attr('caption')
: "";
dirty();
return akasha.partial(this.array.options.config, template, {
id, clazz, style, width, href: src, dest,
caption: content
});
}

@@ -380,3 +390,3 @@ }

|| !($(elem).hasClass('opengraph-no-promote')))
imgz.push(elem);
imgz.push($(elem).attr('src'));
});

@@ -387,6 +397,13 @@ // Look for <meta-og-image> tags

: 'meta-og-image';
$(selector).each(function(i, elem) { imgz.push(elem); });
$(selector).each(function(i, elem) { imgz.push($(elem).attr('src')); });
var selector = $link.attr('root')
? ($link.attr('root') +' opengraph-image')
: 'opengraph-image';
$(selector).each(function(i, elem) {
imgz.push($(elem).attr('href'));
$(elem).remove();
});
// console.log(`${metadata.rendered_url} image selector ${selector} - gave ${imgz.length} images`);
for (let img of imgz) {
let href = $(img).attr('src');
for (let href of imgz) {
// let href = $(img).attr('src');
// console.log(`${metadata.rendered_url} image ${href}`);

@@ -409,3 +426,6 @@ if (href.match(/\/img\/extlink.png$/)

let pRootUrl = url.parse(this.array.options.config.root_url);
pRootUrl.pathname = dirRender +'/'+ href;
pRootUrl.pathname = dirRender !== "/"
? dirRender +'/'+ href
: href;
// console.log(pRootUrl);
href = url.format(pRootUrl);

@@ -412,0 +432,0 @@ }

@@ -29,3 +29,3 @@ {

},
"version": "0.7.1",
"version": "0.7.2",
"engines": {

@@ -35,6 +35,3 @@ "node": ">=12.2"

"scripts": {
"dopublish": "npm publish --access public",
"test-setup": "cd test && npm run setup",
"test": "cd test && npm test",
"clean": "cd test && npm run clean"
"dopublish": "npm publish --access public"
},

@@ -41,0 +38,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

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