[REM] Removed useless QWeb t-escf and t-rawf

bzr revid: fme@openerp.com-20140115182018-d7q3e6elm6uqh0ox
This commit is contained in:
Fabien Meghazi 2014-01-15 19:20:18 +01:00
parent 46545b6005
commit 84a840a38c
4 changed files with 1 additions and 70 deletions

View File

@ -312,15 +312,6 @@ Output
Evaluates, html-escapes and outputs ``content``.
.. _qweb-directive-escf:
.. function:: t-escf=content
:param Format content:
Similar to :ref:`t-esc <qweb-directive-esc>` but evaluates a
``Format`` instead of just an expression.
.. _qweb-directive-raw:
.. function:: t-raw=content
@ -331,14 +322,6 @@ Output
html-escape the result of evaluating ``content``. Should only ever
be used for known-secure content, or will be an XSS attack vector.
.. _qweb-directive-rawf:
.. function:: t-rawf=content
:param Format content:
``Format``-based version of :ref:`t-raw <qweb-directive-raw>`.
.. _qweb-directive-att:
.. function:: t-att=map

View File

@ -10,20 +10,6 @@
<t t-esc="ok"/>
</t>
<!-- escf, same as t-esc, but @t-escf is a format string -->
<t t-name="escf-noformat-literal">
<t t-escf="ok"/>
</t>
<t t-name="escf-simpleformat-variable">
<t t-escf="#{value}"/>
</t>
<t t-name="escf-format-variable">
<t t-escf="[#{value}]"/>
</t>
<t t-name="escf-format-variable-with-escapes">
<t t-escf="[#{value}]"/>
</t>
<!-- raw, evaluates and returns @t-raw directly (no escaping) -->
<t t-name="raw-literal">
<t t-raw="'ok'"/>
@ -34,18 +20,4 @@
<t t-name="raw-notescaped">
<t t-raw="ok"/>
</t>
<!-- rawf, same as t-raw, but @t-rawf is a format string -->
<t t-name="rawf-noformat-literal">
<t t-escf="ok"/>
</t>
<t t-name="rawf-simpleformat-variable">
<t t-escf="#{value}"/>
</t>
<t t-name="rawf-format-variable">
<t t-escf="[#{value}]"/>
</t>
<t t-name="rawf-format-variable-notescaped">
<t t-rawf="[#{value}]"/>
</t>
</templates>

View File

@ -32,29 +32,11 @@
equals(render('esc-variable', {ok: 'ok'}), "ok", "Render a string variable");
equals(render('esc-toescape', {ok: '<ok>'}), "&lt;ok&gt;", "Render a string with data to escape");
});
test("Formatted escaped output", function () {
equals(render('escf-noformat-literal', {}), "ok", "Render a literal string");
equals(render('escf-simpleformat-variable', {value: 'ok'}), "ok",
"Only render an interpolated variable");
equals(render('escf-format-variable', {value: 'ok'}), "[ok]",
"Actually formatted variable");
equals(render('escf-format-variable-with-escapes', {value: '<ok>'}), '[&lt;ok&gt;]',
"Render a formatted string with data to escape");
});
test("Basic unescaped output", function () {
equals(render('raw-literal', {}), "ok", "Render a literal string");
equals(render('raw-variable', {ok: 'ok'}), "ok", "Render a string variable");
equals(render('raw-notescaped', {ok: '<ok>'}), "<ok>", "Render a string with data not escaped");
});
test("Formatted unescaped output", function () {
equals(render('rawf-noformat-literal', {}), "ok", "Render a literal string");
equals(render('rawf-simpleformat-variable', {value: 'ok'}), "ok",
"Only render an interpolated variable");
equals(render('rawf-format-variable', {value: 'ok'}), "[ok]",
"Actually formatted variable");
equals(render('rawf-format-variable-notescaped', {value: '<ok>'}), '[<ok>]',
"Render a formatted string with data not escaped");
});
module("Context-setting tests", {
setup: function () {

View File

@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var QWeb2 = {
expressions_cache: {},
RESERVED_WORDS: 'true,false,NaN,null,undefined,debugger,console,window,in,instanceof,new,function,return,this,typeof,eval,void,Math,RegExp,Array,Object,Date'.split(','),
ACTIONS_PRECEDENCE: 'foreach,if,call,set,esc,escf,raw,rawf,js,debug,log'.split(','),
ACTIONS_PRECEDENCE: 'foreach,if,call,set,esc,raw,js,debug,log'.split(','),
WORD_REPLACEMENT: {
'and': '&&',
'or': '||',
@ -735,15 +735,9 @@ QWeb2.Element = (function() {
compile_action_esc : function(value) {
this.top("r.push(context.engine.tools.html_escape(" + (this.format_expression(value)) + "));");
},
compile_action_escf : function(value) {
this.top("r.push(context.engine.tools.html_escape(" + (this.string_interpolation(value)) + "));");
},
compile_action_raw : function(value) {
this.top("r.push(" + (this.format_expression(value)) + ");");
},
compile_action_rawf : function(value) {
this.top("r.push(" + (this.string_interpolation(value)) + ");");
},
compile_action_js : function(value) {
this.top("(function(" + value + ") {");
this.bottom("})(dict);");