-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package atom | ||
|
||
import ( | ||
"encoding/xml" | ||
"time" | ||
) | ||
|
||
type Feed struct { | ||
XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed"` | ||
Title string `xml:"title"` | ||
ID string `xml:"id"` | ||
Links []Link `xml:"link"` | ||
Updated TimeStr `xml:"updated"` | ||
Author *Person `xml:"author"` | ||
Entries []*Entry `xml:"entry"` | ||
} | ||
|
||
type Entry struct { | ||
Title string `xml:"title"` | ||
ID string `xml:"id"` | ||
Links []Link `xml:"link"` | ||
Published TimeStr `xml:"published"` | ||
Updated TimeStr `xml:"updated"` | ||
Author *Person `xml:"author"` | ||
Summary *Text `xml:"summary,omitempty"` | ||
Content *Text `xml:"content,omitempty"` | ||
} | ||
|
||
type Link struct { | ||
Rel string `xml:"rel,attr,omitempty"` | ||
Href string `xml:"href,attr"` | ||
Type string `xml:"type,attr,omitempty"` | ||
HrefLang string `xml:"hreflang,attr,omitempty"` | ||
Title string `xml:"title,attr,omitempty"` | ||
Length uint `xml:"length,attr,omitempty"` | ||
} | ||
|
||
type Person struct { | ||
Name string `xml:"name"` | ||
URI string `xml:"uri,omitempty"` | ||
Email string `xml:"email,omitempty"` | ||
InnerXML string `xml:",innerxml"` | ||
} | ||
|
||
type Text struct { | ||
Type string `xml:"type,attr"` | ||
Body string `xml:",chardata"` | ||
} | ||
|
||
type TimeStr string | ||
|
||
func Time(t time.Time) TimeStr { | ||
return TimeStr(t.Format("2006-01-02T15:04:05-07:00")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
name = "My Planet!" | ||
url = "http://localhost/" | ||
feed_id = "uri:urn:5c71947a-107d-4a3d-b635-2bac0cbcd8ba" | ||
owner = "Chidi Anagonye" | ||
email = "[email protected]" | ||
cache = "./cache" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters