From 39dafc56e0a66c625adf8e60e47722ce5cbb83e3 Mon Sep 17 00:00:00 2001 From: Pau Trepat Segura Date: Sun, 21 Jun 2020 20:08:11 +0200 Subject: [PATCH] Simplify code removing duplicated templates --- layouts/partials/experiences.html | 23 ++++++++----------- ...right-h-line.html => horizontal-line.html} | 0 .../experiences/right-to-left-h-line.html | 11 --------- .../partials/experiences/right-v-line.html | 3 --- .../{left-v-line.html => vertical-line.html} | 0 5 files changed, 10 insertions(+), 27 deletions(-) rename layouts/partials/experiences/{left-to-right-h-line.html => horizontal-line.html} (100%) delete mode 100644 layouts/partials/experiences/right-to-left-h-line.html delete mode 100644 layouts/partials/experiences/right-v-line.html rename layouts/partials/experiences/{left-v-line.html => vertical-line.html} (100%) diff --git a/layouts/partials/experiences.html b/layouts/partials/experiences.html index 3eedca8..91ad594 100644 --- a/layouts/partials/experiences.html +++ b/layouts/partials/experiences.html @@ -3,24 +3,21 @@

Experiences

- {{ $total:= len .Site.Data.experiences.experiences }} - {{ range $idx,$val:= .Site.Data.experiences.experiences }} - {{ if eq (mod $idx 2) 0 }} + {{ $totalExperiences:= len .Site.Data.experiences.experiences }} + {{ range $index,$experience:= .Site.Data.experiences.experiences }} + {{ if eq (mod $index 2) 0 }}
- {{ partial "experiences/left-v-line.html" $idx }} - {{ partial "experiences/experience-info.html" $val }} + {{ partial "experiences/vertical-line.html" $index }} + {{ partial "experiences/experience-info.html" $experience }}
- {{ if lt $idx (sub $total 1) }} - {{ partial "experiences/left-to-right-h-line.html" $idx }} - {{ end }} {{else}}
- {{ partial "experiences/experience-info.html" $val }} - {{ partial "experiences/right-v-line.html" $idx }} + {{ partial "experiences/experience-info.html" $experience }} + {{ partial "experiences/vertical-line.html" $index }}
- {{ if lt $idx (sub $total 1) }} - {{ partial "experiences/right-to-left-h-line.html" $idx }} - {{ end }} + {{ end }} + {{ if lt $index (sub $totalExperiences 1) }} + {{ partial "experiences/horizontal-line.html" $index }} {{ end }} {{ end }}
diff --git a/layouts/partials/experiences/left-to-right-h-line.html b/layouts/partials/experiences/horizontal-line.html similarity index 100% rename from layouts/partials/experiences/left-to-right-h-line.html rename to layouts/partials/experiences/horizontal-line.html diff --git a/layouts/partials/experiences/right-to-left-h-line.html b/layouts/partials/experiences/right-to-left-h-line.html deleted file mode 100644 index 95f13ae..0000000 --- a/layouts/partials/experiences/right-to-left-h-line.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
-
-
-
-
-
-
-
diff --git a/layouts/partials/experiences/right-v-line.html b/layouts/partials/experiences/right-v-line.html deleted file mode 100644 index 7d8b74b..0000000 --- a/layouts/partials/experiences/right-v-line.html +++ /dev/null @@ -1,3 +0,0 @@ -
-
{{ add . 1 }}
-
diff --git a/layouts/partials/experiences/left-v-line.html b/layouts/partials/experiences/vertical-line.html similarity index 100% rename from layouts/partials/experiences/left-v-line.html rename to layouts/partials/experiences/vertical-line.html