atomus

package module
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 5 Imported by: 2

README

atomic

Convenience package to create Atom feed

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Title string `xml:"title"` // <title>Atom-Powered Robots Run Amok</title>
	Link  *Link  `xml:"link,omitempty"`
	// <link href="http://example.org/2003/12/13/atom03" />
	// <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>
	// <link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>
	Id        string `xml:"id"`        // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
	Published string `xml:"published"` // <published>2003-11-09T17:23:02Z</published>
	Updated   string `xml:"updated"`   // <updated>2003-12-13T18:30:02Z</updated>
	// <summary>Some text.</summary>
	Author  *EntryAuthor  `xml:"author"`
	Content *EntryContent `xml:"content"`
}

type EntryAuthor

type EntryAuthor struct {
	XMLName xml.Name `xml:"author"`
	Name    string   `xml:"name"`            // <name>John Doe</name>
	Email   string   `xml:"email,omitempty"` // <email>johndoe@example.com</email>
}

type EntryContent

type EntryContent struct {
	XMLName xml.Name `xml:"content"`
	Type    string   `xml:"type,attr"`
	Content string   `xml:",cdata"`
}

type Feed

type Feed struct {
	XMLName      xml.Name `xml:"feed"` // <feed xmlns="http://www.w3.org/2005/Atom">
	XMLNamespace string   `xml:"xmlns,attr"`
	Title        string   `xml:"title"` // <title>Example Feed</title>
	//Subtitle     string   `xml:"subtitle,omitempty"`
	Link    *Link  `xml:"link,omitempty"` //<link href="http://example.org/" />
	Updated string `xml:"updated"`        // <updated>2003-12-13T18:30:02Z</updated>
	Entry   *Entry `xml:"entry"`
}

func NewFeed

func NewFeed(title, link string) *Feed

func (*Feed) Encode

func (f *Feed) Encode(w io.Writer) error

func (*Feed) SetEntry

func (f *Feed) SetEntry(title, author, link, content string)
type Link struct {
	XMLName xml.Name `xml:"link"`
	Href    string   `xml:"href,attr"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL