Compare commits

..

No commits in common. "566227773ed5a67ff904df5af45b873014de6f6a" and "f27116930abaa27396d2ffb1ad70003ed63d3296" have entirely different histories.

2 changed files with 3 additions and 21 deletions

View File

@ -34,12 +34,12 @@ func (c *Category) Check() error {
if c.Scheme != "" { if c.Scheme != "" {
if !isValidURI(c.Scheme) { if !isValidURI(c.Scheme) {
return fmt.Errorf("scheme attribute %v of category not correctly formatted", c.Scheme) return fmt.Errorf("scheme attribute of category %v not correctly formatted", c.Scheme)
} }
} }
if !isCorrectlyEscaped(c.Label) { if !isCorrectlyEscaped(c.Label) {
return fmt.Errorf("label attribute %v of category not correctly escaped", c.Label) return fmt.Errorf("label attribute of category %v not correctly escaped", c.Label)
} }
if c.Content == nil { if c.Content == nil {

View File

@ -1,10 +1,6 @@
package atomfeed package atomfeed
import ( import "errors"
"errors"
"fmt"
"html"
)
type Generator struct { type Generator struct {
*CommonAttributes *CommonAttributes
@ -13,24 +9,10 @@ type Generator struct {
Text string `xml:"text"` Text string `xml:"text"`
} }
func NewGenerator(text string) *Generator {
return &Generator{Text: html.UnescapeString(text)}
}
func (g *Generator) Check() error { func (g *Generator) Check() error {
if g.URI != "" {
if !isValidURI(g.URI) {
return fmt.Errorf("uri attribute %v of generator not correctly formatted", g.URI)
}
}
if g.Text == "" { if g.Text == "" {
return errors.New("text element of generator empty") return errors.New("text element of generator empty")
} }
if !isCorrectlyEscaped(g.Text) {
return fmt.Errorf("text element %v of generator not correctly escaped", g.Text)
}
return nil return nil
} }