Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser can't tell where java blocks begin and end #150

Closed
cfurst opened this issue Mar 20, 2015 · 4 comments
Closed

parser can't tell where java blocks begin and end #150

cfurst opened this issue Mar 20, 2015 · 4 comments

Comments

@cfurst
Copy link

cfurst commented Mar 20, 2015

A simple catch block at the end of a function:

{{ 
/* some javascript here begins the function */
catch (err) {
                return {"sortName":undefined, "value": value};
            }
        } ).sort(function(a,b){/* more javascript here */
}}

produces the following:

catch (err) {return {"sortName": undefined, "value": value}out+=').sort(function(a,b){

So the two }} at the end of the catch and the end of the function tricks the parser into thinking this is the end of the Javascript block.. when it is not. It should match on a literal }} and not just some combination of } and }

@ghost
Copy link

ghost commented May 12, 2015

I think that's because it strips whitespace. You can try compiling it with strip: false and see if that works.

@dan-silk-discovery
Copy link

You can also configure doT to use [[ ]] markers instead of {{ }}

@houd1ni
Copy link

houd1ni commented Apr 20, 2016

feel free to reopen #191 due to maintain issues with this fork

@epoberezkin
Copy link
Collaborator

@cfurst understanding JS syntax in the template is out of scope, doT only parses it's own syntax. strip: false suggested by @Xaxatix will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants