RejectedSoftware Forums

Sign up

Diet template variables and filters

Template variables are not expanded inside filters.

:javascript
    $("\##{id}").hide();

translated to

<script type="text/javascript">
    //<![CDATA[
    $(function() {
        $("\##{id}").hide();
    });
    //]]>
</script>

Workaround for JavaScript filter is using script tag instead:

script(type="text/javascript")
    $("\##{id}").hide();

Re: Diet template variables and filters

On Thu, 19 Sep 2013 14:11:03 GMT, Jack Applegame wrote:

<script type="text/javascript">
    //<![CDATA[
    $(function() {
        $("\##{id}").hide();
    });
    //]]>
</script>

Ooops, mistake. Should be:

<script type="text/javascript">
    //<![CDATA[
    $("\##{id}").hide();
    //]]>
</script>

Re: Diet template variables and filters

On Thu, 19 Sep 2013 14:13:54 GMT, Jack Applegame wrote:

On Thu, 19 Sep 2013 14:11:03 GMT, Jack Applegame wrote:

<script type="text/javascript">
    //<![CDATA[
    $(function() {
        $("\##{id}").hide();
    });
    //]]>
</script>

Ooops, mistake. Should be:

<script type="text/javascript">
    //<![CDATA[
    $("\##{id}").hide();
    //]]>
</script>

I think there was something tricky/inefficient about implementing it due to the compile time nature or due to how filters were implemented. I've added a ticket for this, though: https://github.com/rejectedsoftware/vibe.d/issues/317