Skip to content

Commit

Permalink
Merge pull request SlyMarbo#4 from haldean/master
Browse files Browse the repository at this point in the history
Fix link href extraction to work with Go 1.1
  • Loading branch information
SlyMarbo committed Jul 22, 2013
2 parents 8a2b75a + d9bfe30 commit b9bc2db
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions atom.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func parseAtom(data []byte, read *db) (*Feed, error) {
out := new(Feed)
out.Title = feed.Title
out.Description = feed.Description
out.Link = feed.Link
out.Link = feed.Link.Href
out.Image = feed.Image.Image()
out.Refresh = time.Now().Add(10 * time.Minute)

Expand All @@ -41,7 +41,7 @@ func parseAtom(data []byte, read *db) (*Feed, error) {
next := new(Item)
next.Title = item.Title
next.Content = item.Content
next.Link = item.Link
next.Link = item.Link.Href
if item.Date != "" {
next.Date, err = parseTime(item.Date)
if err != nil {
Expand Down Expand Up @@ -73,7 +73,7 @@ type atomFeed struct {
XMLName xml.Name `xml:"feed"`
Title string `xml:"title"`
Description string `xml:"subtitle"`
Link string `xml:"link>href,attr"`
Link atomLink `xml:"link"`
Image atomImage `xml:"image"`
Items []atomItem `xml:"entry"`
Updated string `xml:"updated"`
Expand All @@ -83,7 +83,7 @@ type atomItem struct {
XMLName xml.Name `xml:"entry"`
Title string `xml:"title"`
Content string `xml:"summary"`
Link string `xml:"link>href,attr"`
Link atomLink `xml:"link"`
Date string `xml:"updated"`
ID string `xml:"id"`
}
Expand All @@ -96,6 +96,10 @@ type atomImage struct {
Width int `xml:"width"`
}

type atomLink struct {
Href string `xml:"href,attr"`
}

func (a *atomImage) Image() *Image {
out := new(Image)
out.Title = a.Title
Expand Down

0 comments on commit b9bc2db

Please sign in to comment.