mirror of
https://github.com/Mibew/simple-icons.git
synced 2025-01-17 23:51:08 +03:00
Update filemapping, ampersand (#977)
* Replace ampersand to avoid problems with filenames Together with some examples as test * Revert filename changes for testing purposes
This commit is contained in:
parent
e6485072d2
commit
b339df0b61
16
index.html
16
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 %}
|
||||
|
@ -9,6 +9,9 @@ module.exports = {
|
||||
.replace(/^\./, "dot-")
|
||||
.replace(/\.$/, "-dot")
|
||||
.replace(/\./g, "-dot-")
|
||||
.replace(/^&/, "and-")
|
||||
.replace(/&$/, "-and")
|
||||
.replace(/&/g, "-and-")
|
||||
.replace(/[ !’]/g, "")
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user