A webmail client. Forked from https://git.sr.ht/~migadu/alps
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

30 行
575 B

  1. package koushin
  2. import (
  3. "html/template"
  4. "io"
  5. "net/url"
  6. "github.com/labstack/echo/v4"
  7. )
  8. type tmpl struct {
  9. t *template.Template
  10. }
  11. func (t *tmpl) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
  12. return t.t.ExecuteTemplate(w, name, data)
  13. }
  14. func loadTemplates() (*tmpl, error) {
  15. t, err := template.New("drmdb").Funcs(template.FuncMap{
  16. "tuple": func(values ...interface{}) []interface{} {
  17. return values
  18. },
  19. "pathescape": func(s string) string {
  20. return url.PathEscape(s)
  21. },
  22. }).ParseGlob("public/*.html")
  23. return &tmpl{t}, err
  24. }