Add Scratch to shortcode

Fixes #2000
This commit is contained in:
Bjørn Erik Pedersen
2016-03-21 11:10:57 +01:00
committed by Steve Francia
parent de8fc8761a
commit 048e07422d
2 changed files with 9 additions and 4 deletions

View File

@@ -36,6 +36,7 @@ type ShortcodeWithPage struct {
Page *Page
Parent *ShortcodeWithPage
IsNamedParams bool
scratch *Scratch
}
func (scp *ShortcodeWithPage) Site() *SiteInfo {
@@ -51,7 +52,10 @@ func (scp *ShortcodeWithPage) RelRef(ref string) (string, error) {
}
func (scp *ShortcodeWithPage) Scratch() *Scratch {
return scp.Page.Scratch()
if scp.scratch == nil {
scp.scratch = newScratch()
}
return scp.scratch
}
func (scp *ShortcodeWithPage) Get(key interface{}) interface{} {