atom

package
v0.0.0-...-d1b8e3a Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TextTypeText = "text"
	TextTypeHtml = "html"
)

Variables

This section is empty.

Functions

func HTML

func HTML(content string) *atom_str

HTML returns an atom_str with type "html" if the content contains angle brackets.

func MarshalIndent

func MarshalIndent(in Feed, indent string) (raw []byte, err error)

func Standard

func Standard(in Feed, allowedTimeFormats ...string) (out feeds.Feed, err error)

func StandardCategories

func StandardCategories(in []Category) (out []feeds.Category)

func StandardEntries

func StandardEntries(in []Entry, src feeds.FeedMeta, atfs ...string) (out []feeds.Entry, err error)

func StandardEntry

func StandardEntry(in Entry, source feeds.FeedMeta, atfs ...string) (out feeds.Entry, err error)

func StandardFeedMeta

func StandardFeedMeta(in FeedMeta, atfs ...string) (out feeds.FeedMeta, err error)
func StandardLink(in Link) (out feeds.Link)
func StandardLinks(in []Link) (out []feeds.Link)

func StandardPersons

func StandardPersons(in []Person) (out []feeds.Person)

func StandardTime

func StandardTime(in string, formats ...string) (out time.Time, errs error)

func String

func String(t, content string) *atom_str

String returns an atom_str with the provided type and content. You should use the TextType* constants as the first argument and your processed content as the second, or use the more specific creators like Text() and HTML().

func Text

func Text(content string) *atom_str

Text returns an atom_str with type "text".

Types

type Category

type Category struct {
	common.XmlAttrs
	XMLName xml.Name `xml:"category"`
	Term    string   `xml:"term,attr"`
	Scheme  string   `xml:"scheme,attr,omitempty"`
	Label   string   `xml:"label,attr,omitempty"`
}

func AtomCategories

func AtomCategories(in []feeds.Category) (out []Category)

type Entry

type Entry struct {
	common.XmlAttrs
	XMLName      xml.Name          `xml:"entry"`
	Title        *atom_str         `xml:"title"`
	Summary      *atom_str         `xml:"summary,omitempty"`
	Categories   []Category        `xml:"category,omitempty"`
	Links        []Link            `xml:"link"`
	Id           string            `xml:"id"`
	Updated      string            `xml:"updated"`
	Published    string            `xml:"published,omitempty"`
	Source       *FeedMeta         `xml:"source,omitempty"`
	Authors      []Person          `xml:"author,omitempty"`
	Contributors []Person          `xml:"contributor,omitempty"`
	Extensions   common.Extensions `xml:",any,omitempty"`
	Content      *atom_str         `xml:"content,omitempty"`
}

func AtomEntries

func AtomEntries(in []feeds.Entry) (out []Entry)

func AtomEntry

func AtomEntry(in feeds.Entry) (out Entry)

type Feed

type Feed struct {
	XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed"`
	FeedMeta
	Extensions common.Extensions `xml:",any,omitempty"`
	Entries    []Entry           `xml:"entry"`
}

Feed is a single feed that can be marshalled to XML

func Atom

func Atom(in feeds.Feed) (out Feed)

Atom converts a standard Feed into an atom Feed.

func Unmarshal

func Unmarshal(raw []byte) (out Feed, err error)

type FeedMeta

type FeedMeta struct {
	common.XmlAttrs
	Title      *atom_str  `xml:"title"`
	Subtitle   *atom_str  `xml:"subtitle,omitempty"`
	Icon       string     `xml:"icon,omitempty"`
	Categories []Category `xml:"category,omitempty"`
	Updated    string     `xml:"updated,omitempty"`
	Id         string     `xml:"id"`
	Links      []Link     `xml:"link"`
	Rights     string     `xml:"rights,omitempty"`
	Generator  *Generator `xml:"generator,omitempty"`
}

func AtomFeedMeta

func AtomFeedMeta(in feeds.FeedMeta) (out *FeedMeta)

type Generator

type Generator struct {
	common.XmlAttrs
	XMLName xml.Name `xml:"generator"`
	Uri     string   `xml:"uri,attr"`
	Version string   `xml:"version,attr"`
	Name    string   `xml:",chardata"`
}
type Link struct {
	common.XmlAttrs
	XMLName  xml.Name `xml:"link"`
	Rel      string   `xml:"rel,attr,omitempty"`
	Type     string   `xml:"type,attr,omitempty"`
	Length   int      `xml:"length,attr,omitempty"`
	HrefLang string   `xml:"hreflang,attr,omitempty"`
	Href     string   `xml:"href,attr"`
}
func AtomLinks(in []feeds.Link) (out []Link)

type Person

type Person struct {
	common.XmlAttrs
	Name       string            `xml:"name"`
	Uri        string            `xml:"uri,omitempty"`
	Email      string            `xml:"email,omitempty"`
	Extensions common.Extensions `xml:",any,omitempty"`
}

func AtomPersons

func AtomPersons(in []feeds.Person, autofill bool) (out []Person)

Jump to

Keyboard shortcuts

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