Skip to content

Commit

Permalink
titleize changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Dec 17, 2024
1 parent 54a25a5 commit 0514b23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions assets/js/helper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ export function titleize(text) {
"to",
"update",
"updates",
"unprotect",
"unprotects",
"vs",
"with",
];
Expand Down Expand Up @@ -233,6 +235,10 @@ export function titleize(text) {
text = text.replace(/(Lotus 123)/g, "Lotus 1-2-3");
text = text.replace(/(Falcon at )/g, "Falcon AT ");
text = text.replace(/(the Games)/g, "The Games");
// Move "Unprotect for" to the suffix if it is the prefix
text = text.replace(/^(Unprotect for )(.+)/, "$2 unprotect");
text = text.replace(/^(Unprotecting )(.+)/, "$2 unprotect");
text = text.replace(/^(Unprotect )(.+)/, "$2 unprotect");
// replace formatting quirks
text = text.replace(/( : a)/g, " : A");
text = text.replace(/( - a)/g, " - A");
Expand All @@ -251,6 +257,7 @@ export function titleize(text) {
text = text.replace(/\[([^)]+)\]/g, function (match) {
return match.toUpperCase();
});

return text;
}

Expand Down
Loading

0 comments on commit 0514b23

Please sign in to comment.