Skip to content

Commit e4b574d

Browse files
committed
Fix view engine parsing (problem with VUE.js markup).
1 parent 143437b commit e4b574d

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

internal.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2265,18 +2265,22 @@ function view_find_command(content, index) {
22652265

22662266
if (c !== '}')
22672267
continue;
2268-
else {
2269-
if (count > 0) {
2270-
count--;
2271-
continue;
2272-
}
2268+
else if (count > 0) {
2269+
count--;
2270+
continue;
22732271
}
22742272

2273+
var command = content.substring(index + 2, i).trim();
2274+
2275+
// @{{ SKIP }}
2276+
if (command[0] === '{')
2277+
return view_find_command(content, index + 1);
2278+
22752279
return {
22762280
beg: index,
22772281
end: i,
22782282
line: view_line_counter(content.substr(0, index)),
2279-
command: content.substring(index + 2, i).trim()
2283+
command: command
22802284
};
22812285
}
22822286

test/controllers/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ function viewViews() {
525525
//self.framework.stop();
526526
//return;
527527

528+
assert.ok(output.contains('#<div>@{{ vue_command }}</div>#'), name + 'VUE command');
528529
assert.ok(output.contains('#mobilefalse#'), name + 'mobile');
529530
assert.ok(output.contains('<count>10</count>'), name + 'inline helper');
530531
assert.ok(output.contains('<count>40</count><next>40</next>'), name + 'inline helper + condition');

test/test-framework-debug.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ function test_routing(next) {
479479
utils.request(url + 'schema-filter/', ['post'], 'EMPTY', function(error, data, code, headers) {
480480
if (error)
481481
throw error;
482-
assert(data === '[{"name":"age","error":"The field \\"age\\" is required.","path":"filter.age"}]', 'schema filter');
482+
assert(data === '[{"name":"age","error":"The field \\"age\\" is invalid.","path":"filter.age"}]', 'schema filter');
483483
complete();
484484
});
485485
});

test/test-framework-release.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ function test_routing(next) {
479479
utils.request(url + 'schema-filter/', ['post'], 'EMPTY', function(error, data, code, headers) {
480480
if (error)
481481
throw error;
482-
assert(data === '[{"name":"age","error":"The field \\"age\\" is required.","path":"filter.age"}]', 'schema filter');
482+
assert(data === '[{"name":"age","error":"The field \\"age\\" is invalid.","path":"filter.age"}]', 'schema filter');
483483
complete();
484484
});
485485
});

test/views/a.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@{endif}
1010
@{end}
1111

12+
#<div>@{{ vue_command }}</div>#
1213
@{name(10)}
1314
@{meta('TITLE')}
1415
@{dns('//fonts.googleapis.com')}

0 commit comments

Comments
 (0)