Skip to content

Commit 809d8be

Browse files
committed
Added template support for lexicon references
Signed-off-by: Eddie Knight <[email protected]>
1 parent 6adf8bb commit 809d8be

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

cmd/baseline.go

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type LexiconEntry struct {
4040
Term string `yaml:"term"`
4141
Definition string `yaml:"definition"`
4242
Synonyms []string `yaml:"synonyms"`
43+
References []string `yaml:"references"`
4344
}
4445

4546
func hardcodedCategories() []string {
@@ -192,6 +193,9 @@ func (b *Baseline) Generate() error {
192193
"asLink": func(s string) string {
193194
return asLinkTemplateFunction(s)
194195
},
196+
"subtract": func(a, b int) int {
197+
return a - b
198+
},
195199
}).Parse(string(templateContent))
196200
if err != nil {
197201
return fmt.Errorf("error parsing template: %w", err)

cmd/template.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ For more information on the project and to make contributions, visit the [GitHub
7070
{{ if .ControlMappings }}
7171
**Control Mappings:**
7272
{{ range $key, $value := .ControlMappings }}
73-
- {{ $key }}: {{ $value }}
73+
- {{ $key | addLinks }}: {{ $value }}
7474
{{- end }}
7575
{{- end }}
7676
{{ if .SecurityInsightsValue }}
@@ -88,6 +88,18 @@ For more information on the project and to make contributions, visit the [GitHub
8888
### {{ .Term }}
8989

9090
{{ .Definition }}
91+
{{ if .Synonyms }}
92+
{{- $length := len .Synonyms -}}
93+
**Synonyms:** _{{- range $index, $synonym := .Synonyms -}}{{ $synonym }}{{- if lt $index (subtract $length 1) }}, {{ end -}}
94+
{{- end -}}_
95+
{{- end }}
96+
97+
{{ if .References }}
98+
**References:**
99+
{{ range .References }}
100+
- {{.}}
101+
{{- end }}
102+
{{- end }}
91103

92104
{{- end }}
93105
---

0 commit comments

Comments
 (0)