Skip to content

Releases: go-humble/temple

Version 0.1.3

20 May 19:51
Compare
Choose a tag to compare
Version 0.1.3 Pre-release
Pre-release

This version updates the contribution guidelines in CONTRIBUTING.md. There are no actual code changes.

Version 0.1.2

20 May 19:50
Compare
Choose a tag to compare
Version 0.1.2 Pre-release
Pre-release

This release fixes a typo and updates the README to use a new version badge. There are no code changes.

Version 0.1.1

13 Jul 01:59
Compare
Choose a tag to compare
Version 0.1.1 Pre-release
Pre-release

This release fixes a bug where partials were not being associated with one another correctly. It is 100% backwards compatible.

Full Changelog

  • Fix a bug where partials were not being associated with one another correctly.

Version 0.1.0

29 May 02:07
Compare
Choose a tag to compare
Version 0.1.0 Pre-release
Pre-release

This release changes the way templates, layouts, and partials are accessed once they have been added to a group. Instead of getting them from the map directly, you must now use the GetTemplate, GetPartial, and GetLayout methods. We've also implemented new helper methods MustGetTemplate, MustGetPartial, and MustGetLayout, which work like Template.Must in the text/html package from the standard library and panic if a template, layout, or partial could not be found with the given name. The MustGet methods are especially useful for variable declarations.

Instead of the annoyingly repetitive:

var (
    indexTmpl temple.Template
    homeTmpl tempe.Template
    todoTmple temple.Template
)

func init() {
    var found bool
    indexTmpl, found = group.Templates["index"]
    if !found {
        panic("Could not find template called index")
    } 
    homeTmpl, found = group.Templates["home"]
    if !found {
        panic("Could not find template called home")
    } 
    todoTmpl, found = group.Templates["todo"]
    if !found {
        panic("Could not find template called todo")
    } 

}

You can now simply write:

var (
    indexTmpl = group.MustGetTemplate("index")
    homeTmpl = group.MustGetTemplate("home")
    todoTmple = group.MustGetTemplate("todo")
)

The code generated by the command line tool now exposes the GetX and MustGetX methods of the group as exported top-level functions:

var (
    GetTemplate     func(name string) (*temple.Template, error)
    GetPartial      func(name string) (*temple.Partial, error)
    GetLayout       func(name string) (*temple.Layout, error)
    MustGetTemplate func(name string) *temple.Template
    MustGetPartial  func(name string) *temple.Partial
    MustGetLayout   func(name string) *temple.Layout
)

Full Changelog

  • The Templates, Partials, and Layouts properties of Group are no longer exported.
  • Implemented GetTemplate, GetPartial, and GetLayout methods on Group, which are to be used instead of direct map access.
  • Implemented MustGetTemplate, MustGetPartial, and MustGetLayout which panic if a template, partial, or layout with the given name was not found.

Version 0.0.1

21 May 02:27
Compare
Choose a tag to compare
Version 0.0.1 Pre-release
Pre-release

This is the first official release of the temple command line tool and library. Everything is already well documented and pretty well tested. However, we still need to write karma tests for the methods that deal with loading inline templates and rendering to the DOM. There are also some important features planned for release in the near future.