edge-parser
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -37,3 +37,3 @@ /** | ||
*/ | ||
flush(): string; | ||
flush(wrapAsFunction?: boolean): string; | ||
/** | ||
@@ -40,0 +40,0 @@ * Returns the number of spaces to the added to the current line for |
@@ -63,11 +63,14 @@ "use strict"; | ||
*/ | ||
flush() { | ||
let returnValue = '(function (template, ctx) {'; | ||
returnValue += `${os_1.EOL} let out = ''`; | ||
returnValue += `${this.lines}`; | ||
returnValue += `${os_1.EOL} return out`; | ||
returnValue += `${os_1.EOL}})(template, ctx)`; | ||
/** | ||
* Reset internal props. | ||
*/ | ||
flush(wrapAsFunction = true) { | ||
let returnValue = ''; | ||
if (wrapAsFunction) { | ||
returnValue = '(function (template, ctx) {'; | ||
returnValue += `${os_1.EOL} let out = ''`; | ||
returnValue += `${this.lines}`; | ||
returnValue += `${os_1.EOL} return out`; | ||
returnValue += `${os_1.EOL}})(template, ctx)`; | ||
} | ||
else { | ||
returnValue = this.lines; | ||
} | ||
this.lines = ''; | ||
@@ -74,0 +77,0 @@ this.indentSpaces = 2; |
@@ -32,3 +32,3 @@ /** | ||
*/ | ||
parseTemplate(template: string): string; | ||
parseTemplate(template: string, wrapAsFunction?: boolean): string; | ||
/** | ||
@@ -35,0 +35,0 @@ * Process a token and writes the output to the buffer instance |
@@ -67,3 +67,3 @@ "use strict"; | ||
*/ | ||
parseTemplate(template) { | ||
parseTemplate(template, wrapAsFunction = true) { | ||
const buffer = new EdgeBuffer_1.EdgeBuffer(); | ||
@@ -75,3 +75,3 @@ const tokenizer = new edge_lexer_1.Tokenizer(template, this.tags); | ||
}); | ||
return buffer.flush(); | ||
return buffer.flush(wrapAsFunction); | ||
} | ||
@@ -78,0 +78,0 @@ /** |
@@ -0,1 +1,12 @@ | ||
<a name="1.0.5"></a> | ||
## [1.0.5](https://github.com/poppinss/edge-parser/compare/v1.0.4...v1.0.5) (2018-07-02) | ||
### Features | ||
* **buffer:** add support to return unwrapped lines ([da27c99](https://github.com/poppinss/edge-parser/commit/da27c99)) | ||
* **parser:** add support for unwrapped templates ([853ba21](https://github.com/poppinss/edge-parser/commit/853ba21)) | ||
<a name="1.0.3"></a> | ||
@@ -2,0 +13,0 @@ ## [1.0.3](https://github.com/poppinss/edge-parser/compare/v1.0.2...v1.0.3) (2018-07-01) |
{ | ||
"name": "edge-parser", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Parser for edge template engine", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
30712
773