repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
648d682
parent
fb68af2
author
Eric Bower
date
2022-08-08 16:03:20 +0000 UTC
fix(lists): rss feeds did not handle nested lists
2 files changed,  +4, -5
M lists/api.go
+2, -2
 1@@ -480,7 +480,7 @@ func rssBlogHandler(w http.ResponseWriter, r *http.Request) {
 2 		return
 3 	}
 4 
 5-	ts, err := template.ParseFiles(
 6+	ts, err := template.New("base").Funcs(shared.FuncMap).ParseFiles(
 7 		cfg.StaticPath("html/rss.page.tmpl"),
 8 		cfg.StaticPath("html/list.partial.tmpl"),
 9 	)
10@@ -574,7 +574,7 @@ func rssHandler(w http.ResponseWriter, r *http.Request) {
11 		return
12 	}
13 
14-	ts, err := template.ParseFiles(
15+	ts, err := template.New("base").Funcs(shared.FuncMap).ParseFiles(
16 		cfg.StaticPath("html/rss.page.tmpl"),
17 		cfg.StaticPath("html/list.partial.tmpl"),
18 	)
M shared/api.go
+2, -3
 1@@ -74,7 +74,7 @@ func intRange(start, end int) []int {
 2 	return result
 3 }
 4 
 5-var funcMap = template.FuncMap{
 6+var FuncMap = template.FuncMap{
 7 	"minus":    minus,
 8 	"intRange": intRange,
 9 }
10@@ -89,8 +89,7 @@ func RenderTemplate(cfg *ConfigSite, templates []string) (*template.Template, er
11 		cfg.StaticPath("html/base.layout.tmpl"),
12 	)
13 
14-	ts, err := template.New("base").Funcs(funcMap).ParseFiles(files...)
15-	// ts, err := template.ParseFiles(files...)
16+	ts, err := template.New("base").Funcs(FuncMap).ParseFiles(files...)
17 	if err != nil {
18 		return nil, err
19 	}