From 276f7d05c62830dad0c9e273c5deda2939a382be Mon Sep 17 00:00:00 2001 From: birjolaxew Date: Sat, 21 Jul 2018 13:22:33 +0200 Subject: [PATCH] Remove potentional extra dashes from title->filename mapping Removes dashes at start/end of filename that would appear as result of mapping This is *very* hacky, but such is Jekyll --- index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index a057ba060..10d46ba1b 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,16 @@ {% assign greyscaleIconsUnsortedString = "" %} {% for icon in site.data.simple-icons.icons %} {% assign title = icon.title %} - {% assign filename = icon.title | replace: "+", "plus" | replace: " ", "" | replace: ".", "-dot-" | replace: "!", "" | replace: "’", "" | downcase %} + {% assign filename = icon.title %} + {% assign _splitFilename = filename | split: "" %} + {% if _splitFilename.first == "." %} + {% assign filename = filename | replace_first: ".", "dot-" %} + {% endif %} + {% if _splitFilename.last == "." %} + {% assign _filenameLenMin1 = filename | size | minus: 1 %} + {% assign filename = filename | slice: 0, _filenameLenMin1 | append: "-dot" %} + {% endif %} + {% assign filename = filename | replace: "+", "plus" | replace: " ", "" | replace: ".", "-dot-" | replace: "!", "" | replace: "’", "" | downcase %} {% assign hex = icon.hex %} {% assign hex = icon.hex %} {% assign hexCharacter1 = hex | slice: 0, 1 %}