atom.go 865 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package rss // import "miniflux.app/v2/internal/reader/rss"
  4. import "strings"
  5. type AtomAuthor struct {
  6. Author AtomPerson `xml:"http://www.w3.org/2005/Atom author"`
  7. }
  8. func (a *AtomAuthor) String() string {
  9. return a.Author.String()
  10. }
  11. type AtomPerson struct {
  12. Name string `xml:"name"`
  13. Email string `xml:"email"`
  14. }
  15. func (a *AtomPerson) String() string {
  16. var name string
  17. switch {
  18. case a.Name != "":
  19. name = a.Name
  20. case a.Email != "":
  21. name = a.Email
  22. }
  23. return strings.TrimSpace(name)
  24. }
  25. type AtomLink struct {
  26. URL string `xml:"href,attr"`
  27. Type string `xml:"type,attr"`
  28. Rel string `xml:"rel,attr"`
  29. Length string `xml:"length,attr"`
  30. }
  31. type AtomLinks struct {
  32. Links []*AtomLink `xml:"http://www.w3.org/2005/Atom link"`
  33. }