diff options
author | 2024-03-15 18:04:24 -0700 | |
---|---|---|
committer | 2024-03-15 18:40:06 -0700 | |
commit | 4834e934f2cf57b106923bd37d62d6c5f6f39f1f (patch) | |
tree | 0674e4bfb3210aef67d3afd4a51a9cd07fb31fc6 /internal/reader/rss/atom.go | |
parent | dd4fb660c19fd1f6ce5716f9f5783eb7565fed2d (diff) | |
download | v2-4834e934f2cf57b106923bd37d62d6c5f6f39f1f.tar.gz v2-4834e934f2cf57b106923bd37d62d6c5f6f39f1f.tar.zst v2-4834e934f2cf57b106923bd37d62d6c5f6f39f1f.zip |
Remove some duplicated code in RSS parser
Diffstat (limited to 'internal/reader/rss/atom.go')
-rw-r--r-- | internal/reader/rss/atom.go | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/internal/reader/rss/atom.go b/internal/reader/rss/atom.go index e0d66910..27dade47 100644 --- a/internal/reader/rss/atom.go +++ b/internal/reader/rss/atom.go @@ -3,41 +3,18 @@ package rss // import "miniflux.app/v2/internal/reader/rss" -import "strings" +import ( + "miniflux.app/v2/internal/reader/atom" +) type AtomAuthor struct { - Author AtomPerson `xml:"http://www.w3.org/2005/Atom author"` + Author atom.AtomPerson `xml:"http://www.w3.org/2005/Atom author"` } -func (a *AtomAuthor) String() string { - return a.Author.String() -} - -type AtomPerson struct { - Name string `xml:"name"` - Email string `xml:"email"` -} - -func (a *AtomPerson) String() string { - var name string - - switch { - case a.Name != "": - name = a.Name - case a.Email != "": - name = a.Email - } - - return strings.TrimSpace(name) -} - -type AtomLink struct { - URL string `xml:"href,attr"` - Type string `xml:"type,attr"` - Rel string `xml:"rel,attr"` - Length string `xml:"length,attr"` +func (a *AtomAuthor) PersonName() string { + return a.Author.PersonName() } type AtomLinks struct { - Links []*AtomLink `xml:"http://www.w3.org/2005/Atom link"` + Links []*atom.AtomLink `xml:"http://www.w3.org/2005/Atom link"` } |