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

Need template examples up front. #1

Open
jldailey opened this issue Jan 21, 2010 · 2 comments
Open

Need template examples up front. #1

jldailey opened this issue Jan 21, 2010 · 2 comments

Comments

@jldailey
Copy link

In the main readme, it would be great if I could see a Hello World template in the Mustache language, as supported by this lib.

Thanks.

@hoisie
Copy link
Owner

hoisie commented Jan 22, 2010

You're right, it would be great to have some go examples.

In the mean time I added a link to the examples folder of the original mustache project.

@XULRunner42
Copy link

I had a hard time getting started here too, as I am new to Go and new to Mustache and there are no good examples in the tree of providing Go input for complex configurations.

https://gist.github.com/818727/5de46f2e242efb562a7a461567a5e9884e91569f

Most important examples are index.mustache and musttest.go which shows making up and passing in a function that can be used with {{#name}}. Note the map[string]interface{} used to carry the lambda in "wrapped"

Second most important example is postdata.go which shows how to construct a type system for your template's sections using map[string]string and map[string]interface{} or something a little more cleanly typed like map[string][]map[string]string... which is much easier to read for sure, with the type redirections shown, Post and Posts.

You may not want to have composite or map literals in your production code, but to see what's going on the example written this way really helps! Feel free to adapt this code.

If anyone can show a cleaner way to use ResultSet.Scan(...) with mustache, that would be a good next page, sorry also about the .8 files I accidentally committed!

marksalpeter pushed a commit to dealyze/mustache that referenced this issue Mar 9, 2015
Implement the spec to make this a compliant implementation
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

3 participants