@@ -18,8 +18,15 @@ type AtomPerson struct {
18
18
}
19
19
20
20
type AtomSummary struct {
21
- Content string `xml:",chardata"`
22
- Type string `xml:"type,attr"`
21
+ XMLName xml.Name `xml:"summary"`
22
+ Content string `xml:",chardata"`
23
+ Type string `xml:"type,attr"`
24
+ }
25
+
26
+ type AtomContent struct {
27
+ XMLName xml.Name `xml:"content"`
28
+ Content string `xml:",chardata"`
29
+ Type string `xml:"type,attr"`
23
30
}
24
31
25
32
type AtomAuthor struct {
@@ -38,10 +45,10 @@ type AtomEntry struct {
38
45
Updated string `xml:"updated"` // required
39
46
Id string `xml:"id"` // required
40
47
Category string `xml:"category,omitempty"`
41
- Content string `xml:"content,omitempty"`
42
- Rights string `xml:"rights,omitempty"`
43
- Source string `xml:"source,omitempty"`
44
- Published string `xml:"published,omitempty"`
48
+ Content * AtomContent
49
+ Rights string `xml:"rights,omitempty"`
50
+ Source string `xml:"source,omitempty"`
51
+ Published string `xml:"published,omitempty"`
45
52
Contributor * AtomContributor
46
53
Link * AtomLink // required if no child 'content' elements
47
54
Summary * AtomSummary // required if content has src or content is base64
@@ -78,7 +85,7 @@ type Atom struct {
78
85
func newAtomEntry (i * Item ) * AtomEntry {
79
86
id := i .Id
80
87
// assume the description is html
81
- s := & AtomSummary { i .Description , "html" }
88
+ c := & AtomContent { Content : i .Description , Type : "html" }
82
89
83
90
if len (id ) == 0 {
84
91
// if there's no id set, try to create one, either from data or just a uuid
@@ -101,7 +108,7 @@ func newAtomEntry(i *Item) *AtomEntry {
101
108
x := & AtomEntry {
102
109
Title : i .Title ,
103
110
Link : & AtomLink {Href : i .Link .Href , Rel : i .Link .Rel },
104
- Summary : s ,
111
+ Content : c ,
105
112
Id : id ,
106
113
Updated : anyTimeFormat (time .RFC3339 , i .Updated , i .Created ),
107
114
}
0 commit comments