Get rid of checks when creating constructs. Check should handle this.

This commit is contained in:
2024-10-19 14:12:51 +02:00
parent 960889f9e7
commit 57db4178d0
21 changed files with 143 additions and 345 deletions

11
text.go
View File

@@ -1,17 +1,14 @@
package atom
import (
"fmt"
"html"
)
import "html"
type Text interface {
isText() bool
Check() error
}
// NewText creates a new Text. It returns a Text and an error.
func NewText(textType, content string) (Text, error) {
// NewText creates a new Text. It returns a Text.
func NewText(textType, content string) Text {
switch textType {
case "text", "":
return newPlainText(textType, content)
@@ -20,6 +17,6 @@ func NewText(textType, content string) (Text, error) {
case "xhtml":
return newXHTMLText(textType, content)
default:
return nil, fmt.Errorf("%v is not a valid text type", textType)
return nil
}
}