mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve HTML content rendering for database template fields https://github.com/siyuan-note/siyuan/issues/16362
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
d15f957239
commit
8cfae95f29
2 changed files with 32 additions and 2 deletions
|
|
@ -111,7 +111,7 @@ func renderView(attrView *av.AttributeView, view *av.View, query string, depth *
|
|||
return
|
||||
}
|
||||
|
||||
func RenderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplContent string) (ret string, err error) {
|
||||
func renderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplContent string) (ret string, err error) {
|
||||
if "" == ial["id"] {
|
||||
block := getBlockValue(keyValues)
|
||||
if nil != block {
|
||||
|
|
@ -267,6 +267,11 @@ func RenderTemplateField(ial map[string]string, keyValues []*av.KeyValues, tplCo
|
|||
ret = buf.String()
|
||||
if ret == "<no value>" {
|
||||
ret = ""
|
||||
return
|
||||
}
|
||||
|
||||
if util.HasUnclosedHtmlTag(ret) {
|
||||
ret = util.EscapeHTML(ret)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
@ -623,7 +628,7 @@ func fillAttributeViewTemplateValues(attrView *av.AttributeView, view *av.View,
|
|||
ial = map[string]string{}
|
||||
}
|
||||
|
||||
content, renderErr := RenderTemplateField(ial, keyValues, value.Template.Content)
|
||||
content, renderErr := renderTemplateField(ial, keyValues, value.Template.Content)
|
||||
if nil != renderErr {
|
||||
key, _ := attrView.GetKey(value.KeyID)
|
||||
keyName := ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue