Add shortcode support for HTML files

Fixes #674
This commit is contained in:
bep 2015-05-06 19:11:33 +02:00
parent bea9280fb3
commit bec2c1e37a

View file

@ -82,9 +82,22 @@ type htmlHandler struct {
func (h htmlHandler) Extensions() []string { return []string{"html", "htm"} }
func (h htmlHandler) PageConvert(p *Page, t tpl.Template) HandledResult {
// see #674 - disabled by bjornerik for now
// p.ProcessShortcodes(t)
p.Content = helpers.BytesToHTML(p.rawContent)
p.ProcessShortcodes(t)
var content []byte
var err error
if len(p.contentShortCodes) > 0 {
content, err = replaceShortcodeTokens(p.rawContent, shortcodePlaceholderPrefix, true, p.contentShortCodes)
if err != nil {
jww.FATAL.Printf("Fail to replace shortcode tokens in %s:\n%s", p.BaseFileName(), err.Error())
return HandledResult{err: err}
}
} else {
content = p.rawContent
}
p.Content = helpers.BytesToHTML(content)
return HandledResult{err: nil}
}