2026-03-30 07:50:15 +02:00
|
|
|
def replace_chunk(text, start_str, end_str, new_content):
|
|
|
|
|
start = text.find(start_str)
|
|
|
|
|
end = text.find(end_str, start)
|
|
|
|
|
if start != -1 and end != -1:
|
|
|
|
|
end += len(end_str)
|
|
|
|
|
return text[:start] + new_content + text[end:]
|
|
|
|
|
return text
|
2026-03-05 08:41:59 +01:00
|
|
|
|
2026-03-30 07:50:15 +02:00
|
|
|
with open('app/modules/sag/templates/detail.html', 'r') as f:
|
|
|
|
|
text = f.read()
|
2026-03-05 08:41:59 +01:00
|
|
|
|
2026-03-30 07:50:15 +02:00
|
|
|
# Test finding CSS
|
|
|
|
|
start_css = ".time-v1-track {"
|
|
|
|
|
end_css = " .time-v1-metric {\n font-size: 0.8rem;\n margin-top: 0.18rem;\n }"
|
|
|
|
|
if start_css in text and end_css in text:
|
|
|
|
|
print("Found CSS block")
|
2026-03-05 08:41:59 +01:00
|
|
|
|
2026-03-30 07:50:15 +02:00
|
|
|
# Test finding JS
|
|
|
|
|
start_js = " function renderTimeV1Timeline(entries) {"
|
|
|
|
|
end_js = " </div>\n `;\n }).join('');\n }"
|
|
|
|
|
if start_js in text and end_js in text:
|
|
|
|
|
print("Found JS block")
|