-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmp_html_replace.py
More file actions
48 lines (37 loc) · 2.36 KB
/
tmp_html_replace.py
File metadata and controls
48 lines (37 loc) · 2.36 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
import os
import re
html_files = ['index.html', 'events.html', 'gallery.html', 'team.html', 'upcoming.html']
basedir = r"C:\Users\ayaan\Downloads\ACM x svit\acm-svit-website"
svg_block = """ <!-- GSAP Scalable Laptop with Pure Masking Hole -->
<svg class="laptop-icon" id="hero-laptop" viewBox="0 0 120 80" overflow="visible" xmlns="http://www.w3.org/2000/svg">
<!-- Massive infinite background with a mathematically perfect diamond hole -->
<path class="hero-bg-layer" d="
M -5000 -5000 L 5120 -5000 L 5120 5080 L -5000 5080 Z
M 60 18 L 38 40 L 60 62 L 82 40 Z
" fill="#020617" fill-rule="evenodd" />
<!-- Hollow Screen Border -->
<path class="hero-screen-frame" d="
M 10 10 L 110 10 L 110 70 L 10 70 Z
M 15 15 L 15 65 L 105 65 L 105 15 Z
" fill="#0f172a" fill-rule="evenodd" stroke="#cbd5e1" stroke-width="1" />
<!-- Base -->
<path class="hero-base" d="M 5 75 L 115 75 Q 120 75 120 80 L 0 80 Q 0 75 5 75 Z" fill="#94a3b8" />
<!-- Base indent -->
<path class="hero-base-indent" d="M 50 75 L 70 75 L 68 78 L 52 78 Z" fill="#475569" />
<!-- Inner Details that fade exactly before zooming through the hole -->
<g class="acm-hole-details" id="acm-hole-details">
<circle cx="60" cy="40" r="11" fill="transparent" stroke="#3e8ede" stroke-width="1.5" />
<text x="60" y="42.5" font-family="Poppins, sans-serif" font-size="8" font-weight="bold" fill="#3e8ede" text-anchor="middle">acm</text>
</g>
</svg>"""
gsap_script = '<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>\n <script src="js/script.js"></script>'
for file in html_files:
filepath = os.path.join(basedir, file)
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
content = re.sub(r'<!-- Laptop SVG .*?</svg>', svg_block, content, flags=re.DOTALL)
if 'gsap.min.js' not in content:
content = content.replace('<script src="js/script.js"></script>', gsap_script)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print("Updated perfectly.")