Skip to content

Commit

Permalink
set force autoescapes in nunjacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 8, 2023
1 parent 2ee755f commit 901d588
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,14 @@ class Component {
if (this.name === 'Component') {
return this._requirements;
} else if (this.hasOwnProperty('_requirements')) {
let deeper = this.requirements.call(this.__proto__);
let proto = Object.getPrototypeOf(this);
let deeper = this.requirements.call(proto);
//let deeper = Object.getPrototypeOf(this).requirements();
return Object.assign({}, deeper, this._requirements);
} else {
let deeper = this.requirements.call(this.__proto__);
let proto = Object.getPrototypeOf(this);
let deeper = this.requirements.call(proto);
//let deeper = Object.getPrototypeOf(this).requirements();
return deeper;
}
}
Expand All @@ -257,7 +261,10 @@ class Component {
} else if (!this.className) {
return false;
} else {
return this.instanceOf.call(this.__proto__, className);
let proto = Object.getPrototypeOf(this);
let isInstance = this.instanceOf.call(proto, className);
//let isInstance = Object.getPrototypeOf(this).instanceOf(className);
return isInstance;
}
}
/*
Expand Down
4 changes: 4 additions & 0 deletions src/nunjucks-env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const _ = require('lodash');

module.exports = function(env) {
// this is required for webpack when Environment is external and opts cannot be set with { autoescape: false }
env.opts.autoescape = false;

// add Filteers for Environment
env.addFilter('filter2', function(arr, path, value) {
return arr.filter((x) => _.get(x, path)===value);
});
Expand Down

0 comments on commit 901d588

Please sign in to comment.