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

Inverted Sections #6

Open
tredoe opened this issue Jul 1, 2010 · 7 comments
Open

Inverted Sections #6

tredoe opened this issue Jul 1, 2010 · 7 comments

Comments

@tredoe
Copy link

tredoe commented Jul 1, 2010

Hi! There is a useful section that has not been implemented. The Inverted Sections which begins with a caret (hat) and ends with a slash.

{{^foo}}
{{/foo}} 

http://mustache.github.com/mustache.5.html

@hoisie
Copy link
Owner

hoisie commented Jul 1, 2010

Thanks for reporting this. I actually didn't know this feature existed!

@hoisie
Copy link
Owner

hoisie commented Jul 1, 2010

Just pushed some initial code that should support most cases, though I still need to add support for zero-length arrays or slices.

@tredoe
Copy link
Author

tredoe commented Jul 2, 2010

@hoisie
Copy link
Owner

hoisie commented Jul 2, 2010

Ugh, this is probably related to the change in strings.Split

@tredoe
Copy link
Author

tredoe commented Jul 2, 2010

Sorry! The problem was because I re-compiled Go and goinstalled mustache but I didn't update it, so I could not use the inverted section.

Anyway, with the last change in strings.Split(), there would change the '0' to '-1'.

http://groups.google.com/group/golang-nuts/browse_thread/thread/efc6eca11122105e/c36738bc8339ba0b

@tredoe
Copy link
Author

tredoe commented Jul 2, 2010

I'm testing it and the code inner of the inverted section is always rendered, when I've passed a key to "false", "" (empty), and without the key.

"While sections can be used to render text one or more times based on the value of the key, inverted sections may render text once based on the inverse value of the key. That is, they will be rendered if the key doesn't exist, is false, or is an empty list."

@hoisie
Copy link
Owner

hoisie commented Aug 24, 2010

Ah, I ran into the issue you were having. It should be fixed now. Care to test again?

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