summaryrefslogtreecommitdiff
path: root/addons/web/static/lib/qweb/qweb2.js
diff options
context:
space:
mode:
authorVidhin Mehta (OpenERP) <vme@tinyerp.com>2011-10-25 16:55:48 +0530
committerVidhin Mehta (OpenERP) <vme@tinyerp.com>2011-10-25 16:55:48 +0530
commitc17c8a0bd10d5c9cedd6c34bc0110c02ecdcd6b2 (patch)
treeb4543c28941307f8ebdd60191f2eb2494139aad2 /addons/web/static/lib/qweb/qweb2.js
parent1ee677eadbfa3e4c7d9836c48bea735f41f6a5a7 (diff)
parent55ad46220db83d2f5d6dd86d243d0d9843b74511 (diff)
[IMP]merge with main branch of view editor.
bzr revid: vme@tinyerp.com-20111025112548-eakr7fio6diovn2m
Diffstat (limited to 'addons/web/static/lib/qweb/qweb2.js')
-rw-r--r--addons/web/static/lib/qweb/qweb2.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js
index 621ea39c74f..34457ade4fd 100644
--- a/addons/web/static/lib/qweb/qweb2.js
+++ b/addons/web/static/lib/qweb/qweb2.js
@@ -207,6 +207,7 @@ QWeb2.Engine = (function() {
this.reserved_words = QWeb2.RESERVED_WORDS.slice(0);
this.actions_precedence = QWeb2.ACTIONS_PRECEDENCE.slice(0);
this.word_replacement = QWeb2.tools.extend({}, QWeb2.WORD_REPLACEMENT);
+ this.format_text_node = null;
for (var i = 0; i < arguments.length; i++) {
this.add_template(arguments[i]);
}
@@ -317,12 +318,14 @@ QWeb2.Engine = (function() {
" dict = dict || {};\n" +
" dict['__template__'] = '" + template + "';\n" +
" var r = [];\n" +
- " /* START TEMPLATE */ try {\n" +
+ " /* START TEMPLATE */" +
+ (this.debug ? "" : " try {\n") +
(e.compile()) + "\n" +
- " /* END OF TEMPLATE */ } catch(error) {\n" +
+ " /* END OF TEMPLATE */" +
+ (this.debug ? "" : " } catch(error) {\n" +
" if (console && console.exception) console.exception(error);\n" +
- " context.engine.tools.exception('Runtime Error: ' + error, context);\n" +
- " }\n" +
+ " context.engine.tools.exception('Runtime Error: ' + error, context);\n") +
+ (this.debug ? "" : " }\n") +
" return r.join('');";
},
render : function(template, dict) {
@@ -486,12 +489,16 @@ QWeb2.Element = (function() {
},
_compile : function() {
switch (this.node.nodeType) {
- case 3:
- case 4:
- this.top_string(this.node.data);
+ case 3:
+ case 4:
+ var text = this.node.data;
+ if (this.engine.format_text_node) {
+ text = this.engine.format_text_node.call(this, text);
+ }
+ this.top_string(text);
break;
- case 1:
- this.compile_element();
+ case 1:
+ this.compile_element();
}
var r = this._top.join('');
if (this.process_children) {