10-16-2022, 01:54 PM | #1 |
Member
Posts: 20
Karma: 10
Join Date: Oct 2020
Device: none
|
A curiosity: <ol start="7"> not valid in epub 2.0.1?
I was using epubcheck, and it's validating an epub of mine to version 2.0.1
I'm getting an error as follows: ERROR(RSC-005): ebook.epub/OPS/xhtml/chapter10.xhtml(234,15): Error while parsing file: attribute "start" not allowed here; expected attribute "class", "dir", "id", "lang", "style", "title" or "xml:lang" The culprit is an <ol> tag which resumes from an earlier section so needs to start counting from 7. I'd prefer my book to validate correctly, but I wonder if this might be an oversight in the validator. Is epubcheck correct in telling me that 2.0.1 era epubs are not capable of using custom list numbering? None of the various ebook readers I've tried (including Calibre) appear upset by the glitch, and I'm wondering if it even IS an error. IIRC somewhere on the IDPF pages there was a list of what tags/attributes are permissible in which epub version, but of course I can't find it right now |
10-16-2022, 01:57 PM | #2 |
Wizard
Posts: 1,339
Karma: 6700866
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Maybe you can post a snippet of the code for us to look at.
|
Advert | |
|
10-16-2022, 02:05 PM | #3 | |
Resident Curmudgeon
Posts: 76,101
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
10-16-2022, 03:42 PM | #4 |
the rook, bossing Never.
Posts: 12,279
Karma: 89822819
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Also don't use automatic numbers of any kind in lists. Just use an un-numbered list and insert desired number/style at the start of each list item. Automatic numbering or bullets or anything other than indented list doesn't work in every ereader or app anyway. The manual approach always works. It's just you have to renumber if you later add an item in the middle.
Auto list numbering, auto section numbering and auto chapter numbering are just a convenience best avoided either in source Wordprocessor or HTML editors. |
10-18-2022, 10:13 AM | #5 |
Bookmaker & Cat Slave
Posts: 11,482
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
|
Advert | |
|
10-18-2022, 12:34 PM | #6 |
frumious Bandersnatch
Posts: 7,536
Karma: 19000001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
... meaning it might be supported by some reader, but it's not in the required set for ePub2 (and it's probably illegal in XHTML), so you can't rely on it.
|
10-21-2022, 01:13 AM | #7 | ||
Wizard
Posts: 2,303
Karma: 12126963
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Much better to change this: Code:
<ol start="7">This is an example.</ol>
Code:
<p class="list">7. This is an example.</p> Sad that that's the reality (because it stinks for Accessibility), but that's the only way to:
Quote:
And, in EPUB3 and HTML5+CSS3, you can do a lot more stuff... but again, many devices won't show this, so you have to settle for least common denominator. If you were making a website though... yes, you could use lots of fancy <ol> + list-style-type + CSS3 Counters code. But since we're doing ebooks, we most likely have to settle for hardcoded numbers in the text! Last edited by Tex2002ans; 10-21-2022 at 01:24 AM. |
||
01-25-2023, 08:19 PM | #8 |
Member
Posts: 20
Karma: 10
Join Date: Oct 2020
Device: none
|
Well it's the middle of the night, and in this late caffeine fugue I've stumbled a hideous hack that seems to work. Code snippet follows:
Code:
li.hidden { visibility: hidden; height: 0 } Code:
<ol> <li class="hidden">1</li> <li class="hidden">2</li> <li class="hidden">3</li> <li>List item starting at 4, but works in EPUB 2!</li> <li>Please don't hate me</li> <li>Obviously if you want to start at 50 or something it sucks to be you</li> <li>So, yuck</li> </ol> This is definitely one of those case where I'm torn between doing it, because I can, and feeling guilty about how horrible it is Last edited by Simons Mith; 01-25-2023 at 08:26 PM. |
01-25-2023, 10:08 PM | #9 |
Wizard
Posts: 2,303
Karma: 12126963
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
I stand by everything I said in October 2022. In that case, just hardcode your numbers.
|
01-25-2023, 10:25 PM | #10 | |
Wizard
Posts: 1,339
Karma: 6700866
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
display : Element is removed from the normal flow and hidden; the space it occupied is collapsed visibility: Element is hidden from view, but is not removed from the normal flow |
|
01-26-2023, 05:53 AM | #11 |
the rook, bossing Never.
Posts: 12,279
Karma: 89822819
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
|
01-26-2023, 06:29 AM | #12 | |
Grand Sorcerer
Posts: 27,990
Karma: 199001268
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Not to mention that I've never understood how ol elements are all that useful in ebooks to begin with. Unless you're coding a website that generates lists from dynamic database data, your numbered lists are unlikely to ever change. So code them (lists) up once, style them, and be done with them. |
|
01-26-2023, 07:36 AM | #13 |
Evangelist
Posts: 499
Karma: 2267928
Join Date: Nov 2015
Device: none
|
Lists are getting a nice hanging indent which is very hard to reproduce without it.
|
01-26-2023, 07:55 AM | #14 |
Grand Sorcerer
Posts: 27,990
Karma: 199001268
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Yes the hanging indents are very nice. But I'll choose "works everywhere" over "looks pretty" any day of the week.
|
01-26-2023, 08:09 AM | #15 |
the rook, bossing Never.
Posts: 12,279
Karma: 89822819
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
|
Tags |
<ol start="">, attribute, epub 2.0.1, tag |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Bogus "Not a Valid Picture" Errors | johnelle | Library Management | 9 | 09-18-2021 11:03 PM |
How to define the "Start" or "Beginning" page in Calibre | paul_01 | Conversion | 5 | 08-12-2016 06:58 AM |
epub to mobi problems "No valid entries in the spine of this EPUB" | TheFatMan | Conversion | 1 | 09-10-2013 10:59 PM |
Is "dc:rights" a valid entry in an OPF file for Kindlegen? | Stodder | Kindle Formats | 5 | 06-06-2011 06:52 PM |
"invalid PID checksum" when using mobidedrm, even though it IS valid. | Haidon | Kindle Formats | 141 | 11-05-2010 12:02 PM |