Repository navigation
Expand file tree
/
Copy pathsupport_gem_css.py
More file actions
74 lines (59 loc) · 1.74 KB
/
Copy pathsupport_gem_css.py
File metadata and controls
74 lines (59 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from config import config_helper as config
config.set_mode('debug')
import gem_data
css_str = """a[href$="#support-gem-red"],
a[href$="#support-gem-green"],
a[href$="#support-gem-blue"],
a[href$="#support-gem-white"] {
padding: 1px 4px;
display: inline-block;
color: white !important;
background-color: #666;
text-align: center;
vertical-align: middle;
font-size: 1rem;
font-family: Verdana,Arial,Helvetica,sans-serif;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
white-space: nowrap;
}
a[href$="#support-gem-red"],
a[href$="#support-gem-red"]:hover:before {
background-color: #c51e1e;
}
a[href$="#support-gem-green"],
a[href$="#support-gem-green"]:hover:before {
background-color: #08a842;
}
a[href$="#support-gem-blue"],
a[href$="#support-gem-blue"]:hover:before {
background-color: #4163c9;
}
a[href$="#support-gem-white"],
a[href$="#support-gem-white"]:hover:before {
background-color: #ffffff;
}
a[href$="#support-gem-red"]:hover:before,
a[href$="#support-gem-green"]:hover:before,
a[href$="#support-gem-blue"]:hover:before,
a[href$="#support-gem-white"]:hover:before {
position: absolute;
margin-top: -25px;
padding: 1px 3px;
z-index: 1;
}
"""
gem_template = """
a[href$="{:s}#support-gem-{:s}"]:hover:before {{ content: "{:s}"; }}"""
for k in gem_data.support_gems:
gem = gem_data.support_gems[k]
if not gem.is_support:
continue
if gem.json['base_item'] is None:
continue
if gem.json['base_item']['release_state'] != "released":
continue
css_str += gem_template.format(gem.get_url_suffix(), gem.get_color_str(), gem.short_name)
out = "data\support_gems.css"
with open(out, "w") as f:
f.write(css_str)
print(("Gem CSS written to {}".format(out)))