import re import sys def main(): try: with open('src/main/resources/templates/index.html', 'r', encoding='utf-8') as f: lines = f.readlines() content_top_start = -1 for i, line in enumerate(lines): if '
' in line: content_top_start = i break # The next block starts with '
' # But content-top itself has one. # Let's search for the second '
' next_block_start = -1 count = 0 for i in range(content_top_start, len(lines)): if '
' in lines[i]: count += 1 if count == 2: next_block_start = i break end_of_file_content = -1 for i in range(len(lines)-1, -1, -1): if '