Documentation
¶
Index ¶
- Constants
- func DateTime(t time.Time) string
- func NewURN() string
- func Unescape(s string) string
- type Category
- type CommonAttributes
- type Content
- type Countable
- type Date
- type Entry
- func (e *Entry) AddAuthor(a *Person) int
- func (e *Entry) AddCategory(c *Category) int
- func (e *Entry) AddContributor(c *Person) int
- func (e *Entry) AddExtension(x *ExtensionElement) int
- func (e *Entry) AddLink(l *Link) int
- func (e *Entry) Check() error
- func (e *Entry) DeleteAuthor(index int) error
- func (e *Entry) DeleteCategory(index int) error
- func (e *Entry) DeleteContributor(index int) error
- func (e *Entry) DeleteExtension(index int) error
- func (e *Entry) DeleteLink(index int) error
- func (e *Entry) ToXML(encoding string) (string, error)
- type ExtensionElement
- type Feed
- func (f *Feed) AddAuthor(a *Person) int
- func (f *Feed) AddCategory(c *Category) int
- func (f *Feed) AddContributor(c *Person) int
- func (f *Feed) AddEntry(e *Entry) int
- func (f *Feed) AddExtension(e *ExtensionElement) int
- func (f *Feed) AddLink(l *Link) int
- func (f *Feed) Check() error
- func (f *Feed) DeleteAuthor(index int) error
- func (f *Feed) DeleteCategory(index int) error
- func (f *Feed) DeleteContributor(index int) error
- func (f *Feed) DeleteEntry(index int) error
- func (f *Feed) DeleteEntryByURI(uri string) error
- func (f *Feed) DeleteExtension(index int) error
- func (f *Feed) DeleteLink(index int) error
- func (f *Feed) ToXML(encoding string) (string, error)
- type Generator
- type ID
- type Icon
- type InlineOtherContent
- type InlineTextContent
- type InlineXHTMLContent
- type Link
- type Logo
- type OutOfLineContent
- type Person
- type PlainText
- type Source
- func (s *Source) AddAuthor(a *Person) int
- func (s *Source) AddCategory(c *Category) int
- func (s *Source) AddContributor(c *Person) int
- func (s *Source) AddExtension(e *ExtensionElement) int
- func (s *Source) AddLink(l *Link) int
- func (s *Source) Check() error
- func (s *Source) DeleteAuthor(index int) error
- func (s *Source) DeleteCategory(index int) error
- func (s *Source) DeleteContributor(index int) error
- func (s *Source) DeleteExtension(index int) error
- func (s *Source) DeleteLink(index int) error
- type Text
- type XHTMLDiv
- type XHTMLText
Constants ¶
const ( InlineText = iota InlineXHTML InlineOther OutOfLine )
Variables ¶
This section is empty.
Functions ¶
func DateTime ¶
DateTime formats the time.Time t to a string as defined by RFC3339. It returns a string.
Types ¶
type Category ¶
type Category struct { XMLName xml.Name `xml:"category"` *CommonAttributes Term string `xml:"term,attr"` Scheme string `xml:"scheme,attr,omitempty"` // IRI Label string `xml:"label,attr,omitempty"` // Must be unescaped }
func NewCategory ¶
NewCategory creates a new Category. It takes in a string term and returns a *Category.
type CommonAttributes ¶
type CommonAttributes struct { Base string `xml:"base,attr,omitempty"` // IRI Lang string `xml:"lang,attr,omitempty"` // LanguageTag UndefinedAttributes []*xml.Attr `xml:",attr,omitempty"` }
func NewCommonAttributes ¶ added in v0.2.1
func NewCommonAttributes() *CommonAttributes
NewCommonAttributes creates a new set of CommonAttributes. It returns a *CommonAttributes.
func (*CommonAttributes) AddAttribute ¶ added in v0.4.0
func (c *CommonAttributes) AddAttribute(name, value string) int
AddAttribute adds an attribute to the CommonAttributes. It takes in the strings name and value and returns the index as an int.
func (*CommonAttributes) Check ¶
func (c *CommonAttributes) Check() error
Check checks the CommonAttributes for incompatibilities with RFC4287. It returns an error.
func (*CommonAttributes) DeleteAttribute ¶ added in v0.5.0
func (c *CommonAttributes) DeleteAttribute(index int) error
DeleteAttribute deletes the attribute at index from the CommonAttributes. It returns an error.
type Date ¶
type Date struct { *CommonAttributes DateTime string `xml:",chardata"` }
type Entry ¶
type Entry struct { XMLName xml.Name `xml:"entry"` *CommonAttributes Authors []*Person `xml:"author,omitempty"` Categories []*Category `xml:",omitempty"` Content Content `xml:",omitempty"` Contributors []*Person `xml:"contributors,omitempty"` ID *ID Links []*Link `xml:",omitempty"` Published *Date `xml:"published,omitempty"` Rights Text `xml:"rights,omitempty"` Source *Source `xml:",omitempty"` Summary Text `xml:"summary,omitempty"` Title Text `xml:"title"` Updated *Date `xml:"updated"` Extensions []*ExtensionElement `xml:",any,omitempty"` }
It is advisable that each atom:entry element contain a non-empty atom:title element, a non-empty atom:content element when that element is present, and a non-empty atom:summary element when the entry contains no atom:content element.
func (*Entry) AddAuthor ¶ added in v0.1.3
AddAuthor adds the Person a as an author to the Entry. It returns the index as an int.
func (*Entry) AddCategory ¶ added in v0.1.3
AddCategory adds the Category c to the Entry. It returns the index as an int.
func (*Entry) AddContributor ¶ added in v0.1.3
AddContributor adds the Person c as a contributor to the Entry. It returns the index as an int.
func (*Entry) AddExtension ¶
func (e *Entry) AddExtension(x *ExtensionElement) int
AddExtension adds the ExtensionElement x to the Entry. It returns the index as an int.
func (*Entry) AddLink ¶ added in v0.1.3
AddLink adds the Link l to the Entry. It returns the index as an int.
func (*Entry) Check ¶
Check checks the Entry for incompatibilities with RFC4287. It returns an error.
func (*Entry) DeleteAuthor ¶ added in v0.5.0
DeleteAuthor deletes the Person at index from the Entry. It returns an error.
func (*Entry) DeleteCategory ¶ added in v0.5.0
DeleteCategory deletes the Category at index from the Entry. It returns an error.
func (*Entry) DeleteContributor ¶ added in v0.5.0
DeleteContributor deletes the Person at index from the Entry. It returns an error.
func (*Entry) DeleteExtension ¶ added in v0.5.0
DeleteExtension deletes the Extension at index from the Entry. It returns an error.
func (*Entry) DeleteLink ¶ added in v0.5.0
DeleteLink deletes the Link at index from the Entry. It returns an error.
type ExtensionElement ¶
func NewExtensionElement ¶
func NewExtensionElement(name string, value any) *ExtensionElement
NewExtensionElement creates a new ExtensionElement. It takes in a string name and any value and returns a *ExtensionElement.
func (*ExtensionElement) Check ¶
func (e *ExtensionElement) Check() error
Check checks the ExtensionElement for incompatibilities with RFC4287. It returns an error.
type Feed ¶
type Feed struct { XMLName xml.Name `xml:"http://www.w3.org/2005/Atom feed"` *CommonAttributes Authors []*Person `xml:"author,omitempty"` Categories []*Category `xml:",omitempty"` Contributors []*Person `xml:"contributor,omitempty"` Generator *Generator `xml:",omitempty"` Icon *Icon `xml:",omitempty"` ID *ID Links []*Link `xml:",omitempty"` Logo *Logo `xml:",omitempty"` Rights Text `xml:"rights,omitempty"` Subtitle Text `xml:"subtitle,omitempty"` Title Text `xml:"title"` Updated *Date `xml:"updated"` Extensions []*ExtensionElement `xml:",any,omitempty"` Entries []*Entry `xml:",omitempty"` }
func (*Feed) AddAuthor ¶
AddAuthor adds the Person a as an author to the Feed. It returns the index as an int.
func (*Feed) AddCategory ¶
AddCategory adds the Category c to the Feed. It returns the index as an int.
func (*Feed) AddContributor ¶
AddContributor adds the Person c as a contributor to the Feed. It returns the index as an int.
func (*Feed) AddExtension ¶
func (f *Feed) AddExtension(e *ExtensionElement) int
AddExtension adds the Extension e to the Feed. It returns the index as an int.
func (*Feed) AddLink ¶
AddLink adds the Link l to the Feed. It returns the index as an int.
There should be one Link with Rel "self".
func (*Feed) DeleteAuthor ¶ added in v0.5.0
DeleteAuthor deletes the Person at index from the Feed. It returns an error.
func (*Feed) DeleteCategory ¶ added in v0.5.0
DeleteCategory deletes the Category at index from the Feed. It returns an error.
func (*Feed) DeleteContributor ¶ added in v0.5.0
DeleteContributor deletes the Person at index from the Feed. It returns an error.
func (*Feed) DeleteEntry ¶ added in v0.5.0
DeleteEntry deletes the Entry at index from the Feed. It returns an error.
func (*Feed) DeleteEntryByURI ¶ added in v0.5.0
DeleteEntryByURI deletes the Entry from the Feed. It takes in a string uri and returns an error.
func (*Feed) DeleteExtension ¶ added in v0.5.0
DeleteExtension deletes the Extension at index from the Feed. It returns an error.
func (*Feed) DeleteLink ¶ added in v0.5.0
DeleteLink deletes the Link at index from the Feed. It returns an error.
type Generator ¶
type Generator struct { XMLName xml.Name `xml:"generator"` *CommonAttributes URI string `xml:"uri,attr,omitempty"` // IRI Version string `xml:"version,attr,omitempty"` Text string `xml:",chardata"` }
func NewGenerator ¶
NewGenerator creates a new Generator. It takes in a string text and returns a *Generator.
type ID ¶
type ID struct { XMLName xml.Name `xml:"id"` *CommonAttributes URI string `xml:",chardata"` // IRI }
type Icon ¶
type Icon struct { XMLName xml.Name `xml:"icon"` *CommonAttributes URI string `xml:",chardata"` // IRI }
type InlineOtherContent ¶
type InlineOtherContent struct { XMLName xml.Name `xml:"content"` *CommonAttributes AnyElement any `xml:",chardata"` Type string `xml:"type,attr,omitempty"` // MediaType }
func (*InlineOtherContent) Check ¶
func (i *InlineOtherContent) Check() error
Check checks the InlineOtherContent for incompatibilities with RFC4287. It returns an error.
type InlineTextContent ¶
type InlineTextContent struct { XMLName xml.Name `xml:"content"` *CommonAttributes Type string `xml:"type,attr,omitempty"` // Must be text or html Text string `xml:",chardata"` }
func (*InlineTextContent) Check ¶
func (i *InlineTextContent) Check() error
Check checks the InlineTextContent for incompatibilities with RFC4287. It returns an error.
type InlineXHTMLContent ¶
type InlineXHTMLContent struct { XMLName xml.Name `xml:"content"` *CommonAttributes XHTMLDiv *XHTMLDiv Type string `xml:"type,attr"` }
func (*InlineXHTMLContent) Check ¶
func (i *InlineXHTMLContent) Check() error
Check checks the InlineXHTMLContent for incompatibilities with RFC4287. It returns an error.
type Link ¶
type Link struct { XMLName xml.Name `xml:"link"` *CommonAttributes Title string `xml:"title,attr,omitempty"` Href string `xml:"href,attr"` // IRI Rel string `xml:"rel,attr,omitempty"` Type string `xml:"type,attr,omitempty"` // MediaType HrefLang string `xml:"hreflang,attr,omitempty"` // LanguageTag Length uint `xml:"length,attr,omitempty"` }
type Logo ¶
type Logo struct { XMLName xml.Name `xml:"logo"` *CommonAttributes URI string `xml:",chardata"` // IRI }
type OutOfLineContent ¶
type OutOfLineContent struct { XMLName xml.Name `xml:"content"` *CommonAttributes Type string `xml:"type,attr,omitempty"` // MediaType SRC string `xml:"src,attr"` // IRI }
func (*OutOfLineContent) Check ¶
func (o *OutOfLineContent) Check() error
Check checks the OutOfLineContent for incompatibilities with RFC4287. It returns an error.
type Person ¶
type Person struct { *CommonAttributes Name string `xml:"name"` URI string `xml:"uri,omitempty"` // IRI Email string `xml:"email,omitempty"` // EmailAddress Extensions []*ExtensionElement `xml:",any,omitempty"` }
func (*Person) AddExtension ¶
func (p *Person) AddExtension(e *ExtensionElement) int
AddExtension adds the Extension e to the Person. It returns the index as an int.
func (*Person) Check ¶
Check checks the Person for incompatibilities with RFC4287. It returns an error.
func (*Person) DeleteExtension ¶ added in v0.5.0
DeleteExtension deletes the Extension at index from the Person. It returns an error.
type PlainText ¶
type PlainText struct { *CommonAttributes Type string `xml:"type,attr,omitempty"` // Must be text or html Text string `xml:",chardata"` }
type Source ¶
type Source struct { XMLName xml.Name `xml:"source"` *CommonAttributes Authors []*Person `xml:"author,omitempty"` Categories []*Category `xml:",omitempty"` Contributors []*Person `xml:"contributor,omitempty"` Generator *Generator `xml:",omitempty"` Icon *Icon `xml:",omitempty"` ID *ID `xml:",omitempty"` Links []*Link `xml:",omitempty"` Logo *Logo `xml:",omitempty"` Rights Text `xml:"rights,omitempty"` Subtitle Text `xml:"subtitle,omitempty"` Title Text `xml:"title,omitempty"` Updated *Date `xml:"updated,omitempty"` Extensions []*ExtensionElement `xml:",any,omitempty"` }
func NewSource ¶ added in v0.4.0
func NewSource() *Source
NewSource creates a new Source. It returns a *Source.
func (*Source) AddAuthor ¶ added in v0.5.0
AddAuthor adds the Person a as an author to the Source. It returns the index as an int.
func (*Source) AddCategory ¶ added in v0.5.0
AddCategory adds the Category c to the Source. It returns the index as an int.
func (*Source) AddContributor ¶ added in v0.5.0
AddContributor adds the Person c as a contributor to the Source. It returns the index as an int.
func (*Source) AddExtension ¶ added in v0.5.0
func (s *Source) AddExtension(e *ExtensionElement) int
AddExtension adds the ExtensionElement e to the Source. It returns the index as an int.
func (*Source) AddLink ¶ added in v0.5.0
AddLink adds the Link l to the Source. It returns the index as an int.
func (*Source) Check ¶
Check checks the Source for incompatibilities with RFC4287. It returns an error.
func (*Source) DeleteAuthor ¶ added in v0.5.0
DeleteAuthor deletes the Person at index from the Source. It returns an error.
func (*Source) DeleteCategory ¶ added in v0.5.0
DeleteCategory deletes the Category at index from the Source. It returns an error.
func (*Source) DeleteContributor ¶ added in v0.5.0
DeleteContributor deletes the Person at index from the Source. It returns an error.
func (*Source) DeleteExtension ¶ added in v0.5.0
DeleteExtension deletes the Extension at index from the Source. It returns an error.
func (*Source) DeleteLink ¶ added in v0.5.0
DeleteLink deletes the Link at index from the Source. It returns an error.