type Page struct {
Status string
Images []string
- Content template.HTML
- Summary template.HTML
+ Content HTML
+ Summary HTML
RawMarkdown string // TODO should be []byte
Params map[string]interface{}
RenderedContent *bytes.Buffer
return datum, lines
}
-func (p *Page) Permalink() template.HTML {
+func (p *Page) Permalink() HTML {
baseUrl := string(p.Site.BaseUrl)
section := strings.TrimSpace(p.Section)
pSlug := strings.TrimSpace(p.Slug)
path = section + "/" + file
}
}
- return template.HTML(MakePermalink(baseUrl, path))
+ return HTML(MakePermalink(baseUrl, path))
}
func (page *Page) handleTomlMetaData(datum []byte) (interface{}, error) {
}
}
-func (p *Page) Render(layout ...string) template.HTML {
+func (p *Page) Render(layout ...string) HTML {
curLayout := ""
if len(layout) > 0 {
curLayout = layout[0]
}
- return template.HTML(string(p.ExecuteTemplate(curLayout).Bytes()))
+ return HTML(string(p.ExecuteTemplate(curLayout).Bytes()))
}
func (p *Page) ExecuteTemplate(layout string) *bytes.Buffer {
b := new(bytes.Buffer)
b.ReadFrom(lines)
content := b.Bytes()
- page.Content = template.HTML(string(blackfriday.MarkdownCommon(RemoveSummaryDivider(content))))
+ page.Content = HTML(string(blackfriday.MarkdownCommon(RemoveSummaryDivider(content))))
summary, plain := getSummaryString(content)
if plain {
- page.Summary = template.HTML(string(summary))
+ page.Summary = HTML(string(summary))
} else {
- page.Summary = template.HTML(string(blackfriday.MarkdownCommon(summary)))
+ page.Summary = HTML(string(blackfriday.MarkdownCommon(summary)))
}
}
b := new(bytes.Buffer)
b.ReadFrom(lines)
content := b.Bytes()
- page.Content = template.HTML(getRstContent(content))
+ page.Content = HTML(getRstContent(content))
summary, plain := getSummaryString(content)
if plain {
- page.Summary = template.HTML(string(summary))
+ page.Summary = HTML(string(summary))
} else {
- page.Summary = template.HTML(getRstContent(summary))
+ page.Summary = HTML(getRstContent(summary))
}
}
func (s *Site) ProcessShortcodes() {
for i, _ := range s.Pages {
- s.Pages[i].Content = template.HTML(ShortcodesHandle(string(s.Pages[i].Content), s.Pages[i], s.Tmpl))
+ s.Pages[i].Content = HTML(ShortcodesHandle(string(s.Pages[i].Content), s.Pages[i], s.Tmpl))
}
}
content = strings.Replace(content, " href='/", " href='"+baseWithSlash, -1)
content = strings.Replace(content, " href=\"/", " href=\""+baseWithSlash, -1)
content = strings.Replace(content, baseWithoutTrailingSlash+"//", baseWithSlash, -1)
- s.Pages[i].Content = template.HTML(content)
+ s.Pages[i].Content = HTML(content)
}
}
} else {
n.Url = url + "/index.html"
}
- n.Permalink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(plink)))
- n.RSSlink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(url+".xml")))
+ n.Permalink = HTML(MakePermalink(string(n.Site.BaseUrl), string(plink)))
+ n.RSSlink = HTML(MakePermalink(string(n.Site.BaseUrl), string(url+".xml")))
n.Date = o[0].Date
n.Data[singular] = o
n.Data["Pages"] = o
} else {
n.Url = Urlize(plural + "/" + k + "/" + "index.xml")
}
- n.Permalink = template.HTML(string(n.Site.BaseUrl) + n.Url)
+ n.Permalink = HTML(string(n.Site.BaseUrl) + n.Url)
s.Tmpl.ExecuteTemplate(y, "rss.xml", n)
err = s.WritePublic(base+".xml", y.Bytes())
if err != nil {
n.Title = strings.Title(plural)
url := Urlize(plural)
n.Url = url + "/index.html"
- n.Permalink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(n.Url)))
+ n.Permalink = HTML(MakePermalink(string(n.Site.BaseUrl), string(n.Url)))
n.Data["Singular"] = singular
n.Data["Plural"] = plural
n.Data["Index"] = s.Indexes[plural]
n := s.NewNode()
n.Title = strings.Title(inflect.Pluralize(section))
n.Url = Urlize(section + "/" + "index.html")
- n.Permalink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(n.Url)))
- n.RSSlink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string(section+".xml")))
+ n.Permalink = HTML(MakePermalink(string(n.Site.BaseUrl), string(n.Url)))
+ n.RSSlink = HTML(MakePermalink(string(n.Site.BaseUrl), string(section+".xml")))
n.Date = data[0].Date
n.Data["Pages"] = data
layout := "indexes/" + section + ".html"
} else {
n.Url = Urlize(section + "/" + "index.xml")
}
- n.Permalink = template.HTML(string(n.Site.BaseUrl) + n.Url)
+ n.Permalink = HTML(string(n.Site.BaseUrl) + n.Url)
y := s.NewXMLBuffer()
s.Tmpl.ExecuteTemplate(y, "rss.xml", n)
err = s.WritePublic(section+"/index.xml", y.Bytes())
n := s.NewNode()
n.Title = n.Site.Title
n.Url = Urlize(string(n.Site.BaseUrl))
- n.RSSlink = template.HTML(MakePermalink(string(n.Site.BaseUrl), string("index.xml")))
- n.Permalink = template.HTML(string(n.Site.BaseUrl))
+ n.RSSlink = HTML(MakePermalink(string(n.Site.BaseUrl), string("index.xml")))
+ n.Permalink = HTML(string(n.Site.BaseUrl))
if len(s.Pages) > 0 {
n.Date = s.Pages[0].Date
if len(s.Pages) < 9 {
// XML Feed
n.Url = Urlize("index.xml")
n.Title = "Recent Content"
- n.Permalink = template.HTML(string(n.Site.BaseUrl) + "index.xml")
+ n.Permalink = HTML(string(n.Site.BaseUrl) + "index.xml")
y := s.NewXMLBuffer()
s.Tmpl.ExecuteTemplate(y, "rss.xml", n)
err = s.WritePublic("index.xml", y.Bytes())
if a := s.Tmpl.Lookup("404.html"); a != nil {
n.Url = Urlize("404.html")
n.Title = "404 Page not found"
- n.Permalink = template.HTML(string(n.Site.BaseUrl) + "404.html")
+ n.Permalink = HTML(string(n.Site.BaseUrl) + "404.html")
x, err := s.RenderThing(n, "404.html")
if err != nil {
return err