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

@ -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 }}

View file

@ -9,30 +9,44 @@
</tr>
</thead>
<tbody>
{{ range .Pages }}
{{- range .Pages -}}
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
<tr>
<td>
{{- if .Params.featured_image -}}
<img class="organisation-table__logo" loading="lazy" src="
{{- if .Resources.GetMatch .Params.featured_image -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}}
{{- .Params.featured_image -}}
<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 -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}}
{{- .Params.featured_image -}}
{{- end -}}
">
{{- end -}}
">
{{- end -}}
</td>
<td>
<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>
{{- 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 -}}&#10004;{{- end -}}</td>
<td></td>
</tr>
{{ end }}
{{- end -}}
{{- end -}}
</tbody>
</table>
</section>

View file

@ -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>
{{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</ul>{{- end -}}
{{- 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 -}}
{{- end -}}
</li>
{{- end -}}