edge-parser
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -17,2 +17,6 @@ /** | ||
/** | ||
* Writes raw text to the output | ||
*/ | ||
writeRaw(text: string): void; | ||
/** | ||
* Write a new line to the output | ||
@@ -19,0 +23,0 @@ */ |
@@ -32,2 +32,9 @@ "use strict"; | ||
/** | ||
* Writes raw text to the output | ||
*/ | ||
writeRaw(text) { | ||
text = text.replace(/[']/g, '\\\''); | ||
this.lines += `\n${this.getSpace()}out += '${text}'`; | ||
} | ||
/** | ||
* Write a new line to the output | ||
@@ -56,7 +63,7 @@ */ | ||
flush() { | ||
let returnValue = '(function (ctx) {'; | ||
let returnValue = '(function (template, ctx) {'; | ||
returnValue += `\n let out = ''`; | ||
returnValue += `${this.lines}`; | ||
returnValue += '\n return out'; | ||
returnValue += '\n})(ctx)'; | ||
returnValue += '\n})(template, ctx)'; | ||
/** | ||
@@ -63,0 +70,0 @@ * Reset internal props. |
@@ -82,3 +82,3 @@ "use strict"; | ||
if (token.type === 'raw') { | ||
buffer.writeLine(`'${token.value}'`); | ||
buffer.writeRaw(token.value); | ||
return; | ||
@@ -90,3 +90,3 @@ } | ||
if (token.type === 'newline') { | ||
buffer.writeLine(`'\\n'`); | ||
buffer.writeRaw(`\\n`); | ||
return; | ||
@@ -93,0 +93,0 @@ } |
@@ -0,1 +1,11 @@ | ||
<a name="1.0.2"></a> | ||
## [1.0.2](https://github.com/poppinss/edge-parser/compare/v1.0.0...v1.0.2) (2018-06-01) | ||
### Bug Fixes | ||
* **buffer:** escape quotes inside raw strings ([cd659d0](https://github.com/poppinss/edge-parser/commit/cd659d0)) | ||
<a name="1.0.1"></a> | ||
@@ -2,0 +12,0 @@ ## [1.0.1](https://github.com/poppinss/edge-parser/compare/v1.0.0...v1.0.1) (2018-06-01) |
{ | ||
"name": "edge-parser", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Parser for edge template engine", | ||
@@ -5,0 +5,0 @@ "main": "./build/Parser/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27554
740
0