diff --git a/addons/web/static/lib/qweb/qweb-test-attributes.xml b/addons/web/static/lib/qweb/qweb-test-attributes.xml
index d0d22b179dc..d03c20e922f 100644
--- a/addons/web/static/lib/qweb/qweb-test-attributes.xml
+++ b/addons/web/static/lib/qweb/qweb-test-attributes.xml
@@ -25,4 +25,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/web/static/lib/qweb/qweb-test.js.html b/addons/web/static/lib/qweb/qweb-test.js.html
index 510702e82e5..b768ed9a5a8 100644
--- a/addons/web/static/lib/qweb/qweb-test.js.html
+++ b/addons/web/static/lib/qweb/qweb-test.js.html
@@ -165,6 +165,23 @@
'
',
"each format string should be evaluated independently");
});
+ QUnit.test('Fixed name, jinja-formatted', function (assert) {
+ assert.equal(render('format2-literal', {}), '',
+ "Literal format");
+ assert.equal(render('format2-value', {value:'a'}), '',
+ "Valued format");
+ assert.equal(
+ render('format2-expression', {value: 5}),
+ '',
+ "Format strings are evaluated expressions");
+ assert.equal(render('format2-multiple', {
+ value1: 0,
+ value2: 1,
+ value3: 2,
+ }),
+ '',
+ "each format string should be evaluated independently");
+ });
QUnit.module("Template calling (including)", {
setup: function () {
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 983a3d4187d..e4a792e856f 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -609,12 +609,12 @@ QWeb2.Element = (function() {
s && r.push(_this.engine.tools.js_escape(s));
}
- var re = /#{(.*?)}/g, start = 0, r = [], m;
+ var re = /(?:#{(.+?)}|{{(.+?)}})/g, start = 0, r = [], m;
while (m = re.exec(s)) {
// extract literal string between previous and current match
append_literal(s.slice(start, re.lastIndex - m[0].length));
// extract matched expression
- r.push('(' + this.format_expression(m[1]) + ')');
+ r.push('(' + this.format_expression(m[2] || m[1]) + ')');
// update position of new matching
start = re.lastIndex;
}