first version

This commit is contained in:
2020-02-26 23:41:42 +01:00
parent 8f7d784ed2
commit ca2764655a
16 changed files with 189 additions and 2 deletions

View File

@ -0,0 +1,10 @@
{{ $class := .Get "class" }}
{{ $body := .Get "text" | default .Inner }}
{{ $markdown := .Get "markdown" | default false }}
<div class="cell{{ with $class }} {{ . }}{{ end }}">
{{ if $markdown }}
{{ $.Page.RenderString .Inner }}
{{ else }}
{{ .Inner }}
{{ end }}
</div>

View File

@ -0,0 +1,39 @@
{{/* https://github.com/martignoni/hugo-cloak-email */}}
{{/* Get address, protocol and other parameters */}}
{{- $address := .Get "address" | default (.Get 0) -}}
{{- $protocol := .Get "protocol" | default "mailto" -}}
{{- $class := .Get "class" -}}
{{- $displaytext := .Get "display" -}}
{{- $parts := split $address "@" -}}
{{- $user := (index $parts 0) -}}
{{- $domain := (index $parts 1) | default "" -}}
{{- $query := .Get "query" | default "" -}}
{{/* Compute md5 fingerprint */}}
{{- $fingerprint := md5 (print (.Get "address") $protocol (index (seq 999 | shuffle) 0)) | truncate 8 "" -}}
{{/* Set via CSS what is displayed when Javascript is disabled. Query is never displayed */}}
<style type="text/css">
#id-{{ $fingerprint }}.cloaked-e-mail:before {
content:{{ with $domain }}attr(data-domain) "\0040" {{ end }}attr(data-user);
unicode-bidi:bidi-override;
direction:rtl;
}
</style>
&#32;<span class="cloaked-e-mail" data-user="{{ range $index := seq (sub (len $user) 1) 0}}{{ substr $user $index 1}}{{ end }}"{{ with $domain }} data-domain="{{ range $index := seq (sub (len $domain) 1) 0}}{{ substr $domain $index 1}}{{ end }}"{{ end }} id="id-{{ $fingerprint }}"></span>&#32;
{{/* Alter display with Javascript by changing DOM */}}
<script id="id-{{ $fingerprint }}">
var scriptTag = document.getElementById("id-{{ $fingerprint }}");
var link = document.createElement("a");
var address = "{{ range $index := seq (sub (len $user) 1) 0}}{{ substr $user $index 1}}{{ end }}".split('').reverse().join(''){{ with $domain }} + "@" + "{{ range $index := seq (sub (len $domain) 1) 0}}{{ substr $domain $index 1}}{{ end }}".split('').reverse().join(''){{ with $query }} + "?" + "{{ range $index := seq (sub (len $query) 1) 0}}{{ substr $query $index 1}}{{ end }}".split('').reverse().join(''){{ end }}{{ end }};
link.href = {{ $protocol }} + ":" + address;
{{ with $displaytext }}
link.innerText = {{ $displaytext }};
{{ else }}
link.innerText = address.split('?')[0];
{{ end }}
{{ with $class }}
link.className = "{{ $class }}";
{{ end }}
scriptTag.parentElement.insertBefore(link, scriptTag.previousElementSibling);
scriptTag.parentElement.removeChild(scriptTag.previousElementSibling)
</script>
{{/* The end */}}

View File

@ -0,0 +1,3 @@
{{ $class := .Get "class" }}
{{ $body := .Get "text" | default .Inner }}
<div class="grid{{ with $class }} {{ . }}{{ end }}">{{ $body }}</div>

View File

@ -0,0 +1,9 @@
{{ $file := .Get "fichier" }}
{{ $description := .Get "description" }}
{{ $width := .Get "taille" }}
{{ $file }}
{{ $description }}
{{ $width }}
Page : {{ .Page }}<br>
Context : {{ . }}<br>
Site : {{ resources.Get "apropors.png" }}<br>

View File

@ -0,0 +1,26 @@
{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }}
{{ $command := .Get 1 }}
{{ $options := .Get 2 }}
{{ if eq $command "Fit"}}
{{ .Scratch.Set "image" ($original.Fit $options) }}
{{ else if eq $command "Resize"}}
{{ .Scratch.Set "image" ($original.Resize $options) }}
{{ else if eq $command "Fill"}}
{{ .Scratch.Set "image" ($original.Fill $options) }}
{{ else }}
{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}}
{{ end }}
{{ $image := .Scratch.Get "image" }}
<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc">
<img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}">
<figcaption>
<small>
{{ with .Inner }}
{{ . }}
{{ else }}
.{{ $command }} "{{ $options }}"
{{ end }}
</small>
</figcaption>
</figure>

View File

@ -0,0 +1 @@
{{ now.Format "2006" }}