remove Post.Render
Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
parent
1981a291aa
commit
e2dd1afaa3
2 changed files with 3 additions and 8 deletions
|
@ -13,7 +13,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/aymerick/raymond"
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/yuin/goldmark"
|
||||
emoji "github.com/yuin/goldmark-emoji"
|
||||
|
@ -40,10 +39,6 @@ type Post struct {
|
|||
Image []byte
|
||||
}
|
||||
|
||||
func (p *Post) Render(tpl *raymond.Template) (string, error) {
|
||||
return tpl.Exec(p)
|
||||
}
|
||||
|
||||
func (p *Post) String() string {
|
||||
return p.Slug
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ func (s *server) serveGetPost(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
w.Header().Add("content-type", "text/html; charset=utf-8")
|
||||
tpl, _ := s.templates.Get("fullpost.html")
|
||||
contents, err := p.Render(tpl)
|
||||
contents, err := tpl.Exec(p)
|
||||
if err != nil {
|
||||
s.errorInRequest(w, r, err)
|
||||
return
|
||||
|
@ -115,7 +115,7 @@ func (s *server) serveGetHome(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
summaryTpl, _ := s.templates.Get("summary.html")
|
||||
for _, p := range s.posts.All() {
|
||||
summary, err := p.Render(summaryTpl)
|
||||
summary, err := summaryTpl.Exec(p)
|
||||
if err != nil {
|
||||
log.Printf("could not render post summary for %s", p.Slug)
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ func (s *server) serveGetRSS(w http.ResponseWriter, r *http.Request) {
|
|||
if pubDate != "" {
|
||||
pubDate = common.RSSDatetime(p.Metadata.Time)
|
||||
}
|
||||
summary, err := p.Render(rssItemTpl)
|
||||
summary, err := rssItemTpl.Exec(p)
|
||||
if err != nil {
|
||||
log.Printf("could not render post summary for %s", p.Slug)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue