mirror of
https://github.com/gohugoio/hugo.git
synced 2025-03-23 09:53:39 +00:00
Moving processing short codes to the page
This commit is contained in:
parent
d0ef3d43bd
commit
0e04b9a029
2 changed files with 7 additions and 10 deletions
|
@ -240,6 +240,11 @@ func ReadFrom(buf io.Reader, name string) (page *Page, err error) {
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Page) ProcessShortcodes(t bundle.Template) {
|
||||||
|
p.Content = template.HTML(ShortcodesHandle(string(p.Content), p, t))
|
||||||
|
p.Summary = template.HTML(ShortcodesHandle(string(p.Summary), p, t))
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Page) analyzePage() {
|
func (p *Page) analyzePage() {
|
||||||
p.WordCount = TotalWords(p.Plain())
|
p.WordCount = TotalWords(p.Plain())
|
||||||
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
p.FuzzyWordCount = int((p.WordCount+100)/100) * 100
|
||||||
|
|
|
@ -264,13 +264,6 @@ func (s *Site) checkDirectories() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Site) ProcessShortcodes() {
|
|
||||||
for _, page := range s.Pages {
|
|
||||||
page.Content = template.HTML(ShortcodesHandle(string(page.Content), page, s.Tmpl))
|
|
||||||
page.Summary = template.HTML(ShortcodesHandle(string(page.Summary), page, s.Tmpl))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Site) CreatePages() (err error) {
|
func (s *Site) CreatePages() (err error) {
|
||||||
if s.Source == nil {
|
if s.Source == nil {
|
||||||
panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
|
panic(fmt.Sprintf("s.Source not set %s", s.absContentDir()))
|
||||||
|
@ -288,9 +281,8 @@ func (s *Site) CreatePages() (err error) {
|
||||||
page.Section = file.Section
|
page.Section = file.Section
|
||||||
page.Dir = file.Dir
|
page.Dir = file.Dir
|
||||||
|
|
||||||
// Handling short codes prior to Conversion to HTML
|
//Handling short codes prior to Conversion to HTML
|
||||||
page.Content = template.HTML(ShortcodesHandle(string(page.Content), page, s.Tmpl))
|
page.ProcessShortcodes(s.Tmpl)
|
||||||
page.Summary = template.HTML(ShortcodesHandle(string(page.Summary), page, s.Tmpl))
|
|
||||||
|
|
||||||
err = page.Convert()
|
err = page.Convert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue