Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Fixed limitation where macros (and other similar tokens) would not get preserved #132

Merged
merged 4 commits into from
Oct 28, 2012

Conversation

nsaun
Copy link
Contributor

@nsaun nsaun commented Oct 27, 2012

This includes a fix for an issue where macros and other similar template code will not get preserved when defined in a derived file.

Added unit test that demonstrates the previous limitation as well as a fix within the parser. The new behavior is that anything within {% %} and {{ }} will get preserved across an "extends".

@paularmstrong
Copy link
Owner

Sorry to do this, but #133 makes a huge change to the file layout (and test runner). So this can't be easily merged in.

Let me know if you want to just throw things at me and make me fix this myself :)

Conflicts:
	lib/parser.js
	lib/tags/block.test.js
@nsaun
Copy link
Contributor Author

nsaun commented Oct 27, 2012

No worries - bad timing. I've remerged with your changes. Let me know if i did anything wrong.. I tend to stumble my way through git.

@@ -394,13 +394,18 @@ function precompile(indent, context) {
}

}
} else if (token.name === 'set') {
} else if (token.type === LOGIC_TOKEN || token.type === VAR_TOKEN) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this only needs to be the following:

} else if (token.type === LOGIC_TOKEN) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point - I was thinking I needed this for macros, but the definition of a macro is the only case that needs to be preserved. Removed.

@nsaun
Copy link
Contributor Author

nsaun commented Oct 28, 2012

Fixed.

paularmstrong added a commit that referenced this pull request Oct 28, 2012
Fixed limitation where macros would not get preserved across parent/children
@paularmstrong paularmstrong merged commit 30bae69 into paularmstrong:master Oct 28, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants