Skip to content

Utilities for working with text/template or html/template source.

License

Notifications You must be signed in to change notification settings

crhntr/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template Go Reference

"github.com/crhntr/template/templatetext"

Given the following three files in the package "hypertext" in the module "example.com":

  • template_test.go
  • template.go
  • templates.gohtml

the function templatetest.AssertTypeCommentsAreFound will ensure package and identifier in the {{- /* gotype: ... */ -}} comment are found.

package hypertext_test

import (
	"testing"

	"github.com/crhntr/template/templatetest"
)

func TestSource(t *testing.T) {
	templatetest.AssertTypeCommentsAreFound(t, "", "", "*.gohtml")
}
package hypertext

type Website struct {
  Name string
}
{{- define "with no space after colon" -}}
  {{- /* gotype: example.com/hypertext.Website */ -}}
  <header>
    {{- .Name -}}
  </header>
{{- end -}}

About

Utilities for working with text/template or html/template source.

Topics

Resources

License

Stars

Watchers

Forks

Languages