-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
41 lines (34 loc) · 897 Bytes
/
main.py
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
import base64
from datetime import date
from yamhl import yamhl
icons = ["issues", "forks", "stars", "contributors", "license", "code"]
langs = ["python", "html", "yaml"]
def b64(name: str):
with open(f"./site/assets/images/icons/{name}", "rb") as f:
return base64.b64encode(f.read()).decode("utf-8")
RULES_MDV = {
"rules": {
"md": {
"del": {},
"repl": {
**{f'<pre><code id="hljs {i}">': [f"```{i}\n",] for i in langs},
'</code></pre>': ["```"],
},
},
"html": {
"del": {},
"repl": {},
}
},
"md_vars": {
"commons": {
"year": str(date.today().year),
**{f"{i}_b64": b64(f"{i}.png") for i in icons}
},
"files": {},
}
}
def main():
yamhl.main(RULES_MDV)
if __name__ == "__main__":
main()