velocityjs
Advanced tools
Comparing version 1.1.5 to 2.0.0
@@ -0,1 +1,15 @@ | ||
## 2.0.0 2019-09-26 | ||
Break change | ||
First, default escape config set to false. For example | ||
``` | ||
#set($foo = '<div>') $foo | ||
``` | ||
At 1.x , result is `<div>`, for 2.x, output result `<div>`, no escapeHtml variable. | ||
- add quotes to escape when escape option set true [125](https://github.com/shepherdwind/velocity.js/pull/125) | ||
## 1.1.4 2019-08-27 | ||
@@ -2,0 +16,0 @@ |
{ | ||
"name": "velocityjs", | ||
"description": "Velocity Template Language(VTL) for JavaScript", | ||
"version": "1.1.5", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -114,3 +114,3 @@ Velocity - Template Engine | ||
- escape {boolean} default `true`, default escape variable to html encode, you can set false to close it. | ||
- escape {boolean} default `false`, default not escape variable to html encode, you can set true to open it. | ||
- unescape {object} define the object, which key do not need escape. For example, set unescape equal `{control: true}`, so `$control.html` will not escape. | ||
@@ -117,0 +117,0 @@ - env {string} when env equal `development` will throw error when null values are used |
@@ -7,5 +7,8 @@ var utils = require('../utils'); | ||
{ | ||
// 自动输出为经过html e输出 | ||
escape: true, | ||
// 不需要转义的白名单 | ||
/** | ||
* if escapeHtml variable, is set true | ||
* $foo value will handle by escapeHtml | ||
*/ | ||
escape: false, | ||
// whiteList which no need escapeHtml | ||
unescape: {}, | ||
@@ -12,0 +15,0 @@ valueMapper(value) { |
@@ -17,3 +17,3 @@ module.exports = function(Velocity, utils) { | ||
/** | ||
* unicode encode | ||
* escapeHTML | ||
*/ | ||
@@ -84,18 +84,7 @@ function convert(str) { | ||
utils.mixin(Velocity.prototype, { | ||
// 增加某些函数,不需要执行html转义 | ||
addIgnoreEscpape: function(key) { | ||
if (!utils.isArray(key)) key = [key] | ||
utils.forEach(key, function(key) { | ||
this.config.unescape[key] = true | ||
}, this) | ||
}, | ||
/** | ||
* 引用求值 | ||
* @param {object} ast 结构来自velocity.yy | ||
* @param {bool} isVal 取值还是获取字符串,两者的区别在于,求值返回结果,求 | ||
* 字符串,如果没有返回变量自身,比如$foo | ||
* get variable value | ||
* @param {object} ast ast data | ||
* @param {bool} isVal for example `$foo`, isVal value should be true, other condition, | ||
* `#set($foo = $bar)`, the $bar value get, isVal set to false | ||
*/ | ||
@@ -102,0 +91,0 @@ getReferences: function(ast, isVal) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
126721
31
2278