mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 15:28:49 +01:00
🎨 Add block content statistics template function statBlock https://github.com/siyuan-note/siyuan/issues/13438
This commit is contained in:
parent
e2017a9fba
commit
11d3516aa7
6 changed files with 237 additions and 167 deletions
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/logging"
|
||||
"github.com/siyuan-note/siyuan/kernel/av"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/search"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/treenode"
|
||||
|
|
@ -43,7 +44,7 @@ import (
|
|||
|
||||
func RenderGoTemplate(templateContent string) (ret string, err error) {
|
||||
tmpl := template.New("")
|
||||
tplFuncMap := treenode.BuiltInTemplateFuncs()
|
||||
tplFuncMap := filesys.BuiltInTemplateFuncs()
|
||||
sql.SQLTemplateFuncs(&tplFuncMap)
|
||||
tmpl = tmpl.Funcs(tplFuncMap)
|
||||
tpl, err := tmpl.Parse(templateContent)
|
||||
|
|
@ -254,7 +255,7 @@ func RenderDynamicIconContentTemplate(content, id string) (ret string) {
|
|||
dataModel["alias"] = block.Alias
|
||||
|
||||
goTpl := template.New("").Delims(".action{", "}")
|
||||
tplFuncMap := treenode.BuiltInTemplateFuncs()
|
||||
tplFuncMap := filesys.BuiltInTemplateFuncs()
|
||||
sql.SQLTemplateFuncs(&tplFuncMap)
|
||||
goTpl = goTpl.Funcs(tplFuncMap)
|
||||
tpl, err := goTpl.Funcs(tplFuncMap).Parse(content)
|
||||
|
|
@ -304,7 +305,7 @@ func RenderTemplate(p, id string, preview bool) (tree *parse.Tree, dom string, e
|
|||
}
|
||||
|
||||
goTpl := template.New("").Delims(".action{", "}")
|
||||
tplFuncMap := treenode.BuiltInTemplateFuncs()
|
||||
tplFuncMap := filesys.BuiltInTemplateFuncs()
|
||||
sql.SQLTemplateFuncs(&tplFuncMap)
|
||||
goTpl = goTpl.Funcs(tplFuncMap)
|
||||
tpl, err := goTpl.Funcs(tplFuncMap).Parse(gulu.Str.FromBytes(md))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue