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

Problems with line breaks and HTML formatted text #78

Closed
EmilJunker opened this issue Nov 14, 2020 · 3 comments
Closed

Problems with line breaks and HTML formatted text #78

EmilJunker opened this issue Nov 14, 2020 · 3 comments

Comments

@EmilJunker
Copy link

EmilJunker commented Nov 14, 2020

In principle, the Penguin Subtitle Player seems to support HTML formatted text, e.g. subtiles with <i> and </i> tags are rendered italic:

1
01:42:13,365 --> 01:42:21,723
- <i>This includes all the marine vessels.</i>

image

However, I have found that if there are two lines of text and only the second line contains HTML tags, then the tags are ignored and show up literally:

2
01:42:56,429 --> 01:43:02,198
- The war is over, my love. The war is gone.
- <i>This includes all the marine vessels.</i>

image

If the first line of text also contains HTML tags, then the formatting works, but the line break itself gets ignored:

3
01:43:09,731 --> 01:43:17,464
- The <i>war</i> is over, my love. The war is gone.
- <i>This includes all the marine vessels.</i>

image

The cause of these issues appears to be the line break. If a <br> tag is used instead of a real line break, then it works fine:

4
01:43:23,731 --> 01:43:30,464
- The war is over, my love. The war is gone.<br>- <i>This includes all the marine vessels.</i>

image

In fact, even if the <br> tag is then followed by a real line break, it still works:

5
01:43:38,139 --> 01:43:45,479
- The war is over, my love. The war is gone.<br>
- <i>This includes all the marine vessels.</i>

image

By the way, I took these screenshots on Windows 10 version 2004. I haven't tested this on other operating systems.


My suggestion to fix these issues would be as follows:
While parsing the .srt file, whenever you encounter a line break (inside a subtitle text block) that isn't already preceded by a <br> tag, simply insert a <br> tag right before it.
What do you think? Would that be possible?

@carsonip
Copy link
Owner

Thanks for reporting this issue. It is a good find. The html processing is done by Qt label's rich text functionality, and it makes sense that once the text is identified as html, it ignores line breaks. So I agree with your suggestion about adding
for line breaks in subtitle files mixing html and line breaks.

@sergeevabc
Copy link

@carsonip, err… is this already done?

@carsonip
Copy link
Owner

carsonip commented Apr 3, 2021

It is now fixed. Please wait for the next release.

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

No branches or pull requests

3 participants