INNER CODE UNIT · Python
find_title_lines
DataTalksClub/datatalksclub.github.io · scripts/add_context_from_title.py:51
def find_title_lines(yaml_lines):
"""
Find the line indices where the title field starts and ends.
Returns:
tuple: (start_index, end_index) or (None, None) if not found
"""
title_start = None
title_end = None
i = 0
while i < len(yaml_lines):
line = yaml_lines[i]
# Check if this line starts with "title:"
if line.startswith('title:'):
title_start = i