Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
2ef8d8c9df | |||
97fe20f364 | |||
0c24f80d09 |
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
2
date.go
2
date.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
53
entry.go
53
entry.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
@ -36,6 +36,9 @@ type Entry struct {
|
|||||||
// atom:author element itself.
|
// atom:author element itself.
|
||||||
func (e *Entry) checkAuthors() error {
|
func (e *Entry) checkAuthors() error {
|
||||||
if e.Authors == nil {
|
if e.Authors == nil {
|
||||||
|
if e.Source == nil {
|
||||||
|
return errors.New("no authors set in entry")
|
||||||
|
}
|
||||||
if e.Source.Authors == nil {
|
if e.Source.Authors == nil {
|
||||||
return errors.New("no authors set in entry")
|
return errors.New("no authors set in entry")
|
||||||
}
|
}
|
||||||
@ -64,6 +67,54 @@ func NewEntry(title string) (*Entry, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddAuthor adds the Person as an author to the Entry.
|
||||||
|
func (e *Entry) AddAuthor(p *Person) {
|
||||||
|
if e.Authors == nil {
|
||||||
|
e.Authors = make([]*Person, 1)
|
||||||
|
e.Authors[0] = p
|
||||||
|
} else {
|
||||||
|
e.Authors = append(e.Authors, p)
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Updated.DateTime = DateTime(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddCategory adds the Category to the Entry.
|
||||||
|
func (e *Entry) AddCategory(c *Category) {
|
||||||
|
if e.Categories == nil {
|
||||||
|
e.Categories = make([]*Category, 1)
|
||||||
|
e.Categories[0] = c
|
||||||
|
} else {
|
||||||
|
e.Categories = append(e.Categories, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Updated.DateTime = DateTime(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddContributor adds the Person as a contributor to the Entry.
|
||||||
|
func (e *Entry) AddContributor(c *Person) {
|
||||||
|
if e.Contributors == nil {
|
||||||
|
e.Contributors = make([]*Person, 1)
|
||||||
|
e.Contributors[0] = c
|
||||||
|
} else {
|
||||||
|
e.Contributors = append(e.Contributors, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Updated.DateTime = DateTime(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
|
// AddLink adds the Link to the Entry.
|
||||||
|
func (e *Entry) AddLink(l *Link) {
|
||||||
|
if e.Links == nil {
|
||||||
|
e.Links = make([]*Link, 1)
|
||||||
|
e.Links[0] = l
|
||||||
|
} else {
|
||||||
|
e.Links = append(e.Links, l)
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Updated.DateTime = DateTime(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
// AddExtension adds the ExtensionElement to the Entry.
|
// AddExtension adds the ExtensionElement to the Entry.
|
||||||
func (e *Entry) AddExtension(x *ExtensionElement) {
|
func (e *Entry) AddExtension(x *ExtensionElement) {
|
||||||
if e.Extensions == nil {
|
if e.Extensions == nil {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
2
feed.go
2
feed.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
2
icon.go
2
icon.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
2
link.go
2
link.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
2
logo.go
2
logo.go
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import "errors"
|
import "errors"
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package atomfeed
|
package atom
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
|
Reference in New Issue
Block a user