diff options
Diffstat (limited to 'page')
| -rw-r--r-- | page/atom.go | 31 | ||||
| -rw-r--r-- | page/page.go | 9 | ||||
| -rw-r--r-- | page/time.go | 5 |
3 files changed, 45 insertions, 0 deletions
diff --git a/page/atom.go b/page/atom.go new file mode 100644 index 0000000..4a89117 --- /dev/null +++ b/page/atom.go @@ -0,0 +1,31 @@ +package page + +/* + +import ( + "github.com/gorilla/feeds" + "io" +) + +// Atom returns an Atom feed for all of the articles with the specified tag +func (p *Page) Atom(wr io.Writer, tag string) error { + index, err := p.Index() + if err != nil { + return err + } + + pages, ok := index[tag] + if !ok { + pages = PageList{} + } + + feed := &feeds.Feed{ + Title: "", + Link: &feeds.Link{Href: "http://jmoiron.net/blog"}, + Description: "discussion about tech, footie, photos", + Author: &feeds.Author{Name: "Jason Moiron", Email: "jmoiron@jmoiron.net"}, + Created: now, + } + +} +*/ diff --git a/page/page.go b/page/page.go index 82f46f2..ecd2268 100644 --- a/page/page.go +++ b/page/page.go @@ -25,6 +25,7 @@ package page import ( "bufio" "bytes" + "encoding/json" "fmt" "io" "log" @@ -45,6 +46,8 @@ type Page struct { Title string Head string Description string + AuthorName string + AuthorEmail string // Tags to apply to the page in question. Useful for Index() Tags map[string]interface{} Date *PageTime @@ -209,3 +212,9 @@ func (p *Page) RenderBody() (string, error) { func (p Page) String() string { return fmt.Sprintf("Page: %s", p.path) } + +// StringDetail prints a detailed string of the page +func (p Page) StringDetail() string { + b, _ := json.MarshalIndent(p, "", " ") + return fmt.Sprintf("Page: %s\n%s\n", p.path, b) +} diff --git a/page/time.go b/page/time.go index 958dc38..0374490 100644 --- a/page/time.go +++ b/page/time.go @@ -21,3 +21,8 @@ func (pt *PageTime) UnmarshalYAML(n *yaml.Node) error { pt.Time = t return nil } + +func (pt PageTime) MarshalYAML() (interface{}, error) { + s := pt.Time.Format(TimeFormat) + return s, nil +} |
