Fix make_given_keywords_bold_in_sections

This commit is contained in:
Sina Atalay
2025-02-08 18:07:41 -05:00
parent 39297f9957
commit 3bf458042e

View File

@@ -31,14 +31,19 @@ def make_given_keywords_bold_in_sections(
if sections_input is None:
return None
for entries in sections_input.values():
for section_title, entries in sections_input.items():
new_entries = []
for entry in entries:
if isinstance(entry, str):
entry_types.make_keywords_bold_in_a_string(entry, keywords)
new_entry = entry_types.make_keywords_bold_in_a_string(entry, keywords)
elif callable(getattr(entry, "make_keywords_bold", None)):
entry = entry.make_keywords_bold( # NOQA: PLW2901 # type: ignore
keywords
)
new_entry = entry.make_keywords_bold(keywords) # type: ignore
else:
new_entry = entry
new_entries.append(new_entry)
sections_input[section_title] = new_entries
return sections_input