aboutsummaryrefslogtreecommitdiffhomepage
path: root/reader/opml/opml.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-03-26 19:49:59 -0700
committerGravatar fguillot <fred@miniflux.net>2019-03-26 20:09:31 -0700
commit129f1bf3da188756c8c2ab6c894457e55987af5a (patch)
treead6acd274e1b67f03fa4f8f5ec2699e06cbe3790 /reader/opml/opml.go
parent304b43cb308f326e2a5a5cda6fa886906b6c4f83 (diff)
Add support for OPML v1 import
Diffstat (limited to 'reader/opml/opml.go')
-rw-r--r--reader/opml/opml.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/reader/opml/opml.go b/reader/opml/opml.go
index 27d0167..76d6193 100644
--- a/reader/opml/opml.go
+++ b/reader/opml/opml.go
@@ -4,7 +4,9 @@
package opml // import "miniflux.app/reader/opml"
-import "encoding/xml"
+import (
+ "encoding/xml"
+)
type opml struct {
XMLName xml.Name `xml:"opml"`
@@ -48,10 +50,6 @@ func (o *outline) GetSiteURL() string {
return o.FeedURL
}
-func (o *outline) IsCategory() bool {
- return o.Text != "" && o.SiteURL == "" && o.FeedURL == ""
-}
-
func (o *outline) Append(subscriptions SubcriptionList, category string) SubcriptionList {
if o.FeedURL != "" {
subscriptions = append(subscriptions, &Subcription{
@@ -67,10 +65,10 @@ func (o *outline) Append(subscriptions SubcriptionList, category string) Subcrip
func (o *opml) Transform() SubcriptionList {
var subscriptions SubcriptionList
-
for _, outline := range o.Outlines {
- if outline.IsCategory() {
+ if len(outline.Outlines) > 0 {
for _, element := range outline.Outlines {
+ // outline.Text is only available in OPML v2.
subscriptions = element.Append(subscriptions, outline.Text)
}
} else {