Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve WebVTT tags in subtitle lines #97

Merged
merged 2 commits into from
Nov 22, 2023

Conversation

NhanNguyen700
Copy link
Contributor

@NhanNguyen700 NhanNguyen700 commented Nov 13, 2023

Hi all,

WebVTT STYLE block is CSS and it allow to write custom CSS class or tag in xml to applied to the lines of WebVTT, also, some default tag like tag i (italic), b (bold), u (underline), etc are supported too, for example:

WEBVTT

00:01:00.000 --> 00:02:00.000
<u><i>Italic with underline text</i></u> some extra

00:02:00.000 --> 00:03:00.000
<lang en>English here</lang> <c.yellow.bg_blue>Yellow text on blue background</c>

00:03:00.000 --> 00:04:00.000
<v Joe><c.red><i>Joe's words are red in italic</i></c>

00:04:00.000 --> 00:05:00.000
<customed_tag.class1.class2>Text here</customed_tag>

So, I add these change to preserve the tags in WebVTT files. This will be convenient if someday, we decide to convert styling from WebVTT to TTML or another format.

According to WebVTT format at: https://www.w3.org/TR/webvtt1/

@NhanNguyen700
Copy link
Contributor Author

NhanNguyen700 commented Nov 13, 2023

Hi @asticode , could you please have a look?

subtitles.go Show resolved Hide resolved
subtitles.go Outdated Show resolved Hide resolved
subtitles.go Outdated Show resolved Hide resolved
subtitles.go Outdated Show resolved Hide resolved
subtitles.go Show resolved Hide resolved
webvtt.go Outdated Show resolved Hide resolved
webvtt.go Outdated Show resolved Hide resolved
Copy link
Owner

@asticode asticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 final minor changes and I'll merge this PR 👍

subtitles.go Outdated Show resolved Hide resolved
subtitles.go Outdated Show resolved Hide resolved
@NhanNguyen700
Copy link
Contributor Author

@asticode , thank you for your ideas! After merging the PR, would you mind creating a release tag for new changes?

@asticode asticode merged commit 2d03157 into asticode:master Nov 22, 2023
1 check passed
@asticode
Copy link
Owner

FYI I've created a v0.26.0 tag 👍

Thanks again for the PR ❤️

@NhanNguyen700
Copy link
Contributor Author

Hi @asticode ,
I see that you had created a tag 0.26.0, but when including it to my project, the version 0.26.0 does not include newest change. Checked with go packages page here: https://pkg.go.dev/github.com/asticode/go-astisub@v0.26.0, there is a version of 0.26.0 but it was released in late July. There is a tag conflict?

@asticode
Copy link
Owner

Yeah there was a mixup, v0.26.0 was pointing to a commit on a dev branch therefore I've overwritten hoping it would be sufficient. But it seems that it's not.

I've created a v0.26.1 tag pointing to the last master's commit. Let me know if that fixes your issue 👍

@NhanNguyen700
Copy link
Contributor Author

Thank you! It's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants