Added and corrected comments
This commit is contained in:
@@ -14,6 +14,7 @@ type Category struct {
|
||||
Label string `xml:"label,attr,omitempty"`
|
||||
}
|
||||
|
||||
// NewCategory creates a new Category. It returns a *Category and an error.
|
||||
func NewCategory(term string) (*Category, error) {
|
||||
content, err := NewContent(InlineText, "", "")
|
||||
if err != nil {
|
||||
@@ -23,10 +24,13 @@ func NewCategory(term string) (*Category, error) {
|
||||
return &Category{Term: term, Content: content}, nil
|
||||
}
|
||||
|
||||
// SetLabel sets the label of the Category.
|
||||
func (c *Category) SetLabel(label string) {
|
||||
c.Label = html.UnescapeString(label)
|
||||
}
|
||||
|
||||
// Check checks the Category for incompatibilities with RFC4287. It returns an
|
||||
// error.
|
||||
func (c *Category) Check() error {
|
||||
if c.Term == "" {
|
||||
return errors.New("term attribute of category empty")
|
||||
|
Reference in New Issue
Block a user