-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_aria.py
More file actions
60 lines (54 loc) · 1.81 KB
/
add_aria.py
File metadata and controls
60 lines (54 loc) · 1.81 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
import re
file_path = "index.html"
with open(file_path, "r", encoding="utf-8") as f:
content = f.read()
# Emojis mapping
emojis = {
"🚀": "Rakieta",
"📂": "Folder",
"⭐": "Gwiazdka",
"⚡": "Błyskawica",
"🌐": "Strona internetowa",
"🛒": "Koszyk",
"⚙️": "Zębatka",
"🏗️": "Budowa",
"📈": "Wykres rosnący",
"🔧": "Klucz francuski",
"🏢": "Biurowiec",
"📅": "Kalendarz",
"🏠": "Dom",
"📊": "Wykres",
"🐘": "Słoń (PHP)",
"🟦": "Niebieski kwadrat (WordPress)",
"🛍️": "Torba na zakupy (PrestaShop)",
"💚": "Zielone serce (Vue.js)",
"⚛️": "Atom (React)",
"▲": "Trójkąt (Next.js)",
"🟩": "Zielony kwadrat (Node.js)",
"🗄️": "Szafka (Baza danych)",
"🔴": "Czerwone kółko (Redis)",
"🐳": "Wieloryb (Docker)",
"🐙": "Ośmiornica (GitHub)",
"🖥️": "Monitor",
"⌨️": "Klawiatura",
"💻": "Laptop",
"🧾": "Paragon",
"📚": "Książki",
"📧": "E-mail",
"📱": "Telefon",
"💼": "Teczka",
"🕐": "Zegar",
"📩": "Koperta",
"🇵🇱": "Flaga Polski",
"🔥": "Ogień",
}
for emoji, label in emojis.items():
# Only replace emojis that are not already inside an aria-label span
# We can use a regex negative lookbehind if possible, or just a simple check
# regex pattern: match emoji not preceded by > and not inside an attribute
# Actually, the simplest way is to replace all occurrences, but ignore those already wrapped.
# We'll just replace the raw emoji directly. If we run this script once, it's fine.
content = content.replace(emoji, f'<span role="img" aria-label="{label}">{emoji}</span>')
with open(file_path, "w", encoding="utf-8") as f:
f.write(content)
print("Done updating index.html")