atom

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package atom generates Atom feed output from aggregated entries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string `xml:"name"`
	Email string `xml:"email,omitempty"`
	URI   string `xml:"uri,omitempty"`
}

Author represents an Atom author element.

type Category

type Category struct {
	Term string `xml:"term,attr"`
}

Category represents an Atom category element.

type Content

type Content struct {
	Type    string `xml:"type,attr,omitempty"`
	Content string `xml:",chardata"`
}

Content represents Atom content with type attribute.

type Entry

type Entry struct {
	Title     string     `xml:"title"`
	Link      []Link     `xml:"link"`
	ID        string     `xml:"id"`
	Updated   string     `xml:"updated"`
	Published string     `xml:"published,omitempty"`
	Author    *Author    `xml:"author,omitempty"`
	Summary   *Content   `xml:"summary,omitempty"`
	Content   *Content   `xml:"content,omitempty"`
	Category  []Category `xml:"category,omitempty"`
}

Entry represents an Atom entry element.

type Feed

type Feed struct {
	XMLName xml.Name `xml:"feed"`
	XMLNS   string   `xml:"xmlns,attr"`
	Title   string   `xml:"title"`
	Link    []Link   `xml:"link"`
	Updated string   `xml:"updated"`
	ID      string   `xml:"id"`
	Author  *Author  `xml:"author,omitempty"`
	Entries []Entry  `xml:"entry"`
}

Feed represents an Atom feed.

func FromFeed

func FromFeed(f *entry.Feed, feedURL string) *Feed

FromFeed converts an entry.Feed to an Atom Feed.

func (*Feed) ToXML

func (f *Feed) ToXML() ([]byte, error)

ToXML returns the Atom feed as XML bytes.

func (*Feed) WriteFile

func (f *Feed) WriteFile(filename string) error

WriteFile writes the Atom feed to a file.

type Link struct {
	Href string `xml:"href,attr"`
	Rel  string `xml:"rel,attr,omitempty"`
	Type string `xml:"type,attr,omitempty"`
}

Link represents an Atom link element.

Jump to

Keyboard shortcuts

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