diff --git a/doc/component.md b/doc/component.md index a84eca5b..a2c70bb7 100644 --- a/doc/component.md +++ b/doc/component.md @@ -379,7 +379,7 @@ The `t-widget` directive also accepts dynamic values with string interpolation ```xml
- +
``` @@ -390,14 +390,6 @@ class ParentWidget { } ``` -Similarly to `t-attf-`, there is an alternate form of string interpolation: - -```xml -
- -
-``` - **CSS and style:** there is some specific support to allow the parent to declare additional css classes or style for the sub widget: css declared in `class`, `style`, `t-att-class` or `t-att-style` will be added to the root widget element. @@ -754,20 +746,13 @@ The `t-ref` directive also accepts dynamic values with string interpolation `id` set to 44 in the rendering context, ```xml -
+
``` ```js this.refs.widget_44; ``` -Similarly to `t-attf-` and `t-widget`, there is an alternate form of string -interpolation: - -```xml -
-``` - ### Asynchronous rendering Working with asynchronous code always adds a lot of complexity to a system. Whenever diff --git a/doc/qweb.md b/doc/qweb.md index 4feb0354..80dbf582 100644 --- a/doc/qweb.md +++ b/doc/qweb.md @@ -357,13 +357,6 @@ If an expression evaluates to a falsy value, it will not be set at all: There is another way to format a string attribute: the `t-attf-` directive. With it, you get string interpolation: -```xml -
- -``` - -For historical reason, there is an alternate form of string interpolation: - ```xml
diff --git a/src/qweb_core.ts b/src/qweb_core.ts index 563844d7..5abaf5d9 100644 --- a/src/qweb_core.ts +++ b/src/qweb_core.ts @@ -777,15 +777,11 @@ export class Context { if (matches && matches[0].length === s.length) { return `(${this.formatExpression(s.slice(2, -2))})`; } - matches = s.match(/\#\{.*?\}/g); - if (matches && matches[0].length === s.length) { - return `(${this.formatExpression(s.slice(2, -1))})`; - } - let formatter = expr => "${" + this.formatExpression(expr) + "}"; - let r = s - .replace(/\{\{.*?\}\}/g, s => formatter(s.slice(2, -2))) - .replace(/\#\{.*?\}/g, s => formatter(s.slice(2, -1))); + let r = s.replace( + /\{\{.*?\}\}/g, + s => "${" + this.formatExpression(s.slice(2, -2)) + "}" + ); return "`" + r + "`"; } } diff --git a/tests/qweb.test.ts b/tests/qweb.test.ts index c2d5b32a..9763c176 100644 --- a/tests/qweb.test.ts +++ b/tests/qweb.test.ts @@ -485,7 +485,7 @@ describe("attributes", () => { }); test("format expression, other format", () => { - qweb.addTemplate("test", `
`); + qweb.addTemplate("test", `
`); const result = renderToString(qweb, "test", { value: 5 }); expect(result).toBe(`
`); }); @@ -530,7 +530,7 @@ describe("attributes", () => { }); test("class and t-attf-class with ternary operation", () => { - qweb.addTemplate("test", `
`); + qweb.addTemplate("test", `
`); const result = renderToString(qweb, "test", { value: true }); expect(result).toBe(`
`); });