fix line break issue

This commit is contained in:
MLH
2024-12-16 01:12:27 +01:00
parent d5bfadce14
commit 548c48d6aa
2 changed files with 9 additions and 6 deletions

View File

@ -174,7 +174,8 @@ def modifyFiles(config, destinationDirectory):
raise ValueError(f"Text '{after_text}' not found in file: {filePath}")
elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text after: {after_text} {Colors.YELLOW}+ ->{Colors.GREEN} {insert_text}{Colors.RESET}")
content = content.replace(after_text, after_text + insert_text)
# content = content.replace(after_text, after_text + insert_text)
content = content.replace(after_text, after_text + insert_text.replace('\n', ''))
else:
print(f" {Colors.YELLOW}Text already present after: {after_text}{Colors.RESET}")
errorList['modWarnings'] += 1
@ -187,7 +188,8 @@ def modifyFiles(config, destinationDirectory):
raise ValueError(f"Text '{before_text}' not found in file: {filePath}")
elif insert_text not in content:
print(f" {Colors.GREEN}Inserting text before: {insert_text} {Colors.YELLOW}+ <-{Colors.GREEN} {before_text}{Colors.RESET}")
content = content.replace(before_text, insert_text + before_text)
# content = content.replace(before_text, insert_text + before_text)
content = content.replace(before_text, insert_text.replace('\n', '') + before_text)
else:
print(f" {Colors.YELLOW}Text already present before: {before_text}{Colors.RESET}")
errorList['modWarnings'] += 1