From df06014493531a4debfeedeb4c6ee619b3692a51 Mon Sep 17 00:00:00 2001 From: ppkantorski <6467366+ppkantorski@users.noreply.github.com> Date: Sat, 31 May 2025 05:40:43 -0700 Subject: [PATCH] Update format_repo5.py - game name formatting cleanup --- scripts/cucholix/format_repo5.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/scripts/cucholix/format_repo5.py b/scripts/cucholix/format_repo5.py index 273c78e..2112e4b 100644 --- a/scripts/cucholix/format_repo5.py +++ b/scripts/cucholix/format_repo5.py @@ -12,8 +12,22 @@ def sanitize_name(name): return cleaned.strip() def title_case_preserve_numbers(name): - # Title-case words but preserve numbers and basic formatting - return ' '.join(word.capitalize() if not word.isupper() else word for word in name.split()) + # Capitalize title correctly with exceptions for filler words in the middle + lowercase_exceptions = { + "a", "an", "and", "as", "at", "but", "by", "for", "from", "in", "nor", + "of", "on", "or", "so", "the", "to", "yet", "with" + } + + words = name.split() + result = [] + + for i, word in enumerate(words): + if (0 < i < len(words) - 1) and word.lower() in lowercase_exceptions: + result.append(word.lower()) + else: + result.append(word.capitalize()) + + return ' '.join(result) def create_formatted_structure(root_folder): formatted_path = os.path.join(root_folder, 'formatted')