Disallow Hyphens in File Names (#5121)

This commit is contained in:
Peter Noble 2021-05-05 11:22:54 +01:00 committed by GitHub
parent 1009182803
commit ead1170a2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 37 deletions

View file

@ -13,7 +13,7 @@
"slug": {
"description": "The brand name slug (used as filename in icons/)",
"type": "string",
"pattern": "^[a-z0-9\\-]+_[a-z0-9\\-]+$",
"pattern": "^[a-z0-9\\-]+(_[a-z0-9\\-]+)?$",
"required": false
},
"hex": {

View file

@ -201,19 +201,19 @@ The filename of the SVG should correspond to the `<title>` used in the markup fi
filename: citroen.svg
```
1. Replace the following symbols with their alias depending on their position in the title:
1. Replace the following symbols with their alias:
| Symbol | Start | Middle | End |
| :----: | :---- | :----: | ---: |
| + | plus | plus | plus |
| . | dot- | -dot- | -dot |
| & | and- | -and- | -and |
| Symbol | Alias |
| :----: | ----- |
| + | plus |
| . | dot |
| & | and |
for example:
```yml
title: .Net
filename: dot-net.svg
filename: dotnet.svg
```
1. On rare occasions the resulting name will clash with the name of an existing SVG file in our collection. To resolve such conflicts append `_[MODIFIER]` to the name, where `[MODIFIER]` is a short descriptor of the brand or the service they provide and follows the same rules of construction as above.

View file

@ -2,6 +2,7 @@
"icons": [
{
"title": ".NET",
"slug": "dot-net",
"hex": "512BD4",
"source": "https://github.com/dotnet/brand/"
},
@ -37,6 +38,7 @@
},
{
"title": "A-Frame",
"slug": "a-frame",
"hex": "EF2D5E",
"source": "https://aframe.io/docs/"
},
@ -57,6 +59,7 @@
},
{
"title": "About.me",
"slug": "about-dot-me",
"hex": "00A98F",
"source": "https://about.me/assets"
},
@ -332,6 +335,7 @@
},
{
"title": "Alibaba.com",
"slug": "alibaba-dot-com",
"hex": "FF6A00",
"source": "https://www.alibabagroup.com/en/ir/reports"
},
@ -811,6 +815,7 @@
},
{
"title": "AT&T",
"slug": "at-and-t",
"hex": "009FDB",
"source": "https://www.att.com"
},
@ -846,6 +851,7 @@
},
{
"title": "Audio-Technica",
"slug": "audio-technica",
"hex": "000000",
"source": "https://wikipedia.org/wiki/File:Audio-technica.svg"
},
@ -946,6 +952,7 @@
},
{
"title": "B&R Automation",
"slug": "b-and-rautomation",
"hex": "FF8800",
"source": "https://www.br-automation.com/"
},
@ -1026,6 +1033,7 @@
},
{
"title": "Battle.net",
"slug": "battle-dot-net",
"hex": "00AEFF",
"source": "https://www.blizzard.com/en-gb/"
},
@ -1167,6 +1175,7 @@
},
{
"title": "Blockchain.com",
"slug": "blockchain-dot-com",
"hex": "121D33",
"source": "https://www.blockchain.com/",
"guidelines": "https://www.blockchain.com/en/press"
@ -1248,6 +1257,7 @@
},
{
"title": "Brand.ai",
"slug": "brand-dot-ai",
"hex": "0AA0FF",
"source": "https://brand.ai/brand-ai/style"
},
@ -1473,6 +1483,7 @@
},
{
"title": "Chart.js",
"slug": "chart-dot-js",
"hex": "FF6384",
"source": "https://www.chartjs.org/"
},
@ -1665,6 +1676,7 @@
},
{
"title": "Co-op",
"slug": "co-op",
"hex": "00B1E7",
"source": "http://www.co-operative.coop/corporate/press/logos/"
},
@ -1848,6 +1860,7 @@
},
{
"title": "Conda-Forge",
"slug": "conda-forge",
"hex": "000000",
"source": "https://github.com/conda-forge/conda-forge.github.io/"
},
@ -1910,6 +1923,7 @@
},
{
"title": "Counter-Strike",
"slug": "counter-strike",
"hex": "000000",
"source": "https://en.wikipedia.org/wiki/File:CS-GO_Logo.svg"
},
@ -2015,11 +2029,13 @@
},
{
"title": "D-Wave Systems",
"slug": "d-wavesystems",
"hex": "008CD7",
"source": "https://www.dwavesys.com/"
},
{
"title": "D3.js",
"slug": "d3-dot-js",
"hex": "F9A03C",
"source": "https://github.com/d3/d3-logo"
},
@ -2212,6 +2228,7 @@
},
{
"title": "dev.to",
"slug": "dev-dot-to",
"hex": "0A0A0A",
"source": "https://dev.to/"
},
@ -2243,6 +2260,7 @@
},
{
"title": "diagrams.net",
"slug": "diagrams-dot-net",
"hex": "F08705",
"source": "https://github.com/jgraph/drawio/blob/4743eba8d5eaa497dc003df7bf7295b695c59bea/src/main/webapp/images/drawlogo.svg"
},
@ -2263,6 +2281,7 @@
},
{
"title": "Digi-Key Electronics",
"slug": "digi-keyelectronics",
"hex": "CC0000",
"source": "https://www.digikey.com/"
},
@ -2354,6 +2373,7 @@
},
{
"title": "Draugiem.lv",
"slug": "draugiem-dot-lv",
"hex": "FF6600",
"source": "https://www.frype.com/applications/dev/docs/logos/"
},
@ -2459,6 +2479,7 @@
},
{
"title": "Eclipse Vert.x",
"slug": "eclipsevert-dot-x",
"hex": "782A90",
"source": "https://github.com/vert-x3/.github/blob/1ad6612d87f35665e50a00fc32eb9c542556385d/workflow-templates/vertx-favicon.svg"
},
@ -2559,6 +2580,7 @@
},
{
"title": "Ember.js",
"slug": "ember-dot-js",
"hex": "E04E39",
"source": "https://emberjs.com/logos/",
"guidelines": "https://emberjs.com/logos/"
@ -2716,11 +2738,13 @@
},
{
"title": "F-Droid",
"slug": "f-droid",
"hex": "1976D2",
"source": "https://f-droid.org/"
},
{
"title": "F-Secure",
"slug": "f-secure",
"hex": "00BAFF",
"source": "https://vip.f-secure.com/en/marketing/logos"
},
@ -2836,6 +2860,7 @@
},
{
"title": "Ferrari N.V.",
"slug": "ferrarin-dot-v-dot",
"hex": "EB2E2C",
"source": "https://corporate.ferrari.com/"
},
@ -3058,6 +3083,7 @@
},
{
"title": "Fraunhofer-Gesellschaft",
"slug": "fraunhofer-gesellschaft",
"hex": "179C7D",
"source": "https://www.fraunhofer.de/"
},
@ -3073,6 +3099,7 @@
},
{
"title": "freedesktop.org",
"slug": "freedesktop-dot-org",
"hex": "3B80AE",
"source": "https://commons.wikimedia.org/wiki/File:Freedesktop-logo.svg"
},
@ -3348,6 +3375,7 @@
},
{
"title": "GOG.com",
"slug": "gog-dot-com",
"hex": "86328A",
"source": "https://www.cdprojekt.com/en/media/logotypes/"
},
@ -3558,6 +3586,7 @@
},
{
"title": "GOV.UK",
"slug": "gov-dot-uk",
"hex": "005EA5",
"source": "https://github.com/alphagov/design-assets/tree/master/Icons"
},
@ -3902,6 +3931,7 @@
},
{
"title": "Hotels.com",
"slug": "hotels-dot-com",
"hex": "D32F2F",
"source": "https://en.wikipedia.org/wiki/File:Hotels.com_logo.svg"
},
@ -4259,6 +4289,7 @@
},
{
"title": "Itch.io",
"slug": "itch-dot-io",
"hex": "FA5C5C",
"source": "https://itch.io/press-kit",
"guidelines": "https://itch.io/press-kit"
@ -4670,6 +4701,7 @@
},
{
"title": "Ko-fi",
"slug": "ko-fi",
"hex": "FF5E5B",
"source": "https://more.ko-fi.com/brand-assets",
"guidelines": "https://more.ko-fi.com/brand-assets"
@ -4774,6 +4806,7 @@
},
{
"title": "Last.fm",
"slug": "last-dot-fm",
"hex": "D51007",
"source": "https://commons.wikimedia.org/wiki/File:Lastfm_logo.svg"
},
@ -4865,6 +4898,7 @@
},
{
"title": "Libraries.io",
"slug": "libraries-dot-io",
"hex": "337AB7",
"source": "https://github.com/librariesio/libraries.io/blob/9ab0f659bb7fe137c15cf676612b6811f501a0bd/public/safari-pinned-tab.svg"
},
@ -5096,6 +5130,7 @@
},
{
"title": "Mail.Ru",
"slug": "mail-dot-ru",
"hex": "005FF9",
"source": "https://my.mail.ru"
},
@ -5203,6 +5238,7 @@
},
{
"title": "Material-UI",
"slug": "material-ui",
"hex": "0081CB",
"source": "https://material-ui.com/"
},
@ -5240,6 +5276,7 @@
},
{
"title": "Max-Planck-Gesellschaft",
"slug": "max-planck-gesellschaft",
"hex": "006C66",
"source": "https://www.mpg.de"
},
@ -5377,6 +5414,7 @@
},
{
"title": "Micro.blog",
"slug": "micro-dot-blog",
"hex": "FF8800",
"source": "https://help.micro.blog/"
},
@ -5537,6 +5575,7 @@
},
{
"title": "MobX-State-Tree",
"slug": "mobx-state-tree",
"hex": "FF7102",
"source": "https://github.com/mobxjs/mobx-state-tree/blob/666dabd60a7fb87faf83d177c14f516481b5f141/website/static/img/mobx-state-tree-logo.svg"
},
@ -5772,6 +5811,7 @@
},
{
"title": "New Japan Pro-Wrestling",
"slug": "newjapanpro-wrestling",
"hex": "FF160B",
"source": "https://en.wikipedia.org/wiki/File:NJPW_World_Logo.svg"
},
@ -5788,6 +5828,7 @@
},
{
"title": "Next.js",
"slug": "next-dot-js",
"hex": "000000",
"source": "https://nextjs.org/"
},
@ -5866,11 +5907,13 @@
},
{
"title": "Node-RED",
"slug": "node-red",
"hex": "8F0000",
"source": "https://nodered.org/about/resources/"
},
{
"title": "Node.js",
"slug": "node-dot-js",
"hex": "339933",
"source": "https://nodejs.org/en/about/resources/",
"guidelines": "https://nodejs.org/en/about/resources/"
@ -5959,6 +6002,7 @@
},
{
"title": "Nuxt.js",
"slug": "nuxt-dot-js",
"hex": "00C58E",
"source": "https://nuxtjs.org/design"
},
@ -6258,6 +6302,7 @@
},
{
"title": "p5.js",
"slug": "p5-dot-js",
"hex": "ED225D",
"source": "https://p5js.org"
},
@ -6325,6 +6370,7 @@
},
{
"title": "Parse.ly",
"slug": "parse-dot-ly",
"hex": "5BA745",
"source": "https://www.parse.ly/press-kit",
"guidelines": "https://www.parse.ly/press-kit"
@ -6466,12 +6512,14 @@
},
{
"title": "Pi-hole",
"slug": "pi-hole",
"hex": "96060C",
"source": "https://docs.pi-hole.net",
"guidelines": "https://pi-hole.net/trademark-rules-and-brand-guidelines/"
},
{
"title": "Picarto.TV",
"slug": "picarto-dot-tv",
"hex": "1DA456",
"source": "https://picarto.tv/site/press"
},
@ -6572,6 +6620,7 @@
},
{
"title": "Player.me",
"slug": "player-dot-me",
"hex": "C0379A",
"source": "https://player.me/p/about-us"
},
@ -6742,11 +6791,13 @@
},
{
"title": "pr.co",
"slug": "pr-dot-co",
"hex": "0080FF",
"source": "https://news.pr.co/media_kits"
},
{
"title": "pre-commit",
"slug": "pre-commit",
"hex": "FAB040",
"source": "https://github.com/pre-commit/pre-commit.com/blob/f263cdbcf46f97e1bd6229f2ab6d27bf8290ca88/logo.svg"
},
@ -6846,11 +6897,13 @@
},
{
"title": "Proto.io",
"slug": "proto-dot-io",
"hex": "34A7C1",
"source": "https://proto.io/en/presskit"
},
{
"title": "protocols.io",
"slug": "protocols-dot-io",
"hex": "4D9FE7",
"source": "https://www.protocols.io/brand",
"guidelines": "https://www.protocols.io/brand"
@ -7211,6 +7264,7 @@
},
{
"title": "Redux-Saga",
"slug": "redux-saga",
"hex": "999999",
"source": "https://github.com/redux-saga/redux-saga/blob/9d2164946f402e594a0dfe453c6d20fb6f14858f/logo/3840/Redux-Saga-Logo.png"
},
@ -7247,6 +7301,7 @@
},
{
"title": "repl.it",
"slug": "repl-dot-it",
"hex": "667881",
"source": "https://repl.it/"
},
@ -7272,6 +7327,7 @@
},
{
"title": "reveal.js",
"slug": "reveal-dot-js",
"hex": "F2E142",
"source": "https://revealjs.com/"
},
@ -7351,6 +7407,7 @@
},
{
"title": "Rocket.Chat",
"slug": "rocket-dot-chat",
"hex": "F5455C",
"source": "https://rocket.chat/press",
"guidelines": "https://docs.rocket.chat/guides/brand-and-visual-guidelines/logo"
@ -7363,11 +7420,13 @@
},
{
"title": "Rolls-Royce",
"slug": "rolls-royce",
"hex": "281432",
"source": "https://www.rolls-roycemotorcars.com/"
},
{
"title": "rollup.js",
"slug": "rollup-dot-js",
"hex": "EC4A3F",
"source": "https://rollupjs.org/"
},
@ -7530,6 +7589,7 @@
},
{
"title": "Sat.1",
"slug": "sat-dot-1",
"hex": "047DA3",
"source": "https://www.prosiebensat1.com/presse/downloads/logos"
},
@ -7555,6 +7615,7 @@
},
{
"title": "scikit-learn",
"slug": "scikit-learn",
"hex": "F7931E",
"source": "https://github.com/scikit-learn/scikit-learn/blob/c5ef2e985c13119001aa697e446ebb3dbcb326e5/doc/logos/scikit-learn-logo.svg"
},
@ -7646,6 +7707,7 @@
},
{
"title": "semantic-release",
"slug": "semantic-release",
"hex": "494949",
"source": "https://github.com/semantic-release/semantic-release/blob/85bc213f04445a9bb8f19e5d45d6ecd7acccf841/media/semantic-release-logo.svg"
},
@ -7732,6 +7794,7 @@
},
{
"title": "Shields.io",
"slug": "shields-dot-io",
"hex": "000000",
"source": "https://shields.io"
},
@ -7936,6 +7999,7 @@
},
{
"title": "Socket.io",
"slug": "socket-dot-io",
"hex": "010101",
"source": "https://socket.io"
},
@ -8326,6 +8390,7 @@
},
{
"title": "styled-components",
"slug": "styled-components",
"hex": "DB7093",
"source": "https://www.styled-components.com/"
},
@ -8467,6 +8532,7 @@
},
{
"title": "T-Mobile",
"slug": "t-mobile",
"hex": "E20074",
"source": "https://www.t-mobile.com/"
},
@ -8679,6 +8745,7 @@
},
{
"title": "Three.js",
"slug": "three-dot-js",
"hex": "000000",
"source": "https://github.com/mrdoob/three.js/blob/a567b810cfcb7f6a03e4faea99f03c53081da477/files/icon.svg"
},
@ -8800,6 +8867,7 @@
},
{
"title": "TP-Link",
"slug": "tp-link",
"hex": "4ACBD6",
"source": "https://www.tp-link.com/"
},
@ -8866,6 +8934,7 @@
},
{
"title": "Trip.com",
"slug": "trip-dot-com",
"hex": "287DFA",
"source": "https://careers.trip.com/"
},
@ -8911,6 +8980,7 @@
},
{
"title": "ts-node",
"slug": "ts-node",
"hex": "3178C6",
"source": "https://typestrong.org/ts-node/"
},
@ -9346,6 +9416,7 @@
},
{
"title": "Vue.js",
"slug": "vue-dot-js",
"hex": "4FC08D",
"source": "https://github.com/vuejs/art",
"license": {
@ -9401,6 +9472,7 @@
},
{
"title": "Warner Bros.",
"slug": "warnerbros-dot",
"hex": "004DB4",
"source": "https://www.warnerbros.com/"
},
@ -9438,6 +9510,7 @@
},
{
"title": "webcomponents.org",
"slug": "webcomponents-dot-org",
"hex": "29ABE2",
"source": "https://www.webcomponents.org/"
},
@ -9496,6 +9569,7 @@
},
{
"title": "Weights & Biases",
"slug": "weights-and-biases",
"hex": "FFBE00",
"source": "https://wandb.ai/"
},
@ -9682,6 +9756,7 @@
},
{
"title": "write.as",
"slug": "write-dot-as",
"hex": "5BC4EE",
"source": "https://write.as/brand",
"guidelines": "https://write.as/brand"
@ -9693,11 +9768,13 @@
},
{
"title": "X-Pack",
"slug": "x-pack",
"hex": "005571",
"source": "https://www.elastic.co/brand"
},
{
"title": "X.Org",
"slug": "x-dot-org",
"hex": "F28834",
"source": "https://upload.wikimedia.org/wikipedia/commons/9/90/X.Org_Logo.svg"
},
@ -9828,6 +9905,7 @@
},
{
"title": "YourTravel.TV",
"slug": "yourtravel-dot-tv",
"hex": "F79025",
"source": "https://yourtravel.tv"
},
@ -9858,6 +9936,7 @@
},
{
"title": "Z-Wave",
"slug": "z-wave",
"hex": "1B365D",
"source": "https://www.z-wave.com/"
},

View file

@ -9,25 +9,6 @@
{% assign filename = icon.title %}
{% comment %} Replace a period by 'dot' {% endcomment %}
{% 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 %}
{% 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 | downcase %}
{% assign filename = filename | replace: "à", "a" | replace: "á", "a" | replace: "â", "a" | replace: "ã", "a" | replace: "ä", "a" | replace: "ā", "a" | replace: "ă", "a" | replace: "ą", "a" %}
{% assign filename = filename | replace: "ç", "c" | replace: "ć", "c" | replace: "ĉ", "c" | replace: "ċ", "c" | replace: "č", "c" %}
@ -52,8 +33,8 @@
{% assign searchTerm = filename %}
{% assign filename = filename | replace: "+", "plus" %}
{% assign filename = filename | replace: ".", "-dot-" %}
{% assign filename = filename | replace: "&", "-and-" %}
{% assign filename = filename | replace: ".", "dot" %}
{% assign filename = filename | replace: "&", "and" %}
{% assign filename = filename | replace: " ", "" | replace: "_", "" | replace: "!", "" | replace: ":", "" | replace: "", "" | replace: "'", "" | replace: "°", "" %}
{% if icon.slug %}
{% assign filename = icon.slug %}

View file

@ -17,12 +17,8 @@ module.exports = {
titleToSlug: title => (
title.toLowerCase()
.replace(/\+/g, "plus")
.replace(/^\./, "dot-")
.replace(/\.$/, "-dot")
.replace(/\./g, "-dot-")
.replace(/^&/, "and-")
.replace(/&$/, "-and")
.replace(/&/g, "-and-")
.replace(/\./g, "dot")
.replace(/&/g, "and")
.replace(/đ/g, "d")
.replace(/ħ/g, "h")
.replace(/ı/g, "i")
@ -32,8 +28,7 @@ module.exports = {
.replace(/ß/g, "ss")
.replace(/ŧ/g, "t")
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.replace(/[^a-z0-9\-]/g, "")
.replace(/[^a-z0-9]/g, "")
),
/**