Skip to content

Handlebars and CDATA within html script element does not parse since 2.2.0 #151

@Zielun

Description

@Zielun

Using handlebars templates I can no longer use hbs elements within script tag like:
<script> obj.doSomething({{{hbsVar}}}); </script>
and
CDATA within script
<script type="text/javascript"> <!--//--><![CDATA[//><!-- some js here... //--><!]]> </script>
since version 2.2.0.
I get parsing error on these parts.

The CDATA section is part of my old, Gemius code and I assume I could remove them not to have errors and should be fine but issue with {{{hbsVar}}} is harder to fix this way.
startDelim and endDelim are set to {[{ and }]}
I use Grunt plugin with config:
nggettext_extract: { custom: { options: { options: { startDelim: '{[{', endDelim: '}]}' }, extensions: { hbs: "html" } }, files: { "lang/template.pot": ['src/main/js/**/*.js', 'src/**/*.hbs'] } } }

Version 2.1.15 works fine, so I assume that Espree 3.0 which is used since 2.2.0 is causing a problem? Following changelogs I can see that Espree since 3.0 switched to Acorn...

But maybe I am missing something in regards of configuration or is it known thing?
Thanks for hints how that could be handled with the latest version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions