derby-parsing
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -161,3 +161,3 @@ var htmlUtil = require('html-util'); | ||
var unescaped = (isRawText) ? data : htmlUtil.unescapeEntities(data); | ||
parseText(unescaped, parseTextLiteral, parseTextExpression); | ||
parseText(unescaped, parseTextLiteral, parseTextExpression, 'html'); | ||
} | ||
@@ -198,3 +198,3 @@ | ||
function parseTextExpression(expression) { | ||
function parseTextExpression(expression, environment) { | ||
if (expression.meta.blockType) { | ||
@@ -204,4 +204,8 @@ parseBlockExpression(expression); | ||
parseViewExpression(expression); | ||
} else if (expression.meta.unescaped && environment === 'html') { | ||
var html = new templates.DynamicHtml(expression); | ||
parseNode.content.push(html); | ||
} else { | ||
parseValueExpression(expression); | ||
var text = new templates.DynamicText(expression); | ||
parseNode.content.push(text); | ||
} | ||
@@ -484,7 +488,2 @@ } | ||
function parseValueExpression(expression) { | ||
var text = new templates.DynamicText(expression); | ||
parseNode.content.push(text); | ||
} | ||
function ParseNode(view, parent) { | ||
@@ -503,3 +502,3 @@ this.view = view; | ||
function parseText(data, onLiteral, onExpression) { | ||
function parseText(data, onLiteral, onExpression, environment) { | ||
var current = data; | ||
@@ -528,3 +527,3 @@ var last; | ||
var expression = createExpression(inside); | ||
onExpression(expression); | ||
onExpression(expression, environment); | ||
} | ||
@@ -531,0 +530,0 @@ |
{ | ||
"name": "derby-parsing", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Add HTML template parsing to Derby", | ||
@@ -22,3 +22,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"derby-templates": "~0.1.1", | ||
"derby-templates": "^0.1.3", | ||
"esprima-derby": "~0.1.0", | ||
@@ -25,0 +25,0 @@ "html-util": "~0.2.0" |
@@ -19,2 +19,3 @@ var expect = require('expect.js'); | ||
, view: 'section' | ||
, html: '<b>Qua?</b>' | ||
} | ||
@@ -180,2 +181,6 @@ } | ||
}); | ||
it('unescaped HTML', function() { | ||
test('<div>{{unescaped _page.html}}</div>', '<div><b>Qua?</b></div>'); | ||
}); | ||
}); | ||
@@ -182,0 +187,0 @@ |
66502
1718
Updatedderby-templates@^0.1.3