Skip to content

Commit

Permalink
🎨 Change database template column custom attribute action Fix #9401
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Oct 12, 2023
1 parent b8e8aa0 commit 92151f7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions kernel/model/attribute_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func renderTemplateCol(ial map[string]string, tplContent string, rowValues []*av

funcMap := sprig.TxtFuncMap()
goTpl := template.New("").Delims(".action{", "}")
tplContent = strings.ReplaceAll(tplContent, ".custom-", ".custom_") // 模板中的属性名不允许包含 - 字符,因此这里需要替换
tpl, tplErr := goTpl.Funcs(funcMap).Parse(tplContent)
if nil != tplErr {
logging.LogWarnf("parse template [%s] failed: %s", tplContent, tplErr)
Expand All @@ -61,7 +60,7 @@ func renderTemplateCol(ial map[string]string, tplContent string, rowValues []*av
buf := &bytes.Buffer{}
dataModel := map[string]interface{}{} // 复制一份 IAL 以避免修改原始数据
for k, v := range ial {
dataModel[strings.ReplaceAll(k, "custom-", "custom_")] = v
dataModel[k] = v

// Database template column supports `created` and `updated` built-in variables https://github.com/siyuan-note/siyuan/issues/9364
createdStr := ial["id"]
Expand Down

0 comments on commit 92151f7

Please sign in to comment.