commit 6a7237615189dd4319a3769ced2e4fce4afe37f4
parent a24777f3764cbf1a12f6a3590829a0b45d0073f4
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 1 Nov 2026 22:23:07 -0500
umtool deck: an on-screen title that repeats its source's title is compared without punctuation, symbols, quotes, emoji, extra space or case (titleKey) -- lw1's "…SBI?!? || Gothic Therapy react" is no longer drawn over the two lines that already say "…SBI? || Gothic Therapy react"
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs
@@ -1005,8 +1005,22 @@ export function hidesDeck(entry, deck) {
return deck.overCards === "hide" && CARD_TYPES.includes(entry.type);
}
-/** Two titles the same, but for case and the space around them. */
-const sameTitle = (a, b) => String(a ?? "").trim().toLowerCase() === String(b ?? "").trim().toLowerCase();
+/**
+ * A title as two titles are compared: punctuation, symbols (a "||", a "$"),
+ * quotes and emoji gone, space collapsed, case folded -- so "…SBI?!? || Gothic
+ * Therapy react" and the source's "…SBI? || Gothic Therapy react" are one title.
+ */
+export function titleKey(s) {
+ return String(s ?? "")
+ .normalize("NFKC")
+ .replace(/[\p{P}\p{S}\p{Extended_Pictographic}\u200d\ufe0e\ufe0f]/gu, " ")
+ .replace(/\s+/g, " ")
+ .trim()
+ .toLowerCase();
+}
+
+/** Two titles the same, but for case, punctuation, quotes, emoji and space (titleKey). */
+const sameTitle = (a, b) => titleKey(a) === titleKey(b);
/**
* The deck's title and subtitle for one entry. Pure: the caller resolves `meta`.
@@ -1030,7 +1044,7 @@ export function deckText(entry, meta, provenance, deck, multiChannel) {
// Two lines already name the source: an on-screen title that only
// repeats it is not drawn again over them (the block takes the
// title's band, as for a clip with none). A different one stands.
- if (subtitleLines && title && sameTitle(title, parts.title) && subtitleLines.some((l) => l.includes(String(parts.title).trim()))) title = "";
+ if (subtitleLines && title && sameTitle(title, parts.title) && titleKey(parts.title) && subtitleLines.some((l) => titleKey(l).includes(titleKey(parts.title)))) title = "";
} else if (entry.type === "teaser") {
// The deck is never up over a teaser; its words are what a table of
// the cut (umtool's On-screen rows, the schedule) names it by.
diff --git a/umtool/report-to-video/rail-sections.test.mjs b/umtool/report-to-video/rail-sections.test.mjs
@@ -7,7 +7,7 @@ import test from "node:test";
import {
deckLayout, deckMarkers, deckSchedule, deckText, labelledMarkers, markerRowsOf, pipSegments, pipXs, railSections,
- resolveDeck, validateChrome,
+ resolveDeck, titleKey, validateChrome,
} from "./deck.mjs";
import { deckCues, deckHtml, fitSectionColor, sectionFuses } from "./chrome-deck.mjs";
import { contrast } from "./chrome-intro.mjs";
@@ -181,3 +181,19 @@ test("subtitle.lines 2: an on-screen title that repeats the source's title is no
const noTitle = resolveDeck(renderWith({ subtitle: { lines: 2, parts: ["channel", "date"], head: ["channel"] } }));
assert.equal(deckText(clip("Why I Use A Voice Changer"), meta, { ...PROV, channelName: "Ember" }, noTitle, true).title, "Why I Use A Voice Changer");
});
+
+test("subtitle.lines 2: titles compared without punctuation, symbols, quotes, emoji or case -- lw1's \"SBI?!? ||\" is its source's \"SBI? ||\"", () => {
+ const deck = resolveDeck(renderWith({ subtitle: { lines: 2 } }));
+ const meta = { title: "Who is the shadowy figure behind the creation of SBI? || Gothic Therapy react", uploadDate: "20250522" };
+ const clip = (title) => ({ id: "lw1", type: "clip", video: "v", start: 0, end: 5, onscreen: { title } });
+ const lw1 = deckText(clip("Who is the shadowy figure behind the creation of SBI?!? || Gothic Therapy react"), meta, PROV, deck, false);
+ assert.equal(lw1.title, "");
+ assert.equal(lw1.subtitleLines[0], meta.title);
+ // Quotes, emoji and doubled space are not words either.
+ assert.equal(deckText(clip("“Who is the shadowy figure behind the creation of SBI?” 🤡 Gothic Therapy react!"), meta, PROV, deck, false).title, "");
+ // A word of difference stands.
+ assert.equal(deckText(clip("Who is the shadowy figure behind SBI? || Gothic Therapy react"), meta, PROV, deck, false).title, "Who is the shadowy figure behind SBI? || Gothic Therapy react");
+ // A title of nothing but punctuation is never taken for an empty source title.
+ assert.equal(deckText(clip("?!"), { ...meta, title: "" }, PROV, deck, false).title, "?!");
+ assert.equal(titleKey(" It's Monday Madness 🤡 "), "it s monday madness");
+});