Skip to content

Commit

Permalink
Add hover text to badges
Browse files Browse the repository at this point in the history
  • Loading branch information
gchatelet committed Aug 31, 2023
1 parent 52874f0 commit 586ec59
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ instructions) at runtime.

| | Linux | FreeBSD | MacOS | Windows |
| :-- | --: | --: | --: | --: |
| amd64 | [![][i1a0]][l1a0]<br/>[![][i1a1]][l1a1] | [![][i2a0]][l2a0]<br/>![][d1] | [![][i3a0]][l3a0]<br/>[![][i3a1]][l3a1] | [![][i4a0]][l4a0]<br/>![][d1] |
| AArch64 | [![][i1b0]][l1b0]<br/>[![][i1b1]][l1b1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| ARM | [![][i1c0]][l1c0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| MIPS | [![][i1d0]][l1d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| POWER | [![][i1e0]][l1e0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| RISCV | [![][i1f0]][l1f0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| LOONGARCH | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| s390x | [![][i1h0]][l1h0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] | ![][d0]<br/>![][d1] |
| amd64 | [![CMake][i1a0]][l1a0]<br/>[![Bazel][i1a1]][l1a1] | [![CMake][i2a0]][l2a0]<br/>![Bazel][d1] | [![CMake][i3a0]][l3a0]<br/>[![Bazel][i3a1]][l3a1] | [![CMake][i4a0]][l4a0]<br/>![Bazel][d1] |
| AArch64 | [![CMake][i1b0]][l1b0]<br/>[![Bazel][i1b1]][l1b1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| ARM | [![CMake][i1c0]][l1c0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| MIPS | [![CMake][i1d0]][l1d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| POWER | [![CMake][i1e0]][l1e0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| RISCV | [![CMake][i1f0]][l1f0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| LOONGARCH | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |
| s390x | [![CMake][i1h0]][l1h0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] | ![CMake][d0]<br/>![Bazel][d1] |

[d0]: https://img.shields.io/badge/n%2Fa-lightgrey?&logo=cmake
[d1]: https://img.shields.io/badge/n%2Fa-lightgrey?&logo=data:image/svg%2bxml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNiAuMTZsNS43ODYgNS43ODZMNiAxMS43MzIuMjE0IDUuOTQ2IDYgLjE2MXpNMCA2LjIxNFYxMmw1Ljc4NiA1Ljc4NlYxMkwwIDYuMjE0ek0xOCAuMTZsNS43ODYgNS43ODZMMTggMTEuNzMybC01Ljc4Ni01Ljc4NkwxOCAuMTYxek0yNCA2LjIxNFYxMmwtNS43ODYgNS43ODZWMTJMMjQgNi4yMTR6TTEyIDYuMTZsNS43ODYgNS43ODZMMTIgMTcuNzMybC01Ljc4Ni01Ljc4NkwxMiA2LjE2MXpNMTEuODQgMTguMDU0djUuNzg1bC01Ljc4Ni01Ljc4NXYtNS43ODZsNS43ODUgNS43ODZ6TTEyLjE2IDE4LjA1NGw1Ljc4Ni01Ljc4NnY1Ljc4NmwtNS43ODUgNS43ODV2LTUuNzg1eiIgc3Ryb2tlPSJ0cmFuc3BhcmVudCIgZmlsbD0id2hpdGUiLz48L3N2Zz4=
Expand Down
37 changes: 19 additions & 18 deletions scripts/generate_badges.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// usage:
// 1. copy paste the whole code to https://run.dlang.io/ then click `run`
// 2. `docker run --rm -it -v $(pwd):/src dlanguage/dmd dmd -run generate_badges.d`
#!/usr/bin/docker run --rm -it -v $(pwd):/src dlanguage/dmd dmd -run generate_badges.d
import std.algorithm : each, map, cartesianProduct, filter, joiner, sort, uniq;
import std.array;
import std.conv : to;
Expand Down Expand Up @@ -48,17 +46,13 @@ const:
Os os;
BuildSystem build_system;

private:
string id()
{
return format("%d%c%d", cast(uint)(os) + 1, cast(char)('a' + cpu),
cast(uint)(build_system));
}

string disabled_image_ref()
{
return format("[d%d]", cast(uint)(build_system));
}

string link_ref()
{
return format("[l%s]", id());
Expand All @@ -83,11 +77,11 @@ const:
}
}

string text()
string filename()
{
if (enabled())
return format("[![]%s]%s", image_ref, link_ref);
return format("![]%s", disabled_image_ref);
import std.uni : toLower;

return toLower(format("%s_%s_%s.yml", cpu, os, build_system));
}

string append_logo(string url)
Expand All @@ -101,17 +95,24 @@ const:
}
}

string disabled_image_link()
public:

string disabled_image_ref()
{
return append_logo(format("%s: https://img.shields.io/badge/n%%2Fa-lightgrey?",
disabled_image_ref));
return format("[d%d]", cast(uint)(build_system));
}

string filename()
string text()
{
import std.uni : toLower;
if (enabled())
return format("[![%s]%s]%s", build_system, image_ref, link_ref);
return format("![%s]%s", build_system, disabled_image_ref);
}

return toLower(format("%s_%s_%s.yml", cpu, os, build_system));
string disabled_image_link()
{
return append_logo(format("%s: https://img.shields.io/badge/n%%2Fa-lightgrey?",
disabled_image_ref));
}

string link_decl()
Expand Down

0 comments on commit 586ec59

Please sign in to comment.