From 42a935682aca66d2fd130ae080d28ab2bbaaf11a Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 13 Sep 2023 14:21:31 -0700 Subject: refactor(updates): rename formatters --- src/routes/updates/+page.svelte | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/routes/updates/+page.svelte b/src/routes/updates/+page.svelte index 2a9333ab..26af53bc 100644 --- a/src/routes/updates/+page.svelte +++ b/src/routes/updates/+page.svelte @@ -20,21 +20,19 @@ mangaEndTime = performance.now() - startTime; }); - const reformat = (title: string) => { - return title + const reformatChapter = (title: string) => + title .replace(/\[.*?\]\s/, '') .replace(/c\.Oneshot/, 'Oneshot') .replace(/c\.(\d+-\d+)/, 'Ch. $1') .replace(/v\.(\d+)\s/, 'Vol. $1 ') .replace(/c\.(\d+)/, 'Ch. $1'); - }; - function reformatChapters(title: string): string { - return title + const clipTitle = (title: string): string => + title .replace(/(Vol\. \d+ )?Ch\. \d+(-\d+(\.\d+)?)?$/, '') .replace(/\? ~.*$/, '') .trim(); - } const italicTitle = (title: string) => title.replace(/^(.*?) Ch\.|\bOneshot\b/, '$1 Ch.'); @@ -54,16 +52,16 @@ {#each feed.items as item}
  • {#if directLink} - {reformat(item.title)} + {reformatChapter(item.title)} {@html item.content} {:else} - {@html italicTitle(reformat(item.title))} + {@html italicTitle(reformatChapter(item.title))} {/if}
  • @@ -89,7 +87,7 @@ {#each novelFeed.items as item}
  • - {reformat(item.title)} + {reformatChapter(item.title)}
  • {/each} -- cgit v1.2.3