🎨 Database template fields support access by ID https://github.com/siyuan-note/siyuan/issues/11237

This commit is contained in:
Daniel 2025-05-29 17:31:40 +08:00
parent a26823a84c
commit e66b669dc3
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -479,8 +479,8 @@ func RenderTemplateCol(ial map[string]string, rowValues []*av.KeyValues, tplCont
}
}
dataModel["id"] = map[string]any{}
dataModel["id_raw"] = map[string]any{}
dataModel["id_mod"] = map[string]any{}
dataModel["id_mod_raw"] = map[string]any{}
for _, rowValue := range rowValues {
if 1 > len(rowValue.Values) {
continue
@ -548,8 +548,8 @@ func RenderTemplateCol(ial map[string]string, rowValues []*av.KeyValues, tplCont
dataModel[rowValue.Key.Name+"_raw"] = v
// Database template fields support access by ID https://github.com/siyuan-note/siyuan/issues/11237
dataModel["id"].(map[string]any)[rowValue.Key.ID] = dataModel[rowValue.Key.Name]
dataModel["id_raw"].(map[string]any)[rowValue.Key.ID] = v
dataModel["id_mod"].(map[string]any)[rowValue.Key.ID] = dataModel[rowValue.Key.Name]
dataModel["id_mod_raw"].(map[string]any)[rowValue.Key.ID] = v
}
if err = tpl.Execute(buf, dataModel); err != nil {