[ANN] goats-html 0.1.0 - GO Attribute-based Template System for HTML

270 views
Skip to first unread message

linux...@gmail.com

unread,
Sep 29, 2013, 3:18:58 PM9/29/13
to golan...@googlegroups.com
Hi, Go web developers

After over 10 weekends' hard work, goats-html 0.1.0 is ready for public under LGPL. It's a Template Attribute Language (TAL - http://en.wikipedia.org/wiki/Template_Attribute_Language), inspired by Zope Page Templates and Chameleon but not a simple clone of them.

Different from traditional HTML template languages like Apache Velocity, Freemarker, or Jinja, TAL does not introduce customized tags or directive. Instead, it uses customized attributes to express the rendering logic. Templates written in TAL is more readable and maintainable than traditional template languages.

Different from most of other HTML template languages, goats-html doesn't have a run-time rendering engine (AST). Instead, goats-html processor translate the templates directly into GO code and the templates logic is compiled into the ultimate executable! It makes goats-html render pages very fast and its deployment is inherently bounded with the binary. Meanwhile, it makes development harder because even a one-character change of the template will incur a rebuild of the whole binary. To solve this problem, goats-html introduces a developer server and provides a proxy mechanism so that your server in develop mode does not need rebuild/restart when the templates are changed. Of course, if the interfaces of the templates are changed, you still need to rebuild and restart your server.


Do not run "go get" to fetch goats-html. Instead, in your go souce path (such as, ~/go/src) run git clone to fetch souce code (folder goats-html should be directly put under $GOPATH). The folder goats-html contains a Makefile to build the tool. You can also install goats-html from the prebuilt debian/ubuntu package (for amd64).

Example templates can be found in "examples" and "tests/templates" folders.

goats-html consists of two parts: the goats command line tool and a runtime library which will be compiled into the executable. "goats" command generates GO programs from templates and is also a developer server. The run-time library should be put into a read-only folder and should not be installed to go/pkg. That is because "goats" depends on a flag "goats_devmod" to compile either dev mode or prod mode of the runtime library. If you install goats-html from the debian/ubuntu package, the installed files are like:

/usr/
  ├── bin
  │   └── goats -> /usr/share/goats-html/bin/goats
  └── share
      └── goats-html
          ├── bin
          │   └── goats
          └── go
              └── src
                  └── goats-html
                      └── goats
                          └── runtime
                              ├── devmode.go
                              ├── filters.go
                              ├── prodmode.go
                              ├── settings.go
                              ├── tagattrs.go
                              ├── template.go
                              └── util.go

Install the deb package is installed and setup the environment:
        $ sudo dpkg -i goats-html_0.1.0_amd64.deb
        $ export GOPATH=/usr/share/goats-html/go:~/go

See instructions on how to use goats command in examples/README.

Credits:
    linuxerwang (linux...@gmail.com): Created the original system.
    nwlearning (nwlea...@gmail.com): Implemented most of the built-in template functions.


**Call for volunteers:**

There are still much work to do for goats-html, we welcome volunteers to work on:
    * i18n/l10n translation mechanism
    * security enhancements (csrf token, and review the whole security of goats-html)
    * performance tuning and optimization
    * documentation: user guide and references
    * implement "|" filters in expression, like in Django templates
    * more builtin functions.
    * bug fixes

Cheers,

linuxerwang

Krzysztof Kowalczyk

unread,
Sep 29, 2013, 4:20:00 PM9/29/13
to linux...@gmail.com, golang-nuts
Licensing nit: currently Go only does static linking (of Go code), so
LGPL effectively becomes GPL which means that someone using your code
in their app has to release their whole app under LGPL as well.

If you meant to use more permissive license, BSD or Apache are what
people use more often for Go code.

-- kjk
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Benjamin Measures

unread,
Sep 29, 2013, 5:19:11 PM9/29/13
to golan...@googlegroups.com, linux...@gmail.com
On Sunday, 29 September 2013 21:20:00 UTC+1, Krzysztof Kowalczyk wrote:
Licensing nit: currently Go only does static linking (of Go code), so
LGPL effectively becomes GPL

Not so- the LGPL permits static linking via clause 4d0:

d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.

You need to provide enough so that your application can be relinked against a (user) modified version of the library. For static linking, object code is sufficient.

Hiroaki Nakamura

unread,
Sep 29, 2013, 5:37:31 PM9/29/13
to Benjamin Measures, golang-nuts, linux...@gmail.com
Also you need to allow that users modify or do reverse engineering your application.


4. Combined Works.

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

  • a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
  • b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
  • c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.


2013/9/30 Benjamin Measures <saint....@gmail.com>

--
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
中村 弘輝 )Hiroaki Nakamura)

Benjamin Measures

unread,
Sep 29, 2013, 5:42:53 PM9/29/13
to golan...@googlegroups.com, Benjamin Measures, linux...@gmail.com
This:

On Sunday, 29 September 2013 22:37:31 UTC+1, Hiroaki Nakamura wrote:
modify or do reverse engineering *your application*.


Is not the same as:

https://www.gnu.org/licenses/lgpl-3.0.en.html
modification of the *portions of the Library contained* in the Combined Work

Emphasis added. 

linux...@gmail.com

unread,
Sep 29, 2013, 7:28:32 PM9/29/13
to golan...@googlegroups.com

Thanks everyone. I changed the license to BSD.

- linuxerwang

Hiroaki Nakamura

unread,
Sep 29, 2013, 8:55:05 PM9/29/13
to Benjamin Measures, golang-nuts, linux...@gmail.com
Hi, Benjamin

Thanks for correction! I must admit licenses are hard to understand correctly.


2013/9/30 Benjamin Measures <saint....@gmail.com>

--
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...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
)Hiroaki Nakamura)

Andrew Gallant

unread,
Sep 30, 2013, 10:35:53 AM9/30/13
to golan...@googlegroups.com, linux...@gmail.com
Is there any particular reason why goats-html isn't go-gettable? I quickly looked through your code base and couldn't figure it out.

linux...@gmail.com

unread,
Sep 30, 2013, 10:39:10 PM9/30/13
to golan...@googlegroups.com, linux...@gmail.com
The main reason is that for most users they only need to install the deb package instead of downloading the full source code and build from scratch. I also want to keep the package name shorter.

- linuxerwang
Reply all
Reply to author
Forward
0 new messages