Merge pull request #31 from escholtz/omit-empty-atom-feed-author

[bugfix] Omit Author from Atom XML output when it is empty.
This commit is contained in:
Matt Silverlock
2016-02-07 08:09:34 -08:00
+1 -3
View File
@@ -78,7 +78,7 @@ type AtomFeed struct {
Rights string `xml:"rights,omitempty"` // copyright used
Subtitle string `xml:"subtitle,omitempty"`
Link *AtomLink
Author *AtomAuthor // required
Author *AtomAuthor `xml:"author,omitempty"`
Contributor *AtomContributor
Entries []*AtomEntry
}
@@ -145,8 +145,6 @@ func (a *Atom) AtomFeed() *AtomFeed {
}
if a.Author != nil {
feed.Author = &AtomAuthor{AtomPerson: AtomPerson{Name: a.Author.Name, Email: a.Author.Email}}
} else {
feed.Author = &AtomAuthor{AtomPerson: AtomPerson{Name: "", Email: ""}}
}
for _, e := range a.Items {
feed.Entries = append(feed.Entries, newAtomEntry(e))