feat: add redaction

This commit is contained in:
Ben Goldsworthy 2023-12-12 22:40:30 +00:00
parent a35946ae92
commit b2dba13746
8 changed files with 1373 additions and 103 deletions

View file

@ -36,9 +36,37 @@
{{- $paid_current := "#BCBC7E" -}}
{{ with ( .GetPage "cv/roles" ).Pages -}}
{{- range ( where . ".Params.organisations" "intersect" $titles ) -}}
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
[
"{{- delimit ( intersect .Params.organisations $titles ) ", " | safeHTML -}}",
"{{- .Title | plainify -}}",
"
{{- with .Params.organisations -}}
{{- $.Scratch.Set "parents" ( slice ) -}}
{{- range . -}}
{{- range ( where ( where $.Site.Pages "Type" "cv" ) "Title" . ) -}}
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}}
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append "███████████████" ) -}}
{{- end -}}
{{- else -}}
{{- $.Scratch.Set "parents" ( $.Scratch.Get "parents" | append ( .Title | plainify ) ) -}}
{{- end -}}
{{- else -}}
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" . $.File.Path }}
{{- end -}}
{{- end -}}
{{- delimit ( $.Scratch.Get "parents" ) ", " -}}
{{- $.Scratch.Delete "parents" -}}
{{- end -}}
",
"
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}}
███████████████
{{- end -}}
{{- else -}}
{{- .Title | plainify -}}
{{- end -}}
",
"{{ if .Params.end_date -}}
{{- if .Params.paid -}}
{{- $paid_past -}}
@ -61,6 +89,7 @@
{{- end -}}
")
],
{{- end -}}
{{- end -}}
{{ end -}}
]);
@ -93,10 +122,13 @@
style="background-image: url({{ .RelPermalink }})"
{{ end }}
{{ end }}>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}">
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2>
</div>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ end }}">
<h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2>
</div>
</div>
{{- with .Params.nka -}}<p>Now known as: {{ . }}</p>{{- end -}}
{{- with .Params.fka -}}<p>Formerly known as: {{ . }}</p>{{- end -}}
{{- with .Params.tka -}}<p>Then known as: {{ . }}</p>{{- end -}}
</header>
{{ else }}
<header class="site-content__header">
@ -148,37 +180,37 @@
<section id="related" class="row">
{{- $titles := .Scratch.Get "titles" -}}
{{ range (where ((.GetPage "blog").Sections) "Title" "Blog Posts") }}
{{ range ( where ( ( .GetPage "blog" ).Sections ) "Title" "Blog Posts" ) }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where ( where ( where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }}
{{ end }}
{{ range (where ((.GetPage "portfolio").Sections) "Title" "!=" "Appearances").ByTitle }}
{{ range ( where ( ( .GetPage "portfolio" ).Sections ) "Title" "!=" "Appearances" ).ByTitle }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where ( where ( where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }}
{{ end }}
{{ range (where ((.GetPage "cv").Sections) "Title" "Qualifications") }}
{{ range ( where ( ( .GetPage "cv" ).Sections ) "Title" "Qualifications" ) }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where ( where ( where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }}
{{ end }}
{{ range (where ((.GetPage "cv").Sections) "Title" "Awards") }}
{{ range ( where ( (.GetPage "cv").Sections ) "Title" "Awards" ) }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where ( where ( where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }}
{{ end }}
{{ range (where ((.GetPage "portfolio").Sections) "Title" "Appearances").ByTitle }}
{{ range ( where ( (.GetPage "portfolio").Sections ) "Title" "Appearances" ).ByTitle }}
{{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ with where ( where ( where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles ) ".Params.redact" false }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }}
{{ end }}