fix: ♻️ createTemplateCache pasa a ser un método privado
This commit is contained in:
parent
f2fd887f9b
commit
53362dcafd
@ -7,6 +7,7 @@ estándar de Go `html/template`.
|
|||||||
|
|
||||||
- Procesamiento de plantillas utilizando `html/template`.
|
- Procesamiento de plantillas utilizando `html/template`.
|
||||||
- Soporte para caché de plantillas.
|
- 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.
|
- Posibilidad de añadir funciones personalizadas a las plantillas.
|
||||||
- Configuración sencilla con opciones por defecto que se pueden sobreescribir.
|
- Configuración sencilla con opciones por defecto que se pueden sobreescribir.
|
||||||
Inspirado en `Gin`.
|
Inspirado en `Gin`.
|
||||||
@ -92,7 +93,7 @@ func main() {
|
|||||||
## Descargo de responsabilidad
|
## Descargo de responsabilidad
|
||||||
|
|
||||||
Esta librería fue creada para usar las plantillas en mis proyectos privados, es
|
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
|
garantía de que funcione para todos los casos de uso, tenga el máximo
|
||||||
rendimiento o esté libre de errores.
|
rendimiento o esté libre de errores.
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ func WithRenderOptions(opts *Render) OptionFunc {
|
|||||||
|
|
||||||
if opts.EnableCache {
|
if opts.EnableCache {
|
||||||
re.EnableCache = 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 {
|
if re.EnableCache {
|
||||||
tc = re.TemplateCache
|
tc = re.TemplateCache
|
||||||
} else {
|
} else {
|
||||||
tc, err = re.CreateTemplateCache()
|
tc, err = re.createTemplateCache()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("error creating template cache:", err)
|
log.Println("error creating template cache:", err)
|
||||||
return err
|
return err
|
||||||
@ -129,7 +129,7 @@ func (re *Render) Template(w http.ResponseWriter, r *http.Request, tmpl string,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (re *Render) CreateTemplateCache() (TemplateCache, error) {
|
func (re *Render) createTemplateCache() (TemplateCache, error) {
|
||||||
myCache := TemplateCache{}
|
myCache := TemplateCache{}
|
||||||
|
|
||||||
pagesTemplates, err := filepath.Glob(fmt.Sprintf("%s/*.html", re.PageTemplatesPath))
|
pagesTemplates, err := filepath.Glob(fmt.Sprintf("%s/*.html", re.PageTemplatesPath))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user