mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-26 17:04:07 +01:00
🎨 Attribute View export https://github.com/siyuan-note/siyuan/issues/8710
This commit is contained in:
parent
8a49a6b71f
commit
16cb93d730
2 changed files with 104 additions and 0 deletions
|
|
@ -109,6 +109,33 @@ type Value struct {
|
|||
Phone *ValuePhone `json:"phone,omitempty"`
|
||||
}
|
||||
|
||||
func (value *Value) String() string {
|
||||
switch value.Type {
|
||||
case KeyTypeBlock:
|
||||
return value.Block.Content
|
||||
case KeyTypeText:
|
||||
return value.Text.Content
|
||||
case KeyTypeNumber:
|
||||
return value.Number.FormattedContent
|
||||
case KeyTypeDate:
|
||||
return value.Date.FormattedContent
|
||||
case KeyTypeMSelect:
|
||||
var ret []string
|
||||
for _, v := range value.MSelect {
|
||||
ret = append(ret, v.Content)
|
||||
}
|
||||
return strings.Join(ret, " ")
|
||||
case KeyTypeURL:
|
||||
return value.URL.Content
|
||||
case KeyTypeEmail:
|
||||
return value.Email.Content
|
||||
case KeyTypePhone:
|
||||
return value.Phone.Content
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (value *Value) ToJSONString() string {
|
||||
data, err := gulu.JSON.MarshalJSON(value)
|
||||
if nil != err {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue