-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix: remove html tags in overviews #292
base: master
Are you sure you want to change the base?
Conversation
63c0660
to
0a6d659
Compare
I've just realized that the label formatting syntax actually works on variables passed in from code. If we'd like, we can make the parser interpret some of it to the label formatting equivalent. We could consider doing the following:
However, I'm unsure if it's wise to use the syntax in code. It looks like this syntax is intended for skins to use, even if it may work when the variables appear in code. Reference: Kodi Documentation for Label Formatting Can I get thoughts from others? Should we apply the formatting syntax in the variable, or should we leave it so that only the skin is responsible for style?
|
0a6d659
to
317d880
Compare
317d880
to
5336615
Compare
I've had a look over the code and at first glace it seems fine, except for the dependency on python 3. Since we've not officially dropped support from Python 2 yet (I know, I know, it's coming soon I swear) this will need to wait till that's done before this can be merged |
Thanks for checking this out!
Ahh, I didn't realize this was a consideration. Though I do wonder if that's relevant as I thought Kodi migrated to Python 3 in Kodi 19, which is the earliest version of Kodi the Jellyfin project aims to support.
It could just be that I've misunderstood Kodi's release notes, as there isn't a clear table pairing Kodi against Python versions. Later I'll look into how much work it'd be to implement a solution backward compatible with Python 2.7, but if it's two entirely different interfaces than perhaps just waiting is best. ^-^' |
Our informal support policy is as oddstr mentioned in the jellyfin-kodi repo PR discussion of the deprecation
Our intent is to follow suit with this addon I've just not gotten around to doing it yet. Since it's so imminent I don't think it'd be worth looking at a custom solution I shall circle back to this once we've dropped the Kodi support officially, and we can look to get it merged then |
I'm intending on one or two more releases in jf4kodi before starting to rip out py2 compatibility and adding typing annotations 😸 |
Problem
In JellyCon, a series overview can often contain HTML, namely the
<br>
element. This does not break anything, but can make the UI look and feel unpolished.For example, 07-Ghost returns an overview featuring
<br>
tags, and Ascendance of a Bookworm has<i>
and<a>
tags. The Jellyfin web client preserves safe HTML, so these are correctly interpreted.Solution
Jellyfin Web handles this by delegating to DOMPurify to sanitize the overview string. This cleans unsafe-HTML, and leaves safe-HTML intact to be interpreted by the browser.
Reference: Item Details controller in the jellyfin/jellyfin-web repository
I propose we do something similar to this, but also take advantage of some luxuries, as we're ultimately on a different platform.
I think the best solution to this is to use the built-in HTMLParser from the standard library, to trim off HTML tags, and HTML elements that are not intended to be human-readable.
For example, the
<br>
,<p>
,<i>
tags can have the tags removed but their content preserved. Meanwhile, tags likestyle
andscript
are omitted entirely, as these aren't relevant.Stylized titles and emotes like 1968 < 2018 > 2068 and Lily <3 have been accounted for. If an overview has text like this, we determine that it's not an HTML tag and preserve how it was written.
Notes
Tests
Screenshots