feat: add redaction
This commit is contained in:
parent
a35946ae92
commit
b2dba13746
8 changed files with 1373 additions and 103 deletions
File diff suppressed because it is too large
Load diff
|
@ -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 -}}
|
||||
|
@ -62,6 +90,7 @@
|
|||
")
|
||||
],
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ end -}}
|
||||
]);
|
||||
|
||||
|
@ -97,6 +126,9 @@
|
|||
<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">
|
||||
|
@ -150,35 +182,35 @@
|
|||
|
||||
{{ 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 }}
|
||||
{{ $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" ) }}
|
||||
{{ $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" ) }}
|
||||
{{ $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 }}
|
||||
{{ $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 }}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<!--. is .c-->
|
||||
<!--$ is .g-->
|
||||
|
||||
{{ $scratch := .g.Scratch }}
|
||||
{{ if .c.Parent }}
|
||||
{{ if ne .c.Parent.Type "cv/organisations" }}
|
||||
{{ with .c.Parent }}
|
||||
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $.g ) }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $scratch.Set "top-level-parent" .c.Parent }}
|
||||
{{ end }}
|
||||
{{ end }}
|
|
@ -9,9 +9,15 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range .Pages }}
|
||||
{{- range .Pages -}}
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
<tr>
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.featured_image -}}
|
||||
<img class="organisation-table__logo" loading="lazy" src="
|
||||
{{- if .Resources.GetMatch .Params.featured_image -}}
|
||||
|
@ -21,18 +27,26 @@
|
|||
{{- end -}}
|
||||
">
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</td>
|
||||
<td>
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}}
|
||||
{{- with .Params.markup_title -}}{{- . | safeHTML -}}{{- else -}}{{- .Title | safeHTML -}}{{- end -}}
|
||||
{{- if .Params.TitleLang -}}</i>{{- end -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
</td>
|
||||
<td>{{- if gt (len .Sections) 0 -}}✔{{- end -}}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
<li class="hierarchy-item hierarchy-item--child"><a href="{{ .RelPermalink }}">{{ with .Params.markup_title }}{{ . | safeHTML }}{{ else }}{{ .Title | safeHTML }}{{ end }}</a>
|
||||
{{- range .Sections -}}<ul>
|
||||
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
|
||||
<li class="hierarchy-item hierarchy-item--child">
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- with .Params.markup_title }}
|
||||
{{- . | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- .Title | safeHTML -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
{{- range .Sections -}}
|
||||
<ul>
|
||||
{{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
|
||||
</ul>{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</li>
|
||||
{{- end -}}
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
<article class="item-tile item-tile--redacted {{- with .Params.site }} item-tile--{{ . }}{{ end -}}">
|
||||
<header class="item-tile__header">
|
||||
<h2 class="p-name item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }} item-tile__title--long{{ end }}" itemprop="name">
|
||||
{{- partialCached "redact-black.html" . -}}
|
||||
</h2>
|
||||
<p style="display: none;">Published: <time class="dt-published" itemprop="datePublished" datetime="{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00" }}">{{ .PublishDate | time.Format "2006-01-02T15:04:05-07:00"}}</time></p>
|
||||
</header>
|
||||
</article>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<a id="{{ .Title | urlize }}" class="h-entry u-url link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
|
||||
<article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}"
|
||||
{{ if .Params.featured_image }}
|
||||
|
@ -54,3 +66,4 @@
|
|||
</header>
|
||||
</article>
|
||||
</a>
|
||||
{{- end -}}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
{{- .Scratch.Set "i" 0 -}}
|
||||
{{- range ( .GetTerms "skills" ).ByTitle -}}
|
||||
{{- if hasPrefix .LinkTitle "CIISec/" -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> <span class="level">{{ index $.Params.skills_ciisec_levels ( $.Scratch.Get "i" ) }}</span></li>
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a> <span class="level">(level {{ index $.Params.skills_ciisec_levels ( $.Scratch.Get "i" ) }})</span></li>
|
||||
{{- $.Scratch.Add "i" 1 -}}
|
||||
{{- else -}}
|
||||
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
|
@ -49,7 +49,13 @@
|
|||
{{- range ( .GetTerms "organisations" ) -}}
|
||||
{{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }}
|
||||
{{ range . }}
|
||||
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
|
||||
{{- if ( eq $.Site.Params.redact "black" ) -}}
|
||||
<li>{{- partialCached "redact-black.html" . -}}</li>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
<li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li>
|
||||
{{- end -}}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.File.Path }}
|
||||
|
|
1
layouts/partials/redact-black.html
Normal file
1
layouts/partials/redact-black.html
Normal file
|
@ -0,0 +1 @@
|
|||
███████████
|
Loading…
Reference in a new issue