asticode / go-astisub

Manipulate subtitles in GO (.srt, .ssa/.ass, .stl, .ttml, .vtt (webvtt), teletext, etc.)
MIT License
577 stars 111 forks source link

Preserve WebVTT tags in subtitle lines #97

Closed NhanNguyen700 closed 10 months ago

NhanNguyen700 commented 10 months ago

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 commented 10 months ago

Hi @asticode , could you please have a look?

NhanNguyen700 commented 10 months ago

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

asticode commented 10 months ago

FYI I've created a v0.26.0 tag 👍

Thanks again for the PR ❤️

NhanNguyen700 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

Thank you! It's working now.