Skip to content

Commit

Permalink
minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Oct 4, 2024
1 parent e7dbc3e commit 61020a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions assets/js/helper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function titleize(text) {
"beta",
"but",
"by",
"cd-rip",
"crack",
"cracks",
"demo",
Expand Down Expand Up @@ -67,6 +68,7 @@ export function titleize(text) {
"2d",
"3d",
"4d",
"abc",
"ad&d",
"bbs",
"cd",
Expand All @@ -91,6 +93,7 @@ export function titleize(text) {
"nfo",
"nhl",
"nt",
"oem",
"os",
"pc",
"psx",
Expand All @@ -105,6 +108,8 @@ export function titleize(text) {
text = text.trim();
// Replace all underscores with spaces
text = text.replace(/_/g, " ");
// Remove suffix (1) (2) (3) etc. (a) (b) (c) etc.
text = text.replace(/ \([0-9a-z]\)/g, "");
// Insert a space after a colon following an alphanumeric string
text = text.replace(/([a-zA-Z0-9]): /g, "$1 : ");
const wordCount = text.split(" ").length;
Expand Down Expand Up @@ -135,8 +140,6 @@ export function titleize(text) {
})
.join(" ")
.trim();
// Remove suffix (1) (2) (3) etc. (a) (b) (c) etc.
text = text.replace(/ \([0-9a-z]\)/g, "");
return text;
}

Expand Down Expand Up @@ -206,6 +209,8 @@ export function romanFix(word) {
*/
export function replacementFix(word) {
switch (word) {
case "cdrip":
return "cd-rip";
case "&":
return "and";
case "ad+d":
Expand Down
Loading

0 comments on commit 61020a0

Please sign in to comment.