MtHaml
MtHaml copied to clipboard
Interpolation in filters should not be escaped
From the HAML docs:
Currently, filters ignore the :escape_html option. This means that #{} interpolation within filters is never HTML-escaped.
Currently, in MtHaml, this...
:php
$code = "var msg='hi';";
:javascript
#{$code}
Results in:
<script type="text/javascript">
//<![CDATA[
var msg='hi';
//]]>
</script>
It should be:
<script type="text/javascript">
//<![CDATA[
var msg='hi';
//]]>
</script>
As a workaround, you can do:
:php
$code = "var msg='hi';";
%script(type="text/javascript")
:plain
// Other JS code
:php
echo $code;
:plain
// More JS code