// AddWithLayout register one or more templates using the provided layout
AddWithLayout register one or more templates using the provided layout
// AddWithLayout register one or more templates using the provided layout
func (t *TemplateRenderer) AddWithLayout(fsys fs.FS, layout string, patterns ...string) error {
	filenames, err := readFileNames(fsys, patterns...)
	if err != nil {
		return errors.Wrap(err, "failed to list using file pattern")
	}
	for _, f := range filenames {
		tname := path.Base(f)
		lname := path.Base(layout)
		log.Debug().Str("filename", tname).Str("layout", layout).Msg("register template")
		t.templates[tname] = &Template{
			layout:   lname,
			name:     tname,
			template: template.Must(template.New(tname).Funcs(templateFuncs).ParseFS(fsys, layout, f)),
		}
	}
	return nil
}
func ( t * TemplateRenderer ) AddWithLayout ( fsys fs . FS , layout string , patterns ... string ) error { filenames , err := readFileNames ( fsys , patterns ... ) if err != nil { return errors . Wrap ( err , " " ) } for _ , f := range filenames { tname := path . Base ( f ) lname := path . Base ( layout ) log . Debug ( ) . Str ( " " , tname ) . Str ( " " , layout ) . Msg ( " " ) t . templates [ tname ] = & Template { layout : lname , name : tname , template : template . Must ( template . New ( tname ) . Funcs ( templateFuncs ) . ParseFS ( fsys , layout , f ) ) , } } return nil }
AddWithLayout register one or more templates using the provided layout
AddWithLayout register one or more templates using the provided layout