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

Fix whitespace bug with dictionary support #128

Merged
merged 2 commits into from Jun 4, 2016

Conversation

derekwheee
Copy link
Contributor

Fixes some whitespace issues with dictionary support. The following now work:

{{ [expression] }}
{{[expression]}}

{{ parent.[expression] }}
{{parent.[other expression]}}

@@ -45,7 +45,7 @@ private string AccumulateWord(TextReader reader)
{
var peek = (char)reader.Peek();

if (peek == '}' || peek == '~' || peek == ')' || char.IsWhiteSpace(peek))
if (peek == '}' || peek == '~' || peek == ')' || (char.IsWhiteSpace(peek) && !buffer.ToString().Contains("[")))
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a safe assumption. We shouldn't merely check to see if the buffer contains a [, but we should check to see if the buffer contains a [ but has no subsequent ] to ensure we are inside the brackets.

@derekwheee
Copy link
Contributor Author

@rexm Added a check for the closing square bracket

@muizsyed
Copy link

muizsyed commented Jun 3, 2016

+1 Hi Do you know when this will be merged? Incredibly useful fix

@rexm rexm merged commit d210e70 into Handlebars-Net:master Jun 4, 2016
@rexm
Copy link
Member

rexm commented Jun 4, 2016

Pushed to nuget 1.7.1

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.

None yet

3 participants