Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .changeset/add-cli-remove-trailing-period.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/add-remove-trailing-period.md

This file was deleted.

2 changes: 0 additions & 2 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ cues, speaker labels, music cues, and more.

- `--merge-same-text` — Merge consecutive cues with identical text Required: No

- `--remove-trailing-period` — Remove trailing period (。 or .) at the end of cues Required: No

- `--normalize-text-case` — Change fully UPPERCASE cues to normal case Required: No

---
Expand Down
5 changes: 0 additions & 5 deletions packages/cli/src/commands/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export class CleanCommand extends Command {
description: 'Merge consecutive cues with identical text',
})

removeTrailingPeriod = Option.Boolean('--remove-trailing-period', false, {
description: 'Remove trailing period (`。` or `.`) at the end of cues',
})

normalizeTextCase = Option.Boolean('--normalize-text-case', false, {
description: 'Change fully UPPERCASE cues to normal case',
})
Expand All @@ -59,7 +55,6 @@ export class CleanCommand extends Command {
removeMusicCues: this.removeMusicCues,
removeLineBreaks: this.removeLineBreaks,
mergeSameText: this.mergeSameText,
removeTrailingPeriod: this.removeTrailingPeriod,
normalizeTextCase: this.normalizeTextCase,
})

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/features/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const cleanBasic = (subtitle: Subtitle, options?: CleanBasicOptions): Sub

// Remove trailing period (`。` or `.`)
if (options?.removeTrailingPeriod) {
text = text.replace(/[。.]\s*$/, '')
text = text.replace(/[。.]$/, '')
}

return {
Expand Down
22 changes: 0 additions & 22 deletions packages/core/test/features/clean.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,6 @@ describe('cleanBasic', () => {
expect(result).toMatchSnapshot()
})

it('should remove trailing period', () => {
const subtitle = [
createEntry('1', 'Hello World.'),
createEntry('2', 'This is a test.'),
createEntry('3', 'No period here'),
createEntry('4', 'Multiple sentences. End here.'),
createEntry('5', '你好世界。'),
createEntry('6', '没有句号'),
createEntry('7', ' With whitespace. '),
]

const result = cleanBasic(subtitle, { removeTrailingPeriod: true })

expect(result[0].text).toBe('Hello World')
expect(result[1].text).toBe('This is a test')
expect(result[2].text).toBe('No period here')
expect(result[3].text).toBe('Multiple sentences. End here')
expect(result[4].text).toBe('你好世界')
expect(result[5].text).toBe('没有句号')
expect(result[6].text).toBe('With whitespace')
})

it('should apply multiple options together', () => {
const subtitle = [
createEntry('1', ' JOHN: Hello [phone] World \n'),
Expand Down