From ca2764655a7b216695e55a7413c551f634330296 Mon Sep 17 00:00:00 2001 From: Simon C Date: Wed, 26 Feb 2020 23:41:42 +0100 Subject: [PATCH] first version --- archetypes/default.md | 2 -- assets/styles/grid.scss | 41 +++++++++++++++++++++++ assets/styles/main.sass | 1 + layouts/404.html | 0 layouts/_default/list.html | 0 layouts/_default/single.html | 0 layouts/index.html | 0 layouts/partials/head.html | 10 ++++++ layouts/partials/social_metadata.html | 47 +++++++++++++++++++++++++++ layouts/partials/style.html | 2 ++ layouts/shortcodes/cell.html | 10 ++++++ layouts/shortcodes/cloakemail.html | 39 ++++++++++++++++++++++ layouts/shortcodes/grid.html | 3 ++ layouts/shortcodes/image.html | 9 +++++ layouts/shortcodes/imgproc.html | 26 +++++++++++++++ layouts/shortcodes/year.html | 1 + 16 files changed, 189 insertions(+), 2 deletions(-) delete mode 100644 archetypes/default.md create mode 100644 assets/styles/grid.scss create mode 100644 assets/styles/main.sass delete mode 100644 layouts/404.html delete mode 100644 layouts/_default/list.html delete mode 100644 layouts/_default/single.html delete mode 100644 layouts/index.html create mode 100644 layouts/partials/social_metadata.html create mode 100644 layouts/partials/style.html create mode 100644 layouts/shortcodes/cell.html create mode 100644 layouts/shortcodes/cloakemail.html create mode 100644 layouts/shortcodes/grid.html create mode 100644 layouts/shortcodes/image.html create mode 100644 layouts/shortcodes/imgproc.html create mode 100644 layouts/shortcodes/year.html diff --git a/archetypes/default.md b/archetypes/default.md deleted file mode 100644 index ac36e06..0000000 --- a/archetypes/default.md +++ /dev/null @@ -1,2 +0,0 @@ -+++ -+++ diff --git a/assets/styles/grid.scss b/assets/styles/grid.scss new file mode 100644 index 0000000..1fc038b --- /dev/null +++ b/assets/styles/grid.scss @@ -0,0 +1,41 @@ +.grid { display: flex; flex-wrap: wrap; } +.grid.\-top { align-items: flex-start; } +.grid.\-middle { align-items: center; } +.grid.\-bottom { align-items: flex-end; } +.grid.\-stretch { align-items: stretch; } +.grid.\-baseline { align-items: baseline; } +.grid.\-left { justify-content: flex-start; } +.grid.\-center { justify-content: center; } +.grid.\-right { justify-content: flex-end; } +.grid.\-between { justify-content: space-between; } +.grid.\-around { justify-content: space-around; } + +.cell { flex: 1; box-sizing: border-box; } +.cell.\-left { text-align: left ;} +.cell.\-right { text-align: right; } +.cell.\-center { text-align: center ;} +.cell img { max-width: 100% } + +@media screen and (min-width: 600px) { + .\-even-reverse:nth-child(even) { flex-direction: row-reverse; } + .cell.\-1of12 { flex: 0 0 calc(100% * 1 / 12); } + .cell.\-2of12 { flex: 0 0 calc(100% * 2 / 12); } + .cell.\-3of12 { flex: 0 0 calc(100% * 3 / 12); } + .cell.\-4of12 { flex: 0 0 calc(100% * 4 / 12); } + .cell.\-5of12 { flex: 0 0 calc(100% * 5 / 12); } + .cell.\-6of12 { flex: 0 0 calc(100% * 6 / 12); } + .cell.\-7of12 { flex: 0 0 calc(100% * 7 / 12); } + .cell.\-8of12 { flex: 0 0 calc(100% * 8 / 12); } + .cell.\-9of12 { flex: 0 0 calc(100% * 9 / 12); } + .cell.\-10of12 { flex: 0 0 calc(100% * 10 / 12); } + .cell.\-11of12 { flex: 0 0 calc(100% * 11 / 12); } +} + +@media screen and (max-width: 599px) { + .grid { + flex-direction: column; + } + .cell { + flex: 0 0 auto; + } +} diff --git a/assets/styles/main.sass b/assets/styles/main.sass new file mode 100644 index 0000000..e2970a7 --- /dev/null +++ b/assets/styles/main.sass @@ -0,0 +1 @@ +@import "./grid" diff --git a/layouts/404.html b/layouts/404.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/_default/list.html b/layouts/_default/list.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/_default/single.html b/layouts/_default/single.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index e69de29..0000000 diff --git a/layouts/partials/head.html b/layouts/partials/head.html index e69de29..9cc2edb 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -0,0 +1,10 @@ + + + + + + + + +{{ partial "social_metadata.html" . }} +{{ partial "style.html" . }} diff --git a/layouts/partials/social_metadata.html b/layouts/partials/social_metadata.html new file mode 100644 index 0000000..fef9cba --- /dev/null +++ b/layouts/partials/social_metadata.html @@ -0,0 +1,47 @@ + + +{{ if .Site.Params.TwitterCardType }} + +{{ else }} + +{{ end }} +{{ if .Site.Params.TwitterUsername }} + +{{ end }} +{{ if .IsHome }} +{{ .Site.Title }} + + + + + + + + + + +{{ else }} +{{ .Title }} · {{ .Site.Title }} + +{{ if .Params.tags }} + +{{ else }} + +{{ end }} + + + +{{ if .Description }} + + +{{ else }} + + +{{ end }} + +{{ if .Params.SocialImage }} + +{{ else }} + +{{ end }} +{{ end }} diff --git a/layouts/partials/style.html b/layouts/partials/style.html new file mode 100644 index 0000000..43ea100 --- /dev/null +++ b/layouts/partials/style.html @@ -0,0 +1,2 @@ +{{ $style := resources.Get "css/main.sass" | toCSS | minify | fingerprint }} + diff --git a/layouts/shortcodes/cell.html b/layouts/shortcodes/cell.html new file mode 100644 index 0000000..f05f490 --- /dev/null +++ b/layouts/shortcodes/cell.html @@ -0,0 +1,10 @@ +{{ $class := .Get "class" }} +{{ $body := .Get "text" | default .Inner }} +{{ $markdown := .Get "markdown" | default false }} +
+ {{ if $markdown }} + {{ $.Page.RenderString .Inner }} + {{ else }} + {{ .Inner }} + {{ end }} +
diff --git a/layouts/shortcodes/cloakemail.html b/layouts/shortcodes/cloakemail.html new file mode 100644 index 0000000..807fc20 --- /dev/null +++ b/layouts/shortcodes/cloakemail.html @@ -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 */}} + + +{{/* Alter display with Javascript by changing DOM */}} + +{{/* The end */}} diff --git a/layouts/shortcodes/grid.html b/layouts/shortcodes/grid.html new file mode 100644 index 0000000..79e0ad7 --- /dev/null +++ b/layouts/shortcodes/grid.html @@ -0,0 +1,3 @@ +{{ $class := .Get "class" }} +{{ $body := .Get "text" | default .Inner }} +
{{ $body }}
diff --git a/layouts/shortcodes/image.html b/layouts/shortcodes/image.html new file mode 100644 index 0000000..2ad4fc3 --- /dev/null +++ b/layouts/shortcodes/image.html @@ -0,0 +1,9 @@ +{{ $file := .Get "fichier" }} +{{ $description := .Get "description" }} +{{ $width := .Get "taille" }} +{{ $file }} +{{ $description }} +{{ $width }} +Page : {{ .Page }}
+Context : {{ . }}
+Site : {{ resources.Get "apropors.png" }}
diff --git a/layouts/shortcodes/imgproc.html b/layouts/shortcodes/imgproc.html new file mode 100644 index 0000000..69efef3 --- /dev/null +++ b/layouts/shortcodes/imgproc.html @@ -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" }} +
+ +
+ + {{ with .Inner }} + {{ . }} + {{ else }} + .{{ $command }} "{{ $options }}" + {{ end }} + +
+
diff --git a/layouts/shortcodes/year.html b/layouts/shortcodes/year.html new file mode 100644 index 0000000..6b40db5 --- /dev/null +++ b/layouts/shortcodes/year.html @@ -0,0 +1 @@ +{{ now.Format "2006" }}