Treat html differently from text in text constructs
This commit is contained in:
parent
2d1d95502f
commit
2cbc604d85
5
text.go
5
text.go
@ -2,6 +2,7 @@ package atomfeed
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html"
|
||||
)
|
||||
|
||||
type Text interface {
|
||||
@ -11,8 +12,10 @@ type Text interface {
|
||||
|
||||
func NewText(textType, content string) (Text, error) {
|
||||
switch textType {
|
||||
case "text", "html":
|
||||
case "text":
|
||||
return &PlainText{Type: textType, Text: content}, nil
|
||||
case "html":
|
||||
return &PlainText{Type: textType, Text: html.EscapeString(content)}, nil
|
||||
case "xhtml":
|
||||
return &XHTMLText{Type: textType, XHTMLDiv: content}, nil
|
||||
case "":
|
||||
|
Loading…
x
Reference in New Issue
Block a user