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

Added support for {{.}} notation to allow direct access to the top of the context stack. #15

Merged
merged 2 commits into from
Apr 26, 2013

Conversation

sporkmonger
Copy link
Contributor

Fixes issue #14.

@stapelberg
Copy link

I also need this and the commits seem to work for me. Why isn’t this pulled yet? Is there anything obviously wrong with the PR? :)

@sporkmonger
Copy link
Contributor Author

@hoisie, any chance of getting this pulled in soonish?

@sporkmonger
Copy link
Contributor Author

@hoisie Another ping.

@hoisie
Copy link
Owner

hoisie commented Apr 7, 2013

Can you add a test case?

@sporkmonger
Copy link
Contributor Author

OK, so I added tests, but it's been so long since I wrote any Go that I'm exceedingly suspicious of my own code.

hoisie added a commit that referenced this pull request Apr 26, 2013
Added support for `{{.}}` notation to allow direct access to the top of the context stack.
@hoisie hoisie merged commit c3e6cc9 into hoisie:master Apr 26, 2013
@hoisie
Copy link
Owner

hoisie commented Apr 26, 2013

Thanks!

@sporkmonger
Copy link
Contributor Author

LOL, I hope you confirmed that tests pass.
On Apr 25, 2013 7:20 PM, "Michael Hoisie" [email protected] wrote:

Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//pull/15#issuecomment-17052139
.

@hoisie
Copy link
Owner

hoisie commented Apr 26, 2013

Yes, I should have confirmed the tests :P I'll be more careful next time.

@IRGraham
Copy link

This doesn't seem to account for nested objects. The {{.}} ends up outputting the entire data object being passed in.

{{#list}}
    {{#problems}}
        ({{.}})
    {{/problems}}
{{/list}}

With input:

map[string]interface{}{"problems": "so many", "list": map[string]string{"problems": "none"}}

Output:

expected "\"(none)\"" got "\"(map[problems:so many list:map[problems:none]])\""

I know I am 3 years late to the party...

@IRGraham
Copy link

this seems to have been the issue. If context becomes value, then all tests pass and this works for nested objects with dot notation.

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.

4 participants