From b4bded40e3a5134e4387b090c56f83567a8942ab Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 1 Oct 2023 18:24:16 +0800 Subject: [PATCH] :art: Add template type column to Attribute View https://github.com/siyuan-note/siyuan/issues/8766 --- kernel/model/attribute_view.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.go index 3846ebe8d..d5814b7c5 100644 --- a/kernel/model/attribute_view.go +++ b/kernel/model/attribute_view.go @@ -237,7 +237,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a funcMap := sprig.TxtFuncMap() goTpl := template.New("").Delims(".action{", "}") tplContent := col.Template - tplContent = strings.ReplaceAll(tplContent, ".custom-", ".custom_") + 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) @@ -246,7 +246,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View) (ret *a buf := &bytes.Buffer{} ial := GetBlockAttrs(blockID) - dataModel := map[string]string{} + dataModel := map[string]string{} // 复制一份 IAL 以避免修改原始数据 for k, v := range ial { dataModel[strings.ReplaceAll(k, "custom-", "custom_")] = v }