Add items to items
This commit is contained in:
parent
07a3c1b1e3
commit
5c4144444a
|
|
@ -169,16 +169,21 @@ func simplify(itemType string, item map[string][]interface{}, author map[string]
|
||||||
return feedItem
|
return feedItem
|
||||||
}
|
}
|
||||||
func simplifyCard(v []interface{}) (map[string]string, error) {
|
func simplifyCard(v []interface{}) (map[string]string, error) {
|
||||||
|
card := make(map[string]string)
|
||||||
|
card["type"] = "card"
|
||||||
|
|
||||||
if value, ok := v[0].(*microformats.Microformat); ok {
|
if value, ok := v[0].(*microformats.Microformat); ok {
|
||||||
card := make(map[string]string)
|
|
||||||
card["type"] = "card"
|
|
||||||
for ik, vk := range value.Properties {
|
for ik, vk := range value.Properties {
|
||||||
if p, ok := vk[0].(string); ok {
|
if p, ok := vk[0].(string); ok {
|
||||||
card[ik] = p
|
card[ik] = p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return card, nil
|
return card, nil
|
||||||
|
} else if value, ok := v[0].(string); ok {
|
||||||
|
card["url"] = value
|
||||||
|
return card, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("not convertable to a card %q", v)
|
return nil, fmt.Errorf("not convertable to a card %q", v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,9 +231,9 @@ func SimplifyMicroformatData(md *microformats.Data) []map[string]interface{} {
|
||||||
|
|
||||||
newItem := SimplifyMicroformat(item, nil)
|
newItem := SimplifyMicroformat(item, nil)
|
||||||
delete(newItem, "children")
|
delete(newItem, "children")
|
||||||
// if newItem["type"] == "entry" || newItem["type"] == "event" || newItem["type"] == "card" {
|
if newItem["type"] == "entry" || newItem["type"] == "event" || newItem["type"] == "card" {
|
||||||
// items = append(items, newItem)
|
items = append(items, newItem)
|
||||||
// }
|
}
|
||||||
// if c, e := newItem["children"]; e {
|
// if c, e := newItem["children"]; e {
|
||||||
// if ar, ok := c.([]map[string]interface{}); ok {
|
// if ar, ok := c.([]map[string]interface{}); ok {
|
||||||
// for _, item := range ar {
|
// for _, item := range ar {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user