package atom
import (
"bytes"
"encoding/xml"
"net/url"
"time"
"github.com/Southclaws/fault"
"alin.ovh/homestead/shared/config"
)
type Link struct {
XMLName xml.Name `xml:"link"`
Rel string `xml:"rel,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
Href string `xml:"href,attr"`
}
type FeedContent struct {
Content string `xml:",chardata"`
Type string `xml:"type,attr"`
}
type FeedEntry struct {
XMLName xml.Name `xml:"entry"`
Title string `xml:"title"`
Link Link `xml:"link"`
ID string `xml:"id"`
Updated time.Time `xml:"updated"`
Summary string `xml:"summary,omitempty"`
Content FeedContent `xml:"content"`
Author string `xml:"author>name"`
}
type Feed struct {
XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed"`
Title string `xml:"title"`
Link Link `xml:"link"`
ID string `xml:"id"`
Updated time.Time `xml:"updated"`
Entries []*FeedEntry `xml:"entry"`
}
func MakeTagURI(config *config.Config, specific string) string {
return "tag:" + config.OriginalDomain + "," + config.DomainStartDate + ":" + specific
}
func LinkXSL(w *bytes.Buffer, url string) error {
_, err := w.WriteString(``)
if err != nil {
return fault.Wrap(err)
}
return nil
}
func MakeLink(url *url.URL) Link {
return Link{
Rel: "alternate",
Type: "text/html",
Href: url.String(),
}
}
domain/indieweb/atom/atom.go (view raw)