mirror of
https://github.com/miniflux/v2.git
synced 2024-09-29 22:02:01 +02:00
fix: Include type for OPML subscriptions
As per [OPML 2.0 specification]: > Each sub-element of the body of the OPML document is a node of type rss or an outline element that contains nodes of type rss. > Required attributes: type, text, xmlUrl. [OPML 2.0 specification]: http://opml.org/spec2.opml#subscriptionLists
This commit is contained in:
parent
538e5305d3
commit
074393d3bf
@ -34,6 +34,23 @@ type opmlOutline struct {
|
|||||||
Outlines opmlOutlineCollection `xml:"outline,omitempty"`
|
Outlines opmlOutlineCollection `xml:"outline,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (outline opmlOutline) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||||
|
type opmlOutlineXml opmlOutline
|
||||||
|
|
||||||
|
outlineType := ""
|
||||||
|
if outline.IsSubscription() {
|
||||||
|
outlineType = "rss"
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.EncodeElement(struct {
|
||||||
|
opmlOutlineXml
|
||||||
|
Type string `xml:"type,attr,omitempty"`
|
||||||
|
}{
|
||||||
|
opmlOutlineXml: opmlOutlineXml(outline),
|
||||||
|
Type: outlineType,
|
||||||
|
}, start)
|
||||||
|
}
|
||||||
|
|
||||||
func (o *opmlOutline) IsSubscription() bool {
|
func (o *opmlOutline) IsSubscription() bool {
|
||||||
return strings.TrimSpace(o.FeedURL) != ""
|
return strings.TrimSpace(o.FeedURL) != ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user