mirror of
https://github.com/miniflux/v2.git
synced 2025-07-02 16:38:37 +00:00
Improve OPML package to be more idiomatic
This commit is contained in:
parent
e91a9b4f13
commit
c26787f476
7 changed files with 50 additions and 40 deletions
|
@ -14,14 +14,14 @@ import (
|
|||
|
||||
// Parse reads an OPML file and returns a SubcriptionList.
|
||||
func Parse(data io.Reader) (SubcriptionList, error) {
|
||||
opml := new(Opml)
|
||||
feeds := new(opml)
|
||||
decoder := xml.NewDecoder(data)
|
||||
decoder.CharsetReader = charset.NewReaderLabel
|
||||
|
||||
err := decoder.Decode(opml)
|
||||
err := decoder.Decode(feeds)
|
||||
if err != nil {
|
||||
return nil, errors.NewLocalizedError("Unable to parse OPML file: %v.", err)
|
||||
}
|
||||
|
||||
return opml.Transform(), nil
|
||||
return feeds.Transform(), nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue