🎨 The database template column supports queryBlocks function https://github.com/siyuan-note/siyuan/issues/10077

This commit is contained in:
Daniel 2024-01-04 22:31:42 +08:00
parent 20cd2ac696
commit 108bdec5f6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 44 additions and 38 deletions

View file

@ -963,8 +963,10 @@ func renderTemplateCol(ial map[string]string, tplContent string, rowValues []*av
}
goTpl := template.New("").Delims(".action{", "}")
funcMap := util.BuiltInTemplateFuncs()
tpl, tplErr := goTpl.Funcs(funcMap).Parse(tplContent)
tplFuncMap := util.BuiltInTemplateFuncs()
// 这里存在依赖问题所以不支持 SQLTemplateFuncs(&tplFuncMap)
goTpl = goTpl.Funcs(tplFuncMap)
tpl, tplErr := goTpl.Funcs(tplFuncMap).Parse(tplContent)
if nil != tplErr {
logging.LogWarnf("parse template [%s] failed: %s", tplContent, tplErr)
return ""