|
export function dirtyCaptionCleaner({ |
|
panel, |
|
instructions, |
|
caption |
|
}: { |
|
panel: number; |
|
instructions: string; |
|
caption: string |
|
}) { |
|
let newCaption = caption.split(":").pop()?.trim() || "" |
|
let newInstructions = ( |
|
|
|
(instructions.split(":").pop() || "") |
|
.replaceAll("Show a", "") |
|
.replaceAll("Show the", "") |
|
.replaceAll("Opens with a", "") |
|
.replaceAll("Opens with the", "") |
|
.replaceAll("Opens with", "") |
|
.replaceAll("Cut to a", "") |
|
.replaceAll("Cut to the", "") |
|
.replaceAll("Cut to", "") |
|
.replaceAll("End with a", "") |
|
.replaceAll("End with", "").trim() || "" |
|
) |
|
|
|
|
|
newInstructions = newInstructions.slice(0, 77) |
|
|
|
|
|
|
|
return { |
|
panel, |
|
instructions: newInstructions, |
|
caption: newCaption, |
|
} |
|
} |