1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-12-26 01:13:41 +02:00

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
This commit is contained in:
birjolaxew 2018-07-21 13:22:33 +02:00
parent 80fe9c2ff3
commit 276f7d05c6
No known key found for this signature in database
GPG Key ID: 548A6D4C439CC3DD

View File

@ -5,7 +5,16 @@
{% assign greyscaleIconsUnsortedString = "" %} {% assign greyscaleIconsUnsortedString = "" %}
{% for icon in site.data.simple-icons.icons %} {% for icon in site.data.simple-icons.icons %}
{% assign title = icon.title %} {% 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 hex = icon.hex %} {% assign hex = icon.hex %}
{% assign hexCharacter1 = hex | slice: 0, 1 %} {% assign hexCharacter1 = hex | slice: 0, 1 %}