atom/text.go

23 lines
418 B
Go

package atom
import "html"
type Text interface {
isText() bool
Check() error
}
// NewText creates a new Text. It returns a Text.
func NewText(textType, content string) Text {
switch textType {
case "text", "":
return newPlainText(textType, content)
case "html":
return newPlainText(textType, html.UnescapeString(content))
case "xhtml":
return newXHTMLText(textType, content)
default:
return nil
}
}