diff --git a/index.html b/index.html index 0099d379..067971eb 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,10 @@ {% assign greyscaleIconsUnsortedString = "" %} {% for icon in site.data.simple-icons.icons %} {% assign title = icon.title %} + {% assign filename = icon.title %} + + {% comment %} Replace a period by 'dot' {% endcomment %} {% assign _splitFilename = filename | split: "" %} {% if _splitFilename.first == "." %} {% assign filename = filename | replace_first: ".", "dot-" %} @@ -14,7 +17,18 @@ {% 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 %} + + {% comment %} Replace an ampersand by 'and' {% endcomment %} + {% if _splitFilename.first == "&" %} + {% assign filename = filename | replace_first: "&", "and-" %} + {% endif %} + {% if _splitFilename.last == "&" %} + {% assign _filenameLenMin1 = filename | size | minus: 1 %} + {% assign filename = filename | slice: 0, _filenameLenMin1 | append: "-and" %} + {% endif %} + + {% assign filename = filename | replace: "+", "plus" | replace: " ", "" | replace: ".", "-dot-" | replace: "&", "-and-" | replace: "!", "" | replace: "’", "" | downcase %} + {% assign hex = icon.hex %} {% assign hex = icon.hex %} {% assign hexCharacter1 = hex | slice: 0, 1 %} diff --git a/scripts/utils.js b/scripts/utils.js index 9cd21c9e..f8c6d775 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -9,6 +9,9 @@ module.exports = { .replace(/^\./, "dot-") .replace(/\.$/, "-dot") .replace(/\./g, "-dot-") + .replace(/^&/, "and-") + .replace(/&$/, "-and") + .replace(/&/g, "-and-") .replace(/[ !’]/g, "") ) }