-
Notifications
You must be signed in to change notification settings - Fork 100
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
HTML ordered list: recognize the 'type' attribute #214
Conversation
This can already be achieved by using html5.css: coolreader/cr3gui/data/html5.css Lines 575 to 593 in face267
(There are a lot less stuff in epub.css, for historical reasons, and to have a simpler CSS.) When HTML attributes can map directly to CSS properties, we can do it via CSS. It might be more expensive, but it avoids adding too much such stuff in the code. |
Perhaps a good motivation to optimize those code paths, too. grins |
eda35cf
to
ffb2028
Compare
Ok, thanks and that works well and does look cleaner. Updated the PR to add these to all the epub.css files in case that is ok to land now. |
(Dunno about CoolReader, but on our KOReader side, one can easily switch from epub.css to html5.css - epub.css is quite smaller, and does not have all the attribute matches that html5.css has - may be it could benefit from all of them, but given that it's available in html5.css, I think it's not really necessary - and the spirit of EPUB is to privilege CSS other HTML attributes - HTML3/4 had deprecated quite a few of them, even if HTML5 seems to have added new ones...) |
The |
But then, there's no reason to privilege your The way to go about that is a CoolReader decision (I think I'll keep our short epub.css in KOReader). But having just |
The EPUB standard could be implement. The |
Might be nice if you can achieve that, and the difference is substantial. |
Have been using epubcheck as a reference but that must be based on publications: https://github.com/w3c/epubcheck There is an online implementation here: http://validator.idpf.org/ For the lists, I was looking at the rules in: Also I check a range of other implementations. Many of the Android readers support these html attributes, but fwiw my kobo eink reader does not appear to support |
OK, good luck :) |
Thank you for the perspective, but it still seems helpful to try to get the list labels right, to follow the standard on that specific matter. It's not clear how it helps the reader on a particular device to get the labels wrong, it does not seems like a formatting preference. Fwiw my Kobo eink reader appears to accept the |
Link and quote of the exact part of the spec where it says that or epubcheck is wrong. |
Note a slight distinction between EPUB 2 and 3.
https://www.w3.org/publishing/epub32/epub-contentdocs.html#sec-overview-relations-html
|
So, that could explain: |
I don't think there are many books that would even validate as XHTML 1.1. Some might by skirting around the spirit of it completely, but I think most are something closer to XHTML 1.0 Transitional or XHTML 5 (that's HTML 5 written as well-formed XML). And frankly that's how it should be. ;-) |
EPUB 3 references HTML, and the HTML living standard does not include Might there be a different issue here, that coolreader should distinguish epub2 from epub3 and then use separate css files if the css file is effectively adding in support for epub3? I see it getting the file name in |
But who knows if at the time an EPUB book was produced, the HTML standard of the time did not accept it :) We're consumers, we should be the most flexible, and accept most of what may have been accepted at any time, as long as there is no incompatibility. So then, just use html5.css, and don't touch, and consider epub.css obsolete. |
Interesting, so they actually deprecated that. https://www.w3.org/TR/html4/struct/lists.html#type-values
It already does where appropriate (i.e., some metadata stuff).
HTML5 reflects how people actually use HTML (which apparently doesn't include using type disc/square/circle, and indeed I've only used CSS for that for many years ;-) ), in stark contrast to XHMTL 1.1. I can't imagine who'd want such a thing. ^_^ |
To be clear, only disc/circle/square are/were technically supposed to be supported on UL. In practice I don't know if anybody's ever bothered to restrict it, but presumably some early browsers did more or less as an implementation accident. |
Distinguishing is no-use, we're consumers, we might have epub2 books that contains obsolete or newer tags, better support them than be rigid for sake of specs. So, use html5.css. (And possibly have some users complain about the changes in styles for P et al.) See top of html5.css for its origin, might be old, or might have been made compatible if it has ul[type], dunno. |
Great, I think we are on the same page as I also support being permissive. Perhaps I misunderstood you, you are suggesting effectively replacing the coolreader epub.css with the html5.css, not bothering to limit HTML support in EPUB2 Could that be a separate PR, as my focus here was to just improve the list label support and I would not this request to fail to get support just because people did not want to replace epub.css with all of html5.css. |
Not my decision, but CoolReader's. I guess it hurts nothing, it just feels like a job half done :) Anyway, if you can (dunno if that's possible, might need an android rooted device), you could try coyping html5.css to epub.css, and see how that looks on multiple books, to get another idea if it could be a viable default (my personal opinion is that I don't like it). |
But in any case, let this ugly other half of the job to me (not before a few months): it we're putting more attr matches in epub.css, we also need to remove these kind of handling (that are done only on single HTML files, not with EPUBs): coolreader/crengine/src/lvtinydom.cpp Lines 13877 to 13917 in face267
|
What if we |
(CR on Android might feed these CSS content as a string, and might not have @import processed.) I think I would prefer something curated, and the relevant stuff handpicked. epub.css also tries to ensure compatibility with old epub.css highlights (with its -cr-ignore-if-dom-version-greater-or-equal stuff at end). Dunno how these combinations would work. Also, having tons of such things might increase loading/rendering time (by how much, I dunno): coolreader/cr3gui/data/html5.css Lines 703 to 708 in face267
coolreader/cr3gui/data/html5.css Lines 737 to 740 in face267
coolreader/cr3gui/data/html5.css Lines 845 to 848 in face267
coolreader/cr3gui/data/html5.css Lines 974 to 977 in face267
I don't think Calibre has as much stuff. But yes, a proper html5-base.css + some overrides for epub.css look (which could be a single Style tweak with KOReader, but it would need some thoughts for the UI) , might be a solution. |
Implemented in CSS, but this is a standard HTML attribute.
ffb2028
to
f3a73e6
Compare
Also updated the htm.css files to support the ordered list type attribute. |
Is this a request to add more cases, and is that for the 'ol' or 'ul' and/or the 'li' element? |
This is no longer part of the HTML standard, but support is included for reading documents formatted to older standards.
It's what I was implicitly referring to in my first comment, spec here. |
Rolled in similar additions for unordered lists, which seems to be requested for this PR. |
@@ -67,6 +67,17 @@ ul { | |||
list-style-type: disc; | |||
margin-left: 1em; | |||
} | |||
|
|||
ul[type=disc], li[type=disc] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, like that. 👍
Common web browsers vary the default label for unordered lists when nested, so follow this.
No description provided.