From 4dfd72e68c385a6f02370e38831f33e644276055 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 17 Apr 2024 20:31:14 +0200 Subject: use internal imports correctly --- internal/atom/atom.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 internal/atom/atom.go (limited to 'internal') diff --git a/internal/atom/atom.go b/internal/atom/atom.go new file mode 100644 index 0000000..f2ca4a9 --- /dev/null +++ b/internal/atom/atom.go @@ -0,0 +1,43 @@ +package atom + +import ( + "encoding/xml" + "time" + + . "website/internal/config" +) + +func MakeTagURI(config Config, specific string) string { + return "tag:" + config.OriginalDomain + "," + config.DomainStartDate + ":" + specific +} + +type Link struct { + XMLName xml.Name `xml:"link"` + Rel string `xml:"rel,attr"` + Type string `xml:"type,attr"` + Href string `xml:"href,attr"` +} + +func MakeLink(url string) Link { + return Link{ + Rel: "alternate", + Type: "text/html", + Href: url, + } +} + +type FeedContent struct { + Content string `xml:",innerxml"` + 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"` +} -- cgit 1.4.1