fix: ♻️ createTemplateCache pasa a ser un método privado

This commit is contained in:
Pedro Pérez 2024-08-21 22:56:51 +02:00
parent f2fd887f9b
commit 53362dcafd
2 changed files with 5 additions and 4 deletions

View File

@ -7,6 +7,7 @@ estándar de Go `html/template`.
- Procesamiento de plantillas utilizando `html/template`.
- Soporte para caché de plantillas.
- Soporte para paginación de elementos como tablas o múltiples blogs.
- Posibilidad de añadir funciones personalizadas a las plantillas.
- Configuración sencilla con opciones por defecto que se pueden sobreescribir.
Inspirado en `Gin`.
@ -92,7 +93,7 @@ func main() {
## Descargo de responsabilidad
Esta librería fue creada para usar las plantillas en mis proyectos privados, es
posible que también solucione su problema. Sin embargo, no ofrezco ninguna
posible que también solucione tu problema. Sin embargo, no ofrezco ninguna
garantía de que funcione para todos los casos de uso, tenga el máximo
rendimiento o esté libre de errores.

View File

@ -58,7 +58,7 @@ func WithRenderOptions(opts *Render) OptionFunc {
if opts.EnableCache {
re.EnableCache = opts.EnableCache
re.TemplateCache, _ = re.CreateTemplateCache()
re.TemplateCache, _ = re.createTemplateCache()
}
}
}
@ -101,7 +101,7 @@ func (re *Render) Template(w http.ResponseWriter, r *http.Request, tmpl string,
if re.EnableCache {
tc = re.TemplateCache
} else {
tc, err = re.CreateTemplateCache()
tc, err = re.createTemplateCache()
if err != nil {
log.Println("error creating template cache:", err)
return err
@ -129,7 +129,7 @@ func (re *Render) Template(w http.ResponseWriter, r *http.Request, tmpl string,
return nil
}
func (re *Render) CreateTemplateCache() (TemplateCache, error) {
func (re *Render) createTemplateCache() (TemplateCache, error) {
myCache := TemplateCache{}
pagesTemplates, err := filepath.Glob(fmt.Sprintf("%s/*.html", re.PageTemplatesPath))