From 8fd499c6511547baa2c0ed7ca6b093ac4f473548 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Fri, 6 May 2022 09:48:52 +0200 Subject: [PATCH] chore: commit save point --- application/source/defaults.go | 23 ++++++----- application/source/util.go | 39 +++++++++++++++++-- development/examples/example1/req1/1/test1.md | 38 ++++++++++++------ development/examples/example1/req1/1/test2.md | 4 +- development/examples/example1/req1/1/test3.md | 6 +-- development/examples/example1/req1/1/test4.md | 4 +- development/examples/example1/req1/2/test1.md | 4 +- development/examples/example1/req1/2/test2.md | 4 +- development/examples/example1/req1/2/test3.md | 4 +- development/examples/example1/req1/2/test4.md | 4 +- development/examples/example1/req1/2/test5.md | 4 +- development/examples/example1/req1/2/test6.md | 4 +- development/examples/example1/req1/3/test1.md | 4 +- development/examples/example1/req1/3/test2.md | 4 +- development/examples/example1/req1/3/test3.md | 4 +- development/examples/example1/req1/3/test4.md | 4 +- development/examples/example1/req1/3/test5.md | 4 +- development/examples/example1/req1/3/test6.md | 4 +- development/examples/example1/req1/3/test7.md | 4 +- development/examples/example1/req1/4/test1.md | 4 +- development/examples/example1/req1/4/test2.md | 4 +- development/examples/example1/req1/4/test3.md | 4 +- development/examples/example1/req1/4/test4.md | 4 +- development/examples/example1/req1/5/test1.md | 4 +- development/examples/example1/req1/5/test2.md | 4 +- development/examples/example1/req1/6/test1.md | 4 +- development/examples/example1/req1/6/test2.md | 4 +- 27 files changed, 124 insertions(+), 74 deletions(-) diff --git a/application/source/defaults.go b/application/source/defaults.go index 7642800..02ae4cd 100644 --- a/application/source/defaults.go +++ b/application/source/defaults.go @@ -10,6 +10,10 @@ const exitCodeCatchAll = 1 const defaultOverviewTemplate = ` +--- +block-headings: true +--- + {{ if .HasChangelog }} ## Changelog @@ -103,7 +107,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -184,21 +188,20 @@ Privacy: {{ end }} - {{ if .Privacy }} #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** - -{{ .Description }} +{{ if .Purposes }}**{{ .Purposes }}** {{ end }}**({{ .ID }})** -| | | -|--|--| -| Category | {{ .Category }} | +{{ if .Description }} {{ .Description }} +{{ end }} +| | | +|-----------------------|----------------------------| +| Category | {{ .Category }} | | Data Retention Period | {{ .DataRetentionPeriod }} | -| Legal Basis | {{ .LegalBasis }} | -| Transfers | {{ .Transfers }} | +| Legal Basis | {{ .LegalBasis }} | +| Transfers | {{ .Transfers }} | {{ end }} {{ end }} diff --git a/application/source/util.go b/application/source/util.go index 4d067ea..7bbfac9 100644 --- a/application/source/util.go +++ b/application/source/util.go @@ -40,12 +40,23 @@ func splitYamlParts(content []byte) (error, contentRequirement) { text += before - a, b, found := strings.Cut(remaining, "...") + a, b, found := strings.Cut(remaining, "\n...") if !found { - a, b, found = strings.Cut(remaining, "---") + a, b, found = strings.Cut(remaining, "\n---") if !found { - return errors.New("the file does not contain a definition block"), contentRequirement{} + + a, b, found = strings.Cut(remaining, "...") + + if !found { + + a, b, found = strings.Cut(remaining, "---") + + if !found { + return errors.New("the file does not contain a definition block"), contentRequirement{} + } + + } } } @@ -65,10 +76,32 @@ func splitYamlParts(content []byte) (error, contentRequirement) { return err, contentRequirement{} } + tempItem := []Item{} for i, _ := range data.Items { + + if data.Items[i].ID == "" { + continue + } + data.Items[i].ID = data.ID + "-" + data.Items[i].ID + tempItem = append(tempItem, data.Items[i]) + } + + data.Items = tempItem + + p := []Privacy{} + for i, _ := range data.Privacy { + if data.Privacy[i].ID == "" { + continue + } + + data.Privacy[i].ID = data.ID + "-" + data.Privacy[i].ID + p = append(p, data.Privacy[i]) + } + data.Privacy = p + req := contentRequirement{} req.data = data diff --git a/development/examples/example1/req1/1/test1.md b/development/examples/example1/req1/1/test1.md index 294156a..a0356a5 100644 --- a/development/examples/example1/req1/1/test1.md +++ b/development/examples/example1/req1/1/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -117,6 +117,7 @@ Privacy: ... + ### {{ .Title }} - {{ .ID }} #### Subheading @@ -130,33 +131,46 @@ Privacy: | ID | Name | Delivery until | Provided on | |--------------------|--------------|----------------------:|-----------------------------------------:| -{{ range .Items - }}| {{ .ID }} | {{ .Name }} | {{ .DeliveryUntil.Format "02.Jan" }} | {{ .ProvidedOn.Format "02.Jan" }} | +{{ range .Items +}}| {{ .ID }} | {{ .Name }} | {{ .DeliveryUntil.Format "02.Jan" }} | {{ .ProvidedOn.Format "02.Jan" }} | {{ end }} {{ end }} - {{ if .Privacy }} #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** - -{{ .Description }} +{{ if .Purposes }}**{{ .Purposes }}** {{ end }}**({{ .ID }})** -| | | -|--|--| -| Category | {{ .Category }} | +{{ if .Description }} {{ .Description }} +{{ end }} +| | | +|-----------------------|----------------------------| +| Category | {{ .Category }} | | Data Retention Period | {{ .DataRetentionPeriod }} | -| Legal Basis | {{ .LegalBasis }} | -| Transfers | {{ .Transfers }} | +| Legal Basis | {{ .LegalBasis }} | +| Transfers | {{ .Transfers }} | {{ end }} {{ end }} +## Level 2 + +test + +### Level 3 + +test + +#### Level 4 + +test + +##### Level 5 +test diff --git a/development/examples/example1/req1/1/test2.md b/development/examples/example1/req1/1/test2.md index 3b40198..3e1bcd0 100644 --- a/development/examples/example1/req1/1/test2.md +++ b/development/examples/example1/req1/1/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/1/test3.md b/development/examples/example1/req1/1/test3.md index 5cf0860..e591c57 100644 --- a/development/examples/example1/req1/1/test3.md +++ b/development/examples/example1/req1/1/test3.md @@ -53,9 +53,9 @@ Last Update: null # the individual items as a list Items: - - ID: null + - ID: XXX Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/1/test4.md b/development/examples/example1/req1/1/test4.md index d206d5a..366200b 100644 --- a/development/examples/example1/req1/1/test4.md +++ b/development/examples/example1/req1/1/test4.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test1.md b/development/examples/example1/req1/2/test1.md index a0a38f6..94fd88a 100644 --- a/development/examples/example1/req1/2/test1.md +++ b/development/examples/example1/req1/2/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test2.md b/development/examples/example1/req1/2/test2.md index bc5ae94..8818faa 100644 --- a/development/examples/example1/req1/2/test2.md +++ b/development/examples/example1/req1/2/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test3.md b/development/examples/example1/req1/2/test3.md index 5daaf15..029be2d 100644 --- a/development/examples/example1/req1/2/test3.md +++ b/development/examples/example1/req1/2/test3.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test4.md b/development/examples/example1/req1/2/test4.md index 5f04a17..d8f7847 100644 --- a/development/examples/example1/req1/2/test4.md +++ b/development/examples/example1/req1/2/test4.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test5.md b/development/examples/example1/req1/2/test5.md index 5215225..96505e0 100644 --- a/development/examples/example1/req1/2/test5.md +++ b/development/examples/example1/req1/2/test5.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/2/test6.md b/development/examples/example1/req1/2/test6.md index 56222a8..c85e981 100644 --- a/development/examples/example1/req1/2/test6.md +++ b/development/examples/example1/req1/2/test6.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test1.md b/development/examples/example1/req1/3/test1.md index d55bd99..220bccb 100644 --- a/development/examples/example1/req1/3/test1.md +++ b/development/examples/example1/req1/3/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test2.md b/development/examples/example1/req1/3/test2.md index 94766fe..d710863 100644 --- a/development/examples/example1/req1/3/test2.md +++ b/development/examples/example1/req1/3/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test3.md b/development/examples/example1/req1/3/test3.md index efdc539..b9b168e 100644 --- a/development/examples/example1/req1/3/test3.md +++ b/development/examples/example1/req1/3/test3.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test4.md b/development/examples/example1/req1/3/test4.md index 2e22e63..caa64b4 100644 --- a/development/examples/example1/req1/3/test4.md +++ b/development/examples/example1/req1/3/test4.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test5.md b/development/examples/example1/req1/3/test5.md index 3e49e98..03987e6 100644 --- a/development/examples/example1/req1/3/test5.md +++ b/development/examples/example1/req1/3/test5.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test6.md b/development/examples/example1/req1/3/test6.md index 7e1af1d..272adc7 100644 --- a/development/examples/example1/req1/3/test6.md +++ b/development/examples/example1/req1/3/test6.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/3/test7.md b/development/examples/example1/req1/3/test7.md index 765583a..e818028 100644 --- a/development/examples/example1/req1/3/test7.md +++ b/development/examples/example1/req1/3/test7.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/4/test1.md b/development/examples/example1/req1/4/test1.md index ac1cabb..ef0e376 100644 --- a/development/examples/example1/req1/4/test1.md +++ b/development/examples/example1/req1/4/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/4/test2.md b/development/examples/example1/req1/4/test2.md index 209372d..d5a9cf9 100644 --- a/development/examples/example1/req1/4/test2.md +++ b/development/examples/example1/req1/4/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/4/test3.md b/development/examples/example1/req1/4/test3.md index 5151dde..75097d0 100644 --- a/development/examples/example1/req1/4/test3.md +++ b/development/examples/example1/req1/4/test3.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/4/test4.md b/development/examples/example1/req1/4/test4.md index 11045bb..291745b 100644 --- a/development/examples/example1/req1/4/test4.md +++ b/development/examples/example1/req1/4/test4.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/5/test1.md b/development/examples/example1/req1/5/test1.md index 3dc845f..0001465 100644 --- a/development/examples/example1/req1/5/test1.md +++ b/development/examples/example1/req1/5/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/5/test2.md b/development/examples/example1/req1/5/test2.md index c31f84c..31abd4a 100644 --- a/development/examples/example1/req1/5/test2.md +++ b/development/examples/example1/req1/5/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/6/test1.md b/development/examples/example1/req1/6/test1.md index 1c24095..db80588 100644 --- a/development/examples/example1/req1/6/test1.md +++ b/development/examples/example1/req1/6/test1.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} diff --git a/development/examples/example1/req1/6/test2.md b/development/examples/example1/req1/6/test2.md index 071b74c..23e82ff 100644 --- a/development/examples/example1/req1/6/test2.md +++ b/development/examples/example1/req1/6/test2.md @@ -55,7 +55,7 @@ Last Update: null Items: - ID: null Name: null - # what is it, a image, font, legal information, access data, texts, decisions, ... + # what is it, a image, font, legal information, access data, texts, decisions, etc. Type: null # does this belong to a group Group: null @@ -141,7 +141,7 @@ Privacy: #### Privacy {{ range .Privacy }} -**{{ .Purpose }} ({{ .ID }})** +**{{ .Purposes }} ({{ .ID }})** {{ .Description }} -- GitLab