Add render template hooks for links and images

This commit also

* revises the change detection for templates used by content files in server mode.
* Adds a Page.RenderString method

Fixes #6545
Fixes #4663
Closes #6043
This commit is contained in:
Bjørn Erik Pedersen 2019-11-27 13:42:36 +01:00
parent 67f3aa72cf
commit e625088ef5
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
59 changed files with 2234 additions and 542 deletions

View file

@ -54,3 +54,22 @@ func (p *pageForShortcode) TableOfContents() template.HTML {
p.p.enablePlaceholders()
return p.toc
}
// This is what is sent into the content render hooks (link, image).
type pageForRenderHooks struct {
page.PageWithoutContent
page.TableOfContentsProvider
page.ContentProvider
}
func newPageForRenderHook(p *pageState) page.Page {
return &pageForRenderHooks{
PageWithoutContent: p,
ContentProvider: page.NopPage,
TableOfContentsProvider: page.NopPage,
}
}
func (p *pageForRenderHooks) page() page.Page {
return p.PageWithoutContent.(page.Page)
}