with open('/workspace/prds/generate_template.py', 'r', encoding='utf-8') as f: c = f.read() target_marker = "const dashDone = (pDone / 100) * C;" replacement = """const C = 238.76; const lDone = (pDone / 100) * C; const lInProg = (pInProg / 100) * C; const lTodo = (pTodo / 100) * C; container.innerHTML = `
""" idx_start = c.find("// SVG circle circumference") idx_end = c.find("", idx_start) + 6 if idx_start != -1 and idx_end != -1: c = c[:idx_start] + replacement + c[idx_end:] with open('/workspace/prds/generate_template.py', 'w', encoding='utf-8') as f: f.write(c) print("Replaced donut block successfully!") else: print("Could not find boundaries", idx_start, idx_end)