Added and corrected comments
This commit is contained in:
@@ -12,6 +12,8 @@ type InlineTextContent struct {
|
||||
Texts []string `xml:"texts,omitempty"`
|
||||
}
|
||||
|
||||
// newInlineTextContent creates a new InlineTextContent. It returns a
|
||||
// *InlineTextContent and an error.
|
||||
func newInlineTextContent(mediaType string, content any) (*InlineTextContent, error) {
|
||||
if mediaType != "text" && mediaType != "html" && mediaType != "" {
|
||||
return nil, fmt.Errorf("media type %v incompatible with inline text content", mediaType)
|
||||
@@ -36,12 +38,19 @@ func newInlineTextContent(mediaType string, content any) (*InlineTextContent, er
|
||||
return &InlineTextContent{Type: mediaType, Texts: texts}, nil
|
||||
}
|
||||
|
||||
// isContent checks whether the InlineTextContent is a Content. It returns a
|
||||
// bool.
|
||||
func (i *InlineTextContent) isContent() bool { return true }
|
||||
|
||||
// hasSRC checks whether the InlineTextContent has a SRC attribute. It returns
|
||||
// a bool.
|
||||
func (i *InlineTextContent) hasSRC() bool { return false }
|
||||
|
||||
// getType returns the Type of the InlineTextContent as a string.
|
||||
func (i *InlineTextContent) getType() string { return i.Type }
|
||||
|
||||
// Check checks the InlineTextContent for incompatibilities with RFC4287. It
|
||||
// returns an error.
|
||||
func (i *InlineTextContent) Check() error {
|
||||
if i.Type != "" && i.Type != "text" && i.Type != "html" {
|
||||
return errors.New("type attribute of inline text content must be text or html if not omitted")
|
||||
|
Reference in New Issue
Block a user