Skip to content

Commit

Permalink
feat: ✨ manage long title
Browse files Browse the repository at this point in the history
  • Loading branch information
gouz committed Apr 17, 2024
1 parent 94ea263 commit 30487d2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,30 @@ if (argv.length > 2) {
position: number
) => {
const lines: TalkRow[] = [];
let titleSplit: string[] = (
title
.trim()
.replace(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu, "")
.match(/.{1,100}/g) as string[]
).map((text) => text.padEnd(100, " "));
speakers.forEach((uid: string, i: number) => {
if (i === 0)
lines.push({
position: position + 1,
title: title
.replace(/[^\p{L}\p{N}\p{P}\p{Z}^$\n]/gu, "")
.trim(),
title: titleSplit.shift(),
format: formatsHash.get(formats),
speakers: speakerHash.get(uid),
rating: Number(rating.toFixed(2)),
loves,
hates,
});
else lines.push({ speakers: speakerHash.get(uid) });
else
lines.push({
title: titleSplit.shift() ?? "",
speakers: speakerHash.get(uid),
});
});
titleSplit.forEach((title) => lines.push({ title }));
lines.push({});
return lines;
}
Expand Down

0 comments on commit 30487d2

Please sign in to comment.