Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-26-2023, 08:49 AM   #1
annako
Junior Member
annako began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2023
Device: none
Nested Lists Not Working for ePubs

Hello! I hope everyone is having a great day.

I'm having an issue trying to create nested lists in epubs. This is not for a nav or toc.xhtml document, but rather, appears in the running text of the book. For example, I want a nested list in the <body> tag of chapter01.xhtml:

Code:
<ul>
<li>First item</li>
   <ul>
      <li>First item Quality A</li>
      <li>First item Quality B</li>
   </ul>
<li>Second item</li>
   <ul>
      <li>Second item Quality A</li>
      <li>Second item Quality B</li>
   </ul>
</ul>
This is the correct way to nest lists to my knowledge. However, running the epub through pagina epub checker brings up the error:

"Error while parsing file: element "ul" not allowed here: expected the element end-tag or element "li", "script", or "template"

switching to <ol> tags doesn't work, and in any case, not what I want (I don't want a numbered list, but bulleted).

It seems only <li> are allowed within <ul> or <ol> tags. I tried searching on google for nesting lists for epubs, but it doesn't seem to be a common problem? What am I doing wrong?

Thank you in advance!
annako is offline   Reply With Quote
Old 05-26-2023, 09:33 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,734
Karma: 5444398
Join Date: Nov 2009
Device: many
Your knowledge of how to nest is incorrect (but does work in all browsers I have tested!).
To see it properly done take a look at how nesting is done in the nav.

Or

try this shortened snippet based on your above. The second level ul is actually nested inside the first li tag because the nested list belongs to that list item.

Code:
<ul>
  <li>First item
     <ul>
        <li>First item Quality A</li>
        <li>First item Quality B</li>
     </ul>
  </li>
  <li>Second item</li>
</ul>
Or based on a quick web search (which you should probably do before asking here )

See https://stackoverflow.com/questions/...ml-nested-list

And:

https://developer.mozilla.org/en-US/...#nesting_lists

Last edited by KevinH; 05-26-2023 at 09:40 AM.
KevinH is offline   Reply With Quote
Old 05-26-2023, 09:46 AM   #3
annako
Junior Member
annako began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Mar 2023
Device: none
Oh my gosh it worked. I feel so silly now for not realizing that I need to nest the second <ul>/<ol> within a <li> tag. Thank you so much for explaining to me! Have a lovely day
annako is offline   Reply With Quote
Old 05-26-2023, 10:19 AM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,119
Karma: 18727091
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
That is how I get it to work as well… although IIRC epubcheck throws fits with nesting it that way??? I haven’t tried it in awhile, it may have been fixed with the latest epubcheck update.
Turtle91 is offline   Reply With Quote
Old 05-26-2023, 10:25 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,604
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
That is how I get it to work as well… although IIRC epubcheck throws fits with nesting it that way??? I haven’t tried it in awhile, it may have been fixed with the latest epubcheck update.
The code posted in the 1st post does throw errors with the latest epubcheck.
JSWolf is online now   Reply With Quote
Old 05-26-2023, 10:30 AM   #6
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,604
Karma: 130140792
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by annako View Post
This is the correct way to nest lists to my knowledge. However, running the epub through pagina epub checker brings up the error:
If you were to use Calibre's Editor or Sigil, you could install the epubcheck plugins. That way if you do find any errors, it would be a lot easier to fix them as you can click on the error and be taken to the line that has the error to then fix.
JSWolf is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Google Play Books and Nested Lists - Some Weird Display Issue rsuchwani ePub 80 10-10-2021 03:08 PM
Automatically Fixing Nested Lists Rand Brittain Editor 2 09-06-2017 06:58 PM
Nested lists with paragraphs sdm1130 Kindle Formats 4 11-22-2011 06:32 PM
Nested Ordered Lists andyd273 Conversion 9 11-17-2011 12:05 PM
Classic Nook Nested Lists ldespain Barnes & Noble NOOK 0 08-08-2011 04:06 PM


All times are GMT -4. The time now is 03:49 PM.


MobileRead.com is a privately owned, operated and funded community.