diff options
Diffstat (limited to 'tvsaver/saver2v2/save_annotation.go')
-rw-r--r-- | tvsaver/saver2v2/save_annotation.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tvsaver/saver2v2/save_annotation.go b/tvsaver/saver2v2/save_annotation.go new file mode 100644 index 0000000..f5ea893 --- /dev/null +++ b/tvsaver/saver2v2/save_annotation.go @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later + +package saver2v2 + +import ( + "fmt" + "io" + + "github.com/spdx/tools-golang/spdx/common" + "github.com/spdx/tools-golang/spdx/v2_2" +) + +func renderAnnotation2_2(ann *v2_2.Annotation, w io.Writer) error { + if ann.Annotator.Annotator != "" && ann.Annotator.AnnotatorType != "" { + fmt.Fprintf(w, "Annotator: %s: %s\n", ann.Annotator.AnnotatorType, ann.Annotator.Annotator) + } + if ann.AnnotationDate != "" { + fmt.Fprintf(w, "AnnotationDate: %s\n", ann.AnnotationDate) + } + if ann.AnnotationType != "" { + fmt.Fprintf(w, "AnnotationType: %s\n", ann.AnnotationType) + } + annIDStr := common.RenderDocElementID(ann.AnnotationSPDXIdentifier) + if annIDStr != "SPDXRef-" { + fmt.Fprintf(w, "SPDXREF: %s\n", annIDStr) + } + if ann.AnnotationComment != "" { + fmt.Fprintf(w, "AnnotationComment: %s\n", textify(ann.AnnotationComment)) + } + + return nil +} |