Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f3019ff7e8 | |||
d6310ee8ee | |||
a65920aa70 |
15
content.go
15
content.go
@@ -21,13 +21,22 @@ type Content interface {
|
|||||||
func NewContent(contentType int, mediaType string, content any) Content {
|
func NewContent(contentType int, mediaType string, content any) Content {
|
||||||
switch contentType {
|
switch contentType {
|
||||||
case 0:
|
case 0:
|
||||||
return newInlineTextContent(mediaType, content.(string))
|
if stringContent, ok := content.(string); ok {
|
||||||
|
return newInlineTextContent(mediaType, stringContent)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
case 1:
|
case 1:
|
||||||
return newInlineXHTMLContent(mediaType, content.(*XHTMLDiv))
|
if xhtmlDivContent, ok := content.(*XHTMLDiv); ok {
|
||||||
|
return newInlineXHTMLContent(mediaType, xhtmlDivContent)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
case 2:
|
case 2:
|
||||||
return newInlineOtherContent(mediaType, content)
|
return newInlineOtherContent(mediaType, content)
|
||||||
case 3:
|
case 3:
|
||||||
return newOutOfLineContent(mediaType, content.(string))
|
if stringContent, ok := content.(string); ok {
|
||||||
|
return newOutOfLineContent(mediaType, stringContent)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
4
go.mod
4
go.mod
@@ -1,8 +1,8 @@
|
|||||||
module git.streifling.com/jason/atom
|
module git.streifling.com/jason/atom
|
||||||
|
|
||||||
go 1.23.2
|
go 1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
golang.org/x/text v0.19.0
|
golang.org/x/text v0.29.0
|
||||||
)
|
)
|
||||||
|
4
go.sum
4
go.sum
@@ -1,4 +1,4 @@
|
|||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
|
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
package atom
|
package atom
|
||||||
|
|
||||||
import (
|
import "fmt"
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PlainText struct {
|
type PlainText struct {
|
||||||
*CommonAttributes
|
*CommonAttributes
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
package atom
|
package atom
|
||||||
|
|
||||||
import (
|
import "fmt"
|
||||||
"fmt"
|
|
||||||
)
|
|
||||||
|
|
||||||
type XHTMLText struct {
|
type XHTMLText struct {
|
||||||
*CommonAttributes
|
*CommonAttributes
|
||||||
|
Reference in New Issue
Block a user