-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
InvalidBehaviorA valid or not valid code has an invalid behavior at runtimeA valid or not valid code has an invalid behavior at runtimebugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldtemplatesRelated to the templateRelated to the template
Description
Currently, when rendering Javascript, characters in comments (as '
, for example) may change the context, resulting in a bad rendering of the Scriggo template.
Consider this:
<script>
// it is ok
{% x := "hello hey" %}
if ({{ x }}) { } // AAA
if ('{{ x }}') { } // CCC
if ("{{ x }}") { } // DDD
</script>
this is – correctly – rendered as:
<script>
// it is ok
if ("hello hey") { } // AAA
if ('hello hey') { } // CCC
if ("hello hey") { } // DDD
</script>
As you may note, the strings are quoted correctly, so the bug does not show here.
In this case, instead, the comment contains the character '
. So, Scriggo changes the context, and thus the template:
<script>
// it's bad
{% x := "hello hey" %}
if ({{ x }}) { } // AAA
if ('{{ x }}') { } // CCC
if ("{{ x }}") { } // DDD
</script>
is – incorrectly – rendered as:
<script>
// it's bad
if (hello hey) { } // AAA
if ('"hello hey"') { } // CCC
if ("hello hey") { } // DDD
</script>
As you may note, the strings are not quoted correctly.
So, this behavior should be investigated and corrected.
Metadata
Metadata
Assignees
Labels
InvalidBehaviorA valid or not valid code has an invalid behavior at runtimeA valid or not valid code has an invalid behavior at runtimebugBug: something already implemented does not work as it shouldBug: something already implemented does not work as it shouldtemplatesRelated to the templateRelated to the template