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

Adds support for EJS shared blocks #242 #387

Merged
merged 6 commits into from
May 13, 2013
Merged

Adds support for EJS shared blocks #242 #387

merged 6 commits into from
May 13, 2013

Conversation

andykant
Copy link
Contributor

Transforms the EJS template to add support for shared blocks. Essentially, this breaks up EJS tags into multiple EJS tags if they contained unmatched brackets.

These types of templates previously worked prior to adding live binding support to EJS. It also isn't obvious that they shouldn't work and can cause issues if you don't know about this quirk.

For example, this doesn't work:

<% if (1) { %>
  <% if (1) { %>
    hi
  <% } 
} %>

...without isolated EJS blocks:

<% if (1) { %>
  <% if (1) { %>
    hi 
  <% } %>
<% } %> 

The result of transforming:

<% if (1) { %><% %>
  <% if (1) { %><% %>
    hi
  <% %><% } %>
<% } %> 

Transforms the EJS template to add support for shared blocks.
Essentially, this breaks up EJS tags into multiple EJS tags if they
contained unmatched brackets.

For example, this doesn't work:
	<% if (1) { %><% if (1) { %> hi <% } } %>
...without isolated EJS blocks:
	<% if (1) { %><% if (1) { %> hi <% } %><% } %>
The result of transforming:
	<% if (1) { %><% %><% if (1) { %><% %> hi <% } %><% } %>
@andykant
Copy link
Contributor Author

Please review these changes before we merge this @justinbmeyer @ccummings @daffl

Do you foresee any issues with these changes?

@andykant
Copy link
Contributor Author

This commit should be included in the final build for JMVC 3.3.

…#242

For some reason a template loaded by file generates a different result
than one loaded by string.
@andykant
Copy link
Contributor Author

This now fixes the issues that I was having (non-isolated blocks of code breaking), but still doesn't fix the original issue for #242 (losing variables).

andykant added a commit that referenced this pull request May 13, 2013
Adds support for EJS shared blocks #242
@andykant andykant merged commit a886c60 into master May 13, 2013
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

Successfully merging this pull request may close these issues.

1 participant