From 53362dcafd1cb0925394b89f7b133089ecc68d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20P=C3=A9rez?= Date: Wed, 21 Aug 2024 22:56:51 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20:recycle:=20createTemplateCache=20pasa?= =?UTF-8?q?=20a=20ser=20un=20m=C3=A9todo=20privado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- render.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 275c391..43017bb 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/render.go b/render.go index 1213ecc..6bd394c 100644 --- a/render.go +++ b/render.go @@ -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))