matom

package
v0.0.0-...-94ee829 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	XMLName struct{} `xml:"category"`

	Term string `xml:"term,attr"`
}

Category is a category of an Atom entry.

type Entry

type Entry struct {
	XMLName struct{} `xml:"entry"`

	Title     string        `xml:"title"`
	Summary   string        `xml:"summary,omitempty"`
	Content   *EntryContent `xml:"content"`
	Published time.Time     `xml:"published"`
	Updated   time.Time     `xml:"updated"`
	Link      *Link         `xml:""`
	ID        string        `xml:"id"`

	AuthorName string `xml:"author>name,omitempty"`
	AuthorURI  string `xml:"author>uri,omitempty"`

	Categories []*Category `xml:""`
}

Entry is a single entry in an Atom feed.

type EntryContent

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

EntryContent is a simple helper class that allows us to wrap an entry's content in an XML CDATA tag.

type Feed

type Feed struct {
	XMLName struct{} `xml:"feed"`

	XMLLang string `xml:"xml:lang,attr"`
	XMLNS   string `xml:"xmlns,attr"`

	Title   string    `xml:"title"`
	ID      string    `xml:"id"`
	Updated time.Time `xml:"updated"`

	Links   []*Link  `xml:""`
	Entries []*Entry `xml:""`
}

Feed represents an Atom feed that with be marshaled to XML.

Note that XMLName is a Golang XML "magic" attribute.

func (*Feed) Encode

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

Encode the feed to an io.Writer.

Adds a few attributes that have mostly default content like xml:lang and xmlns.

type Link struct {
	XMLName struct{} `xml:"link"`

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

Link is a link embedded in the header of an Atom feed.

Jump to

Keyboard shortcuts

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