Added and corrected comments

This commit is contained in:
2024-10-16 19:59:28 +02:00
parent 6a76bdc0c3
commit 4220a2acc6
23 changed files with 131 additions and 39 deletions

View File

@@ -8,8 +8,11 @@ type PlainText struct {
Text string `xml:"text"`
}
// isText checks whether the PlainText is a Text. It returns a bool.
func (p *PlainText) isText() bool { return true }
// Check checks the PlainText for incompatibilities with RFC4287. It returns an
// error.
func (p *PlainText) Check() error {
if p.Type != "" && p.Type != "text" && p.Type != "html" {
return errors.New("type attribute of plain text must be text or html if not omitted")