update theme

This commit is contained in:
Ben Goldsworthy 2023-10-03 13:08:35 +01:00
parent 43ddb22f80
commit a35946ae92
19 changed files with 1418 additions and 223 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -6,8 +6,7 @@
{{ define "header-scripts" }} {{ define "header-scripts" }}
{{ with .Params.locations }} {{ with .Params.locations }}
{{ $mapJS := resources.Get "js/leaflet.js" | fingerprint }} <script id="Map-script" src="/js/leaflet.js"></script>
<script id="Map-script" src="{{ $mapJS.Permalink }}" integrity="{{ $mapJS.Data.Integrity }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -36,7 +35,7 @@
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]); latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }} {{ else }}
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }} {{ erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path }}
{{ end }} {{ end }}
{{ end }} {{ end }}
map.fitBounds(latLons); map.fitBounds(latLons);
@ -48,11 +47,10 @@
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script> <script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
<script src="/js/mathjax/config.js"></script> <script src="/js/mathjax/config.js"></script>
{{ end }} {{ end }}
{{ if in . "charts" }} {{ if in . "charts" }}
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }} {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }} <script id="Charts-script" src="/js/chart.js"></script>
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script> <script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -6,8 +6,7 @@
{{ define "header-scripts" }} {{ define "header-scripts" }}
{{ with .Params.locations }} {{ with .Params.locations }}
{{ $mapJS := resources.Get "js/leaflet.js" | fingerprint }} <script id="Map-script" src="/js/leaflet.js"></script>
<script id="Map-script" src="{{ $mapJS.Permalink }}" integrity="{{ $mapJS.Data.Integrity }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -36,10 +35,12 @@
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]); latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }} {{ else }}
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }} {{ erroridf "missing-lat-lon" "Could not find lat-lon for %q (%q)" . $.File.Path }}
{{ end }} {{ end }}
{{ end }} {{ end }}
map.fitBounds(latLons); map.fitBounds(latLons);
if (map.getZoom() < 10) map.setZoom(10);
</script> </script>
{{ end }} {{ end }}
{{ with .Params.scripts }} {{ with .Params.scripts }}
@ -50,10 +51,9 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if $.HasShortcode "chart" }} {{ if $.HasShortcode "chart" }}
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }} {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" | fingerprint }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }} <script id="Charts-script" src="/js/chart.js"></script>
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script> <script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}" integrity="{{ $chartsConfigJS.Data.Integrity }}"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -255,7 +255,7 @@
<h2 class="subheading subheading--comments" id="comments">Comments</h2> <h2 class="subheading subheading--comments" id="comments">Comments</h2>
<ul class="comment__thread"> <ul class="comment__thread">
{{ .RenderShortcodes }} {{ .RenderShortcodes }}
</il> </ul>
</section> </section>
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -5,31 +5,14 @@
{{ define "main-class" }}--section location-map{{ end }} {{ define "main-class" }}--section location-map{{ end }}
{{ define "header-scripts" }} {{ define "header-scripts" }}
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" <link rel="stylesheet" href="/css/leaflet.css"/>
integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI="
crossorigin=""/>
{{ end }} {{ end }}
{{ define "footer-scripts" }} {{ define "footer-scripts" }}
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" <script src="/js/leaflet.js"></script>
integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM="
crossorigin=""></script>
<script src="/js/leaflet-heat.js"></script> <script src="/js/leaflet-heat.js"></script>
<script>
/*
(c) 2014, Vladimir Agafonkin
simpleheat, a tiny JavaScript library for drawing heatmaps with Canvas
https://github.com/mourner/simpleheat
*/
!function(){"use strict";function t(i){return this instanceof t?(this._canvas=i="string"==typeof i?document.getElementById(i):i,this._ctx=i.getContext("2d"),this._width=i.width,this._height=i.height,this._max=1,void this.clear()):new t(i)}t.prototype={defaultRadius:25,defaultGradient:{.4:"blue",.6:"cyan",.7:"lime",.8:"yellow",1:"red"},data:function(t,i){return this._data=t,this},max:function(t){return this._max=t,this},add:function(t){return this._data.push(t),this},clear:function(){return this._data=[],this},radius:function(t,i){i=i||15;var a=this._circle=document.createElement("canvas"),s=a.getContext("2d"),e=this._r=t+i;return a.width=a.height=2*e,s.shadowOffsetX=s.shadowOffsetY=200,s.shadowBlur=i,s.shadowColor="black",s.beginPath(),s.arc(e-200,e-200,t,0,2*Math.PI,!0),s.closePath(),s.fill(),this},gradient:function(t){var i=document.createElement("canvas"),a=i.getContext("2d"),s=a.createLinearGradient(0,0,0,256);i.width=1,i.height=256;for(var e in t)s.addColorStop(e,t[e]);return a.fillStyle=s,a.fillRect(0,0,1,256),this._grad=a.getImageData(0,0,1,256).data,this},draw:function(t){this._circle||this.radius(this.defaultRadius),this._grad||this.gradient(this.defaultGradient);var i=this._ctx;i.clearRect(0,0,this._width,this._height);for(var a,s=0,e=this._data.length;e>s;s++)a=this._data[s],i.globalAlpha=Math.max(a[2]/this._max,t||.05),i.drawImage(this._circle,a[0]-this._r,a[1]-this._r);var n=i.getImageData(0,0,this._width,this._height);return this._colorize(n.data,this._grad),i.putImageData(n,0,0),this},_colorize:function(t,i){for(var a,s=3,e=t.length;e>s;s+=4)a=4*t[s],a&&(t[s-3]=i[a],t[s-2]=i[a+1],t[s-1]=i[a+2])}},window.simpleheat=t}(),/*
(c) 2014, Vladimir Agafonkin
Leaflet.heat, a tiny and fast heatmap plugin for Leaflet.
https://github.com/Leaflet/Leaflet.heat
*/
L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._latlngs=t,L.setOptions(this,i)},setLatLngs:function(t){return this._latlngs=t,this.redraw()},addLatLng:function(t){return this._latlngs.push(t),this.redraw()},setOptions:function(t){return L.setOptions(this,t),this._heat&&this._updateOptions(),this.redraw()},redraw:function(){return!this._heat||this._frame||this._map._animating||(this._frame=L.Util.requestAnimFrame(this._redraw,this)),this},onAdd:function(t){this._map=t,this._canvas||this._initCanvas(),t._panes.overlayPane.appendChild(this._canvas),t.on("moveend",this._reset,this),t.options.zoomAnimation&&L.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._canvas),t.off("moveend",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},_initCanvas:function(){var t=this._canvas=L.DomUtil.create("canvas","leaflet-heatmap-layer leaflet-layer"),i=L.DomUtil.testProp(["transformOrigin","WebkitTransformOrigin","msTransformOrigin"]);t.style[i]="50% 50%";var a=this._map.getSize();t.width=a.x,t.height=a.y;var s=this._map.options.zoomAnimation&&L.Browser.any3d;L.DomUtil.addClass(t,"leaflet-zoom-"+(s?"animated":"hide")),this._heat=simpleheat(t),this._updateOptions()},_updateOptions:function(){this._heat.radius(this.options.radius||this._heat.defaultRadius,this.options.blur),this.options.gradient&&this._heat.gradient(this.options.gradient),this.options.max&&this._heat.max(this.options.max)},_reset:function(){var t=this._map.containerPointToLayerPoint([0,0]);L.DomUtil.setPosition(this._canvas,t);var i=this._map.getSize();this._heat._width!==i.x&&(this._canvas.width=this._heat._width=i.x),this._heat._height!==i.y&&(this._canvas.height=this._heat._height=i.y),this._redraw()},_redraw:function(){var t,i,a,s,e,n,h,o,r,d=[],_=this._heat._r,l=this._map.getSize(),m=new L.Bounds(L.point([-_,-_]),l.add([_,_])),c=void 0===this.options.max?1:this.options.max,u=void 0===this.options.maxZoom?this._map.getMaxZoom():this.options.maxZoom,f=1/Math.pow(2,Math.max(0,Math.min(u-this._map.getZoom(),12))),g=_/2,p=[],v=this._map._getMapPanePos(),w=v.x%g,y=v.y%g;for(t=0,i=this._latlngs.length;i>t;t++)if(a=this._map.latLngToContainerPoint(this._latlngs[t]),m.contains(a)){e=Math.floor((a.x-w)/g)+2,n=Math.floor((a.y-y)/g)+2;var x=void 0!==this._latlngs[t].alt?this._latlngs[t].alt:void 0!==this._latlngs[t][2]?+this._latlngs[t][2]:1;r=x*f,p[n]=p[n]||[],s=p[n][e],s?(s[0]=(s[0]*s[2]+a.x*r)/(s[2]+r),s[1]=(s[1]*s[2]+a.y*r)/(s[2]+r),s[2]+=r):p[n][e]=[a.x,a.y,r]}for(t=0,i=p.length;i>t;t++)if(p[t])for(h=0,o=p[t].length;o>h;h++)s=p[t][h],s&&d.push([Math.round(s[0]),Math.round(s[1]),Math.min(s[2],c)]);this._heat.data(d).draw(this.options.minOpacity),this._frame=null},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),a=this._map._getCenterOffset(t.center)._multiplyBy(-i).subtract(this._map._getMapPanePos());L.DomUtil.setTransform?L.DomUtil.setTransform(this._canvas,a,i):this._canvas.style[L.DomUtil.TRANSFORM]=L.DomUtil.getTranslateString(a)+" scale("+i+")"}}),L.heatLayer=function(t,i){return new L.HeatLayer(t,i)};
</script>
<script> <script>
var map = L.map('map').setView([55, -3], 13); var map = L.map('map').setView([55, -3], 3);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19, maxZoom: 19,
@ -37,82 +20,32 @@ L.HeatLayer=(L.Layer?L.Layer:L.Class).extend({initialize:function(t,i){this._lat
}).addTo(map); }).addTo(map);
{{ range $.Site.Data.locations }} {{ range $.Site.Data.locations }}
//L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
{{ end }} {{ end }}
{{ .Scratch.Set "maxItems" 0 }} {{ .Scratch.Set "maxItems" 0 }}
{{ .Scratch.Set "numOfItems" 0 }} {{ .Scratch.Set "numOfItems" 0 }}
/* warnf "No of locations: %v" ( len $.Site.Data.locations ) */
{{ range $key, $value := $.Site.Data.locations }} {{ range $key, $value := $.Site.Data.locations }}
{{ $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) }} {{ $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) }}
/* warnf "Current location: %v" $key */ {{ $.Scratch.Set "numOfItems" ( len $childPosts ) }}
/* warnf "Child posts: %v" $childPosts */ {{ if ( gt ( $.Scratch.Get "numOfItems" ) ( $.Scratch.Get "maxItems" ) ) }}
{{ .Scratch.Set "numOfItems" ( len $childPosts ) }} {{ $.Scratch.Set "maxItems" ( $.Scratch.Get "numOfItems" ) }}
{{ if ( gt ( .Scratch.Get "numOfItems" ) ( .Scratch.Get "maxItems" ) ) }}
/* warnf "Updating maxItems" */
{{ .Scratch.Set "maxItems" ( .Scratch.Get "numOfItems" ) }}
/* warnf "New maxItems: %d" .Scratch.Get "maxItems" */
{{ end }} {{ end }}
{{ end }} {{ end }}
/* warnf "maxItems: %v" ( .Scratch.Get "maxItems" ) */ L.heatLayer(
console.log({{ .Scratch.Get "maxItems" }}); [
{{- range $key, $value := $.Site.Data.locations -}}
L.heatLayer([ {{- $childPosts := where $.Site.Pages ".Params.locations" "intersect" ( slice $key ) -}}
{{ range $key, $value := $.Site.Data.locations }} [ {{ .lat }}, {{ .lon }}, {{ len $childPosts }} ],
[ {{ .lat }}, {{ .lon }}, {{ len ( where $.Site.Pages "Params.locations" $key ) }} ], {{- end -}}
{{ end }} ],
], { max: {{ .Scratch.Get "maxItems" }} }).addTo(map); {
</script> max: {{ $.Scratch.Get "maxItems" }},
<script> gradient: { 0.4: 'blue', 0.65: 'lime', 1: 'red' }
/*
map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer.OSM());
{{ $minItems := 0 }}
{{ $maxItems := 0 }}
{{ range $.Site.Data.locations }}
{{ $numOfLocations := len ( where $.Site.Pages ".Params.locations" "intersect" . ) }}
{{ if ( gt $numOfLocations $maxItems ) }}
{{ $maxItems := $numOfLocations }}
{{ end }}
{{ end }}
var heatmap = new OpenLayers.Layer.Heatmap({
title: "Heatmap",
weight: function(feature){
return (feature.get('numOfPages')-{{$minItems}}) / ({{$maxItems}}-{{$minItems}});
} }
}); ).addTo(map);
map.addLayer(heatmap);
var markers = new OpenLayers.Layer.Markers( "Markers" );
//map.addLayer(markers);
{{ range $.Site.Data.locations }}
heatmap.addDataPoint(
new OpenLayers.LonLat(
{{ .lon }},
{{ .lat }}
)
);
markers.addMarker(
new OpenLayers.Marker(
new OpenLayers.LonLat(
{{ .lon }},
{{ .lat }}
).transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
)
)
);
{{ end }}
map.setCenter([0,0], 5);
*/
</script> </script>
{{ end }} {{ end }}

View File

@ -0,0 +1,37 @@
{{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section layouts-cv-organisations-section{{ end }}
{{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header">
<div class="article-header__featured-image"
{{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }}
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>
</header>
{{ else }}
<header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}.</h2>
{{- .Content -}}
</header>
{{ end }}
{{ end }}
{{ define "main-body" }}
{{ with .GetPage "cv/organisations" }}
{{ partial "cv/organisations/items-table.html" . }}
{{ end }}
{{ end }}
{{ define "main-footer" }}
{{ end }}

View File

@ -8,8 +8,7 @@
{{ define "header-scripts" }} {{ define "header-scripts" }}
{{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }} {{ if ( or ( eq .Type "cv" ) ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) }}
{{ $googleChartsJS := resources.Get "js/google-charts.js" | fingerprint }} <script id="Google-Charts-script" src="/js/google-charts.js"></script>
<script id="Google-Charts-script" src="{{ $googleChartsJS.Permalink }}" integrity="{{ $googleChartsJS.Data.Integrity }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -24,22 +23,22 @@
var container = document.getElementById('timeline'); var container = document.getElementById('timeline');
var chart = new google.visualization.Timeline(container); var chart = new google.visualization.Timeline(container);
var dataTable = new google.visualization.DataTable(); var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'string', id: 'Type' }); dataTable.addColumn({ type: 'string', id: 'Type' });
dataTable.addColumn({ type: 'string', id: 'Job Title' }); dataTable.addColumn({ type: 'string', id: 'Job Title' });
dataTable.addColumn({ type: 'string', id: 'style', role: 'style' }); dataTable.addColumn({ type: 'string', id: 'style', role: 'style' });
dataTable.addColumn({ type: 'date', id: 'Start' }); dataTable.addColumn({ type: 'date', id: 'Start' });
dataTable.addColumn({ type: 'date', id: 'End' }); dataTable.addColumn({ type: 'date', id: 'End' });
dataTable.addRows([ dataTable.addRows([
{{- $unpaid_past := "#FFFFF0" -}} {{- $unpaid_past := "#FFFFF0" -}}
{{- $paid_past := "#FCFCA6" -}} {{- $paid_past := "#FCFCA6" -}}
{{- $unpaid_current := "#BBBBB0" -}} {{- $unpaid_current := "#BBBBB0" -}}
{{- $paid_current := "#BCBC7E" -}} {{- $paid_current := "#BCBC7E" -}}
{{ with ( .GetPage "cv/roles" ).Pages -}} {{ with ( .GetPage "cv/roles" ).Pages -}}
{{- range ( where . ".Params.organisations" "intersect" $titles ) -}} {{- range ( where . ".Params.organisations" "intersect" $titles ) -}}
[ [
"{{- delimit ( intersect .Params.organisations $titles ) ", " | safeHTML -}}", "{{- delimit ( intersect .Params.organisations $titles ) ", " | safeHTML -}}",
"{{- .Title | safeHTML -}}", "{{- .Title | plainify -}}",
"{{ if .Params.end_date -}} "{{ if .Params.end_date -}}
{{- if .Params.paid -}} {{- if .Params.paid -}}
{{- $paid_past -}} {{- $paid_past -}}
@ -53,19 +52,19 @@
{{- $unpaid_current -}} {{- $unpaid_current -}}
{{- end -}} {{- end -}}
{{- end }}", {{- end }}",
new Date("{{ .Date.Format "2006-01-02" }}"), new Date("{{ .Date.Format "2006-01-02" }}"),
new Date(" new Date("
{{- if .Params.end_date -}} {{- if .Params.end_date -}}
{{- .Params.end_date -}} {{- .Params.end_date -}}
{{- else -}} {{- else -}}
{{- now.Format "2006-01-02" -}} {{- now.Format "2006-01-02" -}}
{{- end -}} {{- end -}}
") ")
], ],
{{- end -}} {{- end -}}
{{ end -}} {{ end -}}
]); ]);
var options = { var options = {
title: '{{ .Title | plainify }} Roles Timeline', title: '{{ .Title | plainify }} Roles Timeline',
height: '100%', height: '100%',
@ -75,61 +74,56 @@
width: '100%', width: '100%',
timeline: { showBarLabels: true } timeline: { showBarLabels: true }
}; };
chart.draw(dataTable, options); chart.draw(dataTable, options);
} }
</script> </script>
{{ else }} {{ else }}
{{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) }} {{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }}
<script src="{{ $js.RelPermalink }}"></script> <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ define "main-header" }} {{ define "main-header" }}
{{ if .IsDescendant ( .GetPage "/cv/organisations" ) }} {{ if .IsDescendant ( .GetPage "/cv/organisations" ) }}
<header class="site-content__header"> <header class="site-content__header">
<div class="article-header__featured-image" <div class="article-header__featured-image"
{{ if .Params.featured_image }} {{ if .Params.featured_image }}
{{ with .Resources.GetMatch .Params.featured_image }} {{ with .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ .RelPermalink }})" style="background-image: url({{ .RelPermalink }})"
{{ end }} {{ end }}
{{ end }}> {{ end }}>
<div class="article-header__title-wrapper{{ if .Params.title_in_logo }} article-header__title-wrapper--no-title{{ 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> <h2 class="article-header__title">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</h2>
</div> </div>
</div> </div>
</header> </header>
{{ else }} {{ else }}
<header class="site-content__header"> <header class="site-content__header">
<h2 class="page-title">{{ .Title | safeHTML }}.</h2> <h2 class="page-title">{{ .Title | safeHTML }}. {{ if not ( or ( eq .Type "cv" ) ( eq .Type "cv/organisations" ) ) -}}
{{ .Content }} {{- range .AlternativeOutputFormats -}}
{{ if eq .Type "cv" }} <a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<nav class="page-header__minor-links"> <img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
<ul> </a>
{{ range ( where .Sections "Type" "not in" ( slice "cv/roles" ) ).ByTitle }} {{- end -}}
<li><a href="{{ .RelPermalink }}"><h3>{{ .Title }}</h3></a> <p>({{ len (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) }})</p></li> {{- end -}}
{{ end }} </h2>
</ul> {{- .Content -}}
</nav>
{{ end }} {{- if ( and ( eq .Type "cv" ) ( not ( .IsDescendant ( .GetPage "/cv/organisations" ) ) ) ) -}}
{{ if eq .Type "cv" }} <nav class="page-header__minor-links">
<aside class="timeline__legend"> <ul>
<div> {{ range ( where .Sections "Type" "not in" ( slice "cv/roles" ) ).ByTitle }}
<label for="legend__past">Past</label> <li><a href="{{ .RelPermalink }}"><h3>{{ .Title }}</h3></a> <p>({{ len (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) }})</p></li>
<div id="legend__past"> {{ end }}
<span><div class="colour-square colour-square--unpaid-past"></div> <p>Unpaid</p></span> </ul>
<span><div class="colour-square colour-square--paid-past"></div> <p>Paid</p></span> </nav>
</div> {{- partialCached "cv/timeline-legend.html" . -}}
</div> {{- else -}}
<div> <nav class="page-header__minor-links">
<label for="legend__current">Current</label> {{- partial "years-list.html" . -}}
<div id="legend__current"> </nav>
<span><div class="colour-square colour-square--unpaid-current"></div> <p>Unpaid</p></span> {{- end -}}
<span><div class="colour-square colour-square--paid-current"></div> <p>Paid</p></span>
</div>
</div>
</aside>
{{ end }}
</header> </header>
{{ end }} {{ end }}
{{ end }} {{ end }}
@ -141,63 +135,47 @@
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }} {{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
{{ end }} {{ end }}
{{ .Scratch.Set "titles" $titles }} {{ .Scratch.Set "titles" $titles }}
<main id="organisation-body" class="site-content__body"> <main id="organisation-body" class="site-content__body">
<section id="description"> <section id="description">
{{ .Content }} {{ .Content }}
</section> </section>
<section id="roles-timeline"> <section id="roles-timeline">
<aside class="timeline__legend"> <div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
<div>
<label for="legend__past">Past</label>
<div id="legend__past">
<span><div class="colour-square colour-square--unpaid-past"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-past"></div> <p>Paid</p></span>
</div>
</div>
<div>
<label for="legend__current">Current</label>
<div id="legend__current">
<span><div class="colour-square colour-square--unpaid-current"></div> <p>Unpaid</p></span>
<span><div class="colour-square colour-square--paid-current"></div> <p>Paid</p></span>
</div>
</div>
</aside>
<div id="timeline" aria-label="Role Time" role="img">Javascript must be enabled to view this chart.</div>
</section> </section>
<section id="related" class="row"> <section id="related" class="row">
{{- $titles := .Scratch.Get "titles" -}} {{- $titles := .Scratch.Get "titles" -}}
{{ range (where ((.GetPage "blog").Sections) "Title" "Blog Posts") }} {{ range (where ((.GetPage "blog").Sections) "Title" "Blog Posts") }}
{{ $section_title := .Title }} {{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }} {{ with where (where ( where .Site.Pages "Section" "blog" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }} {{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range (where ((.GetPage "portfolio").Sections) "Title" "!=" "Appearances").ByTitle }} {{ range (where ((.GetPage "portfolio").Sections) "Title" "!=" "Appearances").ByTitle }}
{{ $section_title := .Title }} {{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }} {{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }} {{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range (where ((.GetPage "cv").Sections) "Title" "Qualifications") }} {{ range (where ((.GetPage "cv").Sections) "Title" "Qualifications") }}
{{ $section_title := .Title }} {{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }} {{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }} {{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range (where ((.GetPage "cv").Sections) "Title" "Awards") }} {{ range (where ((.GetPage "cv").Sections) "Title" "Awards") }}
{{ $section_title := .Title }} {{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }} {{ with where (where ( where .Site.Pages "Section" "cv" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
{{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }} {{ partial "cv/organisations/organisation-items.html" ( dict "section_title" $section_title "content" . ) }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ range (where ((.GetPage "portfolio").Sections) "Title" "Appearances").ByTitle }} {{ range (where ((.GetPage "portfolio").Sections) "Title" "Appearances").ByTitle }}
{{ $section_title := .Title }} {{ $section_title := .Title }}
{{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }} {{ with where (where ( where .Site.Pages "Section" "portfolio" ) "Parent.Title" .Title ) ".Params.organisations" "intersect" $titles }}
@ -206,19 +184,13 @@
{{ end }} {{ end }}
</section> </section>
</main> </main>
{{ else }} {{ else if eq .Type "cv" }}
{{ if eq .Type "cv" }} <article class="site-content__body site-content__body--chart">
<article class="site-content__body site-content__body--chart"> <div id="timeline" aria-label="Roles timeline" role="img">Javascript must be enabled to view this chart.</div>
<div id="timeline" aria-label="Roles Timeline" role="img">Javascript must be enabled to view this chart.</div> </article>
</article> {{ else }}
{{ else if eq .Type "cv/organisations" . }} {{ partial "items-grid.html" . }}
{{ with .GetPage "cv/organisations" }} {{ end }}
{{ partial "cv/organisations/items-table.html" . }}
{{ end }}
{{ else }}
{{ partial "items-grid.html" . }}
{{ end }}
{{ end }}
{{ end }} {{ end }}
{{ define "main-footer" }} {{ define "main-footer" }}
@ -227,9 +199,9 @@
<section id="hierarchy"> <section id="hierarchy">
<h3 class="subheading">Hierarchy</h3> <h3 class="subheading">Hierarchy</h3>
{{ $.Scratch.Set "parents" ( slice ) }} {{ $.Scratch.Set "parents" ( slice ) }}
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $ ) }} {{ partial "cv/organisations/recursive-parents.html" ( dict "c" . "g" $ ) }}
{{- $parents := partial "cv/organisations/reverse-slice.html" ( $.Scratch.Get "parents" ) -}} {{- $parents := partial "cv/organisations/reverse-slice.html" ( $.Scratch.Get "parents" ) -}}
{{- range $parents -}}<ul><li class="hierarchy-item hierarchy-item--parent"><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a>{{- end -}} {{- range $parents -}}<ul><li class="hierarchy-item hierarchy-item--parent"><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a>{{- end -}}
<ul><li class="hierarchy-item hierarchy-item--current">{{ .Title | safeHTML }}</li> <ul><li class="hierarchy-item hierarchy-item--current">{{ .Title | safeHTML }}</li>
{{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }} {{ range .Sections }}<ul>{{ partial "cv/organisations/recursive-children.html" . }}</ul>{{ end }}

View File

@ -34,5 +34,5 @@
</a> </a>
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- warnf "Invalid Schema.org type value %q for %q" $itemType .Params.title -}} {{- erroridf "invalid-schema-type" "Invalid Schema.org type value %q for %q" $itemType .Params.title -}}
{{- end -}} {{- end -}}

View File

@ -0,0 +1,13 @@
<!--. 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

@ -13,7 +13,7 @@
<tr> <tr>
<td> <td>
{{- if .Params.featured_image -}} {{- if .Params.featured_image -}}
<img width="150" height="auto" loading="lazy" src=" <img class="organisation-table__logo" loading="lazy" src="
{{- if .Resources.GetMatch .Params.featured_image -}} {{- if .Resources.GetMatch .Params.featured_image -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}} {{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}} {{- else -}}
@ -22,7 +22,13 @@
"> ">
{{- end -}} {{- end -}}
</td> </td>
<td><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a></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>
</td>
<td>{{- if gt (len .Sections) 0 -}}&#10004;{{- end -}}</td> <td>{{- if gt (len .Sections) 0 -}}&#10004;{{- end -}}</td>
<td></td> <td></td>
</tr> </tr>

View File

@ -1,9 +1,9 @@
{{ $titles := ( slice )}} {{ $titles := ( slice )}}
{{ range . }} {{ range . }}
{{ $titles = $titles | append (slice (.Title | plainify) )}} {{ $titles = $titles | append (slice ( .Title | plainify ) )}}
{{ with .Sections }} {{ if .Sections }}
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }} {{ $titles = $titles | append ( partialCached "cv/organisations/recursive-children-titles.html" .Sections .Title) }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -1,5 +1,5 @@
<li class="hierarchy-item hierarchy-item--child"><a href="{{ .RelPermalink }}">{{ with .Params.markup_title }}{{ . | safeHTML }}{{ else }}{{ .Title | safeHTML }}{{ end }}</a> <li class="hierarchy-item hierarchy-item--child"><a href="{{ .RelPermalink }}">{{ with .Params.markup_title }}{{ . | safeHTML }}{{ else }}{{ .Title | safeHTML }}{{ end }}</a>
{{ range .Sections }}<ul> {{- range .Sections -}}<ul>
{{ partial "cv/organisations/recursive-children.html" . }} {{- partialCached "cv/organisations/recursive-children.html" . .Title -}}
</ul>{{ end }} </ul>{{- end -}}
</li> </li>

View File

@ -6,7 +6,7 @@
{{ if ne .c.Parent.Type "cv/organisations" }} {{ if ne .c.Parent.Type "cv/organisations" }}
{{ with .c.Parent }} {{ with .c.Parent }}
{{ $scratch.Add "parents" ( slice . ) }} {{ $scratch.Add "parents" ( slice . ) }}
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $.g ) }} {{ partialCached "cv/organisations/recursive-parents.html" (dict "c" . "g" $.g ) .Title }}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -0,0 +1,16 @@
<aside class="timeline__legend">
<div>
<label for="legend__past">Past</label>
<div id="legend__past">
<button id="past-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-past"></span> Unpaid</p></button>
<button id="past-paid" class="legend__button"><p><span class="colour-square colour-square--paid-past"></span> Paid</p></button>
</div>
</div>
<div>
<label for="legend__current">Current</label>
<div id="legend__current">
<button id="current-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-current"></span> Unpaid</p></button>
<button id="current-paid" class="legend__button"><p><span class="colour-square colour-square--paid-current"></span> Paid</p></button>
</div>
</div>
</aside>

View File

@ -3,6 +3,12 @@
<h2 class="p-name site-header__title" itemprop="name"><a class="u-url" href="{{ .Site.Home.RelPermalink }}" rel="me author">{{ .Site.Title }}</a></h2> <h2 class="p-name site-header__title" itemprop="name"><a class="u-url" href="{{ .Site.Home.RelPermalink }}" rel="me author">{{ .Site.Title }}</a></h2>
<p class="p-note site-header__tagline" itemprop="about">Views my own. Discussion ≠ endorsement. Do try this at home.</p> <p class="p-note site-header__tagline" itemprop="about">Views my own. Discussion ≠ endorsement. Do try this at home.</p>
<p class="site-header__icons">~ <a class="u-email" href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~ <a class="u-url" href="{{ .Site.Params.codeURL }}" rel="me">&#128187;</a> ~ <a class="u-key" href="/{{ .Site.Params.keyfile }}" rel="me">&#128272;</a> ~ <a href="/index.xml" aria-label="{{ .Site.Title }} RSS feed"><img class="feed-icon" alt="RSS feed" src="{{ .Site.Params.feedIcon }}"></a> ~</p> <p class="site-header__icons">~ <a class="u-email" href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~ <a class="u-url" href="{{ .Site.Params.codeURL }}" rel="me">&#128187;</a> ~ <a class="u-key" href="/{{ .Site.Params.keyfile }}" rel="me">&#128272;</a> ~ <a href="/index.xml" aria-label="{{ .Site.Title }} RSS feed"><img class="feed-icon" alt="RSS feed" src="{{ .Site.Params.feedIcon }}"></a> ~</p>
{{ partial "header/site-nav.html" . }} <nav class="site-header__nav">
<ul>
{{ range ( where .Site.Sections.ByTitle "Type" "in" site.Params.mainSections ) }}
<li><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a></li>
{{ end }}
</ul>
</nav>
{{ end }} {{ end }}
</header> </header>

View File

@ -41,28 +41,28 @@
{{- end -}} {{- end -}}
{{- if .GetTerms "organisations" -}} {{- if .GetTerms "organisations" -}}
<section id="post-organisations" class="article-footer__organisations" aria-labelledby="post-organisations-title" itemprop="articleSection"> <section id="post-organisations" class="article-footer__organisations" itemprop="articleSection">
<h3 id="post-organisations-title">Organisations</h3> <h3>Organisations</h3>
<ul> <ul>
{{ $all_organisations := partialCached "get_all_organisations.html" . }} {{ $all_organisations := partialCached "get_all_organisations.html" . }}
<!-- TODO: Replace with hierarchy partial --> <!-- TODO: Replace with hierarchy partial -->
{{- range ( .GetTerms "organisations" ) -}} {{- range ( .GetTerms "organisations" ) -}}
{{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }} {{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }}
{{ range . }} {{ range . }}
<li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li> <li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li>
{{ end }}
{{ else }}
{{ warnf "Could not find organisation %q (%q)" .Title $.File.Path }}
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
{{ end }} {{ end }}
{{ else }}
{{ erroridf "missing-organisation" "Could not find organisation %q (%q)" .Title $.File.Path }}
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
{{ end }}
{{- end -}} {{- end -}}
</ul> </ul>
</section> </section>
{{- end -}} {{- end -}}
{{- if .GetTerms "locations" -}} {{- if .GetTerms "locations" -}}
<section id="post-locations" class="article-footer__locations" aria-labelledby="post-locations-title"> <section id="post-locations" class="article-footer__locations">
<h3 id="post-locations-title">Locations</h3> <h3>Locations</h3>
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div> <div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
<ul style="display: none"> <ul style="display: none">
{{- range ( .GetTerms "locations" ).ByTitle -}} {{- range ( .GetTerms "locations" ).ByTitle -}}
@ -73,8 +73,8 @@
{{- end -}} {{- end -}}
{{- if .GetTerms "tags" -}} {{- if .GetTerms "tags" -}}
<section id="post-tags" class="article-footer__tags" aria-labelledby="post-tags-title"> <section id="post-tags" class="article-footer__tags">
<h3 id="post-tags-title">Tags</h3> <h3>Tags</h3>
<ul> <ul>
{{- range ( .GetTerms "tags" ).ByTitle -}} {{- range ( .GetTerms "tags" ).ByTitle -}}
<li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li> <li class="p-category"><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>

View File

@ -1,3 +1,7 @@
{{- if ( not ( .Get "longdesc" ) ) -}}
{{- erroridf "a11y-chart-longdesc" "No longdesc found for chart '%q' (%q)" ( .Get "chart-id" ) .Page.File.Path -}}
{{- end -}}
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group"> <figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
{{- with .Get "chart-id" -}} {{- with .Get "chart-id" -}}
<canvas class="figure__chart" id="{{ . }}"> <canvas class="figure__chart" id="{{ . }}">

View File

@ -1 +1,11 @@
{{- /**/ -}}{{- partial "cite.html" . -}}{{- /**/ -}} {{- if .Params.title -}}
{{- if not $.Params.cite -}}
{{- erroridf "missing-cite" "No cite found for citation '%q' (%q)" .Params.title .Page.File.Path -}}
{{- end -}}
{{- else -}}
{{- errorf "No title found for citation (%q)" .Page.File.Path -}}
{{- end -}}
{{- $citeID := cond ( .Params.cite | not | not ) .Params.cite .Params.title -}}
{{- /**/ -}}{{- partialCached "cite.html" . $citeID -}}{{- /**/ -}}

View File

@ -51,7 +51,7 @@
{{- .RelPermalink -}} {{- .RelPermalink -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- warnf "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}} {{- erroridf "a11y-video-poster" "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}}
{{- end -}} {{- end -}}
" "
itemprop="video"> itemprop="video">