rss

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: 0

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".

func MarshalIndent

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

func RSSCategories

func RSSCategories(in []feeds.Category) (out []string)

func RSSPersons

func RSSPersons(in []feeds.Person) (out string)

func Standard

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

func StandardCategories

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

func StandardEnclosures

func StandardEnclosures(in []Enclosure) (out []feeds.Link)

func StandardEntries

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

func StandardEntry

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

func StandardPersons

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

func StandardSource

func StandardSource(in *Source) (out feeds.FeedMeta)

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".

func UnmarshalAttributes

func UnmarshalAttributes(in common.Attributes) (out feeds.Attributes)

func UnmarshalExtensions

func UnmarshalExtensions(in common.Extensions) (out feeds.Extensions)

Types

type Channel

type Channel struct {
	XMLName xml.Name `xml:"channel"`
	ChannelMeta
	Extensions common.Extensions `xml:",any,omitempty"`
	Image      Image             `xml:"image,omitempty"`
	Entries    []Item            `xml:"item"`
}

Channel is a single feed that can be marshalled to XML

func RSS

func RSS(in feeds.Feed) (out Channel)

RSS converts a standard Feed into an RSS Channel.

func Unmarshal

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

type ChannelMeta

type ChannelMeta struct {
	common.XmlAttrs
	XMLName     xml.Name `xml:"channel"`
	Title       string   `xml:"title"`
	Id          string   `xml:"link"`
	Description string   `xml:"description"`
	Language    string   `xml:"language,omitempty"`
	Rights      string   `xml:"copyright,omitempty"`
	Published   string   `xml:"pubDate"`
	Updated     string   `xml:"lastBuildDate"`
	Categories  []string `xml:"category"`
	Generator   string   `xml:"generator,omitempty"`
}

type Enclosure

type Enclosure struct {
	common.XmlAttrs
	XMLName xml.Name `xml:"enclosure"`
	URL     string   `xml:"url,attr"`
	Length  int      `xml:"length,attr"`
	Type    string   `xml:"type,attr"`
}

func RSSEnclosures

func RSSEnclosures(in []feeds.Link) (out []Enclosure)

type Image

type Image struct {
	common.XmlAttrs
	XMLName     xml.Name `xml:"image"`
	URL         string   `xml:"url"`
	Title       string   `xml:"title"`
	Link        string   `xml:"link"`
	Width       int      `xml:"width,omitempty"`
	Height      int      `xml:"height,omitempty"`
	Description string   `xml:"description,omitempty"`
}

type Item

type Item struct {
	common.XmlAttrs
	XMLName     xml.Name          `xml:"item"`
	Title       string            `xml:"title"`
	Link        string            `xml:"link"`
	Description string            `xml:"description"`
	Author      string            `xml:"author,omitempty"`
	Categories  []string          `xml:"category,omitempty"`
	Enclosures  []Enclosure       `xml:"enclosure,omitempty"`
	GUID        string            `xml:"guid,omitempty"`
	Published   string            `xml:"pubDate,omitempty"`
	Source      *Source           `xml:"source,omitempty"`
	Extensions  common.Extensions `xml:",any,omitempty"`
}

func RSSEntries

func RSSEntries(in []feeds.Entry) (out []Item)

func RSSItem

func RSSItem(in feeds.Entry) (out Item)

type Source

type Source struct {
	common.XmlAttrs
	XMLName xml.Name `xml:"source"`
	URL     string   `xml:"url,attr"`
	Content string   `xml:",chardata"`
}

func RSSSource

func RSSSource(in feeds.FeedMeta) (out *Source)

Jump to

Keyboard shortcuts

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