Add newInlineOtherContent
This commit is contained in:
parent
15b74c2675
commit
b26d6370f5
@ -1,11 +1,23 @@
|
||||
package atomfeed
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
)
|
||||
|
||||
type InlineOtherContent struct {
|
||||
*CommonAttributes
|
||||
AnyElement any `xml:"anyelement,omitempty"`
|
||||
Type MediaType `xml:"type,attr,omitempty"`
|
||||
AnyElement []*any `xml:"anyelement,omitempty"`
|
||||
}
|
||||
|
||||
func newInlineOtherContent(mediaType string, content any) (*InlineOtherContent, error) {
|
||||
if mediaType, _, err := mime.ParseMediaType(mediaType); err != nil {
|
||||
return nil, fmt.Errorf("media type %v incompatible with inline other content", mediaType)
|
||||
}
|
||||
|
||||
return &InlineOtherContent{Type: MediaType(mediaType), AnyElement: content}, nil
|
||||
}
|
||||
|
||||
func (i *InlineOtherContent) isContent() bool { return true }
|
||||
|
Loading…
x
Reference in New Issue
Block a user