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

Ignore whitespace between template expressions #57

Closed
chrisellsworth opened this issue Dec 19, 2016 · 2 comments
Closed

Ignore whitespace between template expressions #57

chrisellsworth opened this issue Dec 19, 2016 · 2 comments

Comments

@chrisellsworth
Copy link

Is it possible for Sourcery (or maybe this is Stencil behavior) to ignore the whitespace between two template expressions?

For example, if I have the following template:

    	if let {{ variable.name }} = self.{{ variable.name }} {
    		{% if variable.annotations.key %}
    		{% if variable.annotations.serializable %}
    		toReturn["{{ variable.annotations.key }}"] = self.{{ variable.name }}.serialized()
    		{% else %}
    		toReturn["{{ variable.annotations.key }}"] = self.{{ variable.name }}
    		{% endif %}
    		{% else %}
    		{% if variable.annotations.serializable %}
    		toReturn["{{ variable.name }}"] = self.{{ variable.name }}.serialized()
    		{% else %}
    		toReturn["{{ variable.name }}"] = self.{{ variable.name }}
    		{% endif %}
    		{% endif %}
    	}

I get output similar to the following:

    	if let name = self.name {
    		
    		
    		toReturn["name"] = self.name
    		
    		
    	}

Ideally, this is what we'd get instead:

    	if let name = self.name {		
    		toReturn["name"] = self.name
    	}
@ilyapuchka
Copy link
Collaborator

HI @chrisellsworth . This is related to this discussion stencilproject/Stencil#22

@chrisellsworth
Copy link
Author

Thanks @ilyapuchka! I see it's coming soon with stencilproject/Stencil#85 so I'll keep an eye on that PR and close this issue. 🎉

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

2 participants