FAQ
Sounds like a great idea. The text/template package is tolerable but not
always the most convenient. I have been wanting people to start writing
more expressive template engines.

I am wondering though... At first glance Amber appears to lack support for
a couple of the conveniences that text/template does offer. I am mainly
talking about accessing nested values (e.g. B in a struct { A struct { B
string }}), function invocation, and method calls (pipes from
text/templates would be cool but not really necessary). If any of these are
possible it should probably be stated in the docs.

Either way, thanks for the package! I'll likely be looking into it in the
next couple days.
On Wednesday, October 31, 2012 1:55:04 PM UTC-7, ek...@eknkc.com wrote:

Hi,

I just published a new template engine named "amber", (named after jade,
node.js template engine)

Package: https://github.com/eknkc/amber
Docs: http://go.pkgdoc.org/github.com/eknkc/amber

Why? What?

- It is HAML based. So, all html tags go into indented blocks and
attributes can be supplied via css like selctor syntax. (See documentation)
- Compiles to standard Go templates (html/template). Just returns a
*Template, ready to be used. It should make things easier for integration,
also, I expect the runtime to be highly optimized, as it is built in.
- Supports basic expressions. You can go ahead and print `Friends * 2`, or
`2 + 3 * (SomeData % 1)`..
- Supports expressions as attribute conditions. Best example, during an
iteration: `.even ? number % 2 == 0` This will add "even" class to the
parent html tag, only is the condition holds.
- Expressions require helper functions in generated template's FuncMap.
(add, multiple, greater than etc..) These are supplied by amber when you
compile an amber template to go template.
- Supports template inheritance. So, it is possible to create a master
template, define basic structure and named blocks. And then extend it for
different pages, overriding contents of named blocks or just appenfing /
prepending content.
- Standard if, else, iterator statements.

I don't know if anyone would be interested, but if you do, keep in mind
that it's still experimental. I love Jade on Node.JS so wanted to have
something as similar as possible for my Go Projects. I'm also relatively
new to Go, so let me know if you have any suggestions.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 6 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 31, '12 at 9:28p
activeApr 10, '13 at 5:01a
posts6
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase