View Full Version : Continuing numbered lists (ol) in ADE


EricDP
07-13-2010, 10:42 PM
I have a list that has a break in it, and then continues. Using the (deprecated) "start" or "value" tags don't work in ADE, and neither does using CSS auto-content. For example, I tried the following sample, but it didn't work:

In stylesheet:
OL#page_one { counter-reset: item }
OL#page_two { counter-reset: item 5 }
LI { display: block }
LI:before {
content: counter(item) ". ";
counter-increment: item;
display:block;
}


In body:
<ol id="page_one">
<li>Division Bell</li>
<li>Atom Hearth Mother</li>
<li>Relics</li>
<li>Dark Side of the Moon</li>
<li>Wish You Were Here</li>
</ol><ol id="page_two">
<li>The Wall</li>
<li>More</li>
<li>Piper at the gates of Dawn</li>
<li>Final Cut</li>
<li>Meddle</li>
</ol>


I also tried just starting a new list and having a bunch of empty entries with font-size: 0em; so they wouldn't show up, but some readers seems to have a minimum font size, so those show no matter what I do.

Any thoughts on other alternatives that might work?

HarryT
07-14-2010, 03:36 AM
Does this really not work?


<ol>
<li value="10">Line 10</li>
<li value="20">Line 20</li>
</ol>

nomesque
07-14-2010, 03:52 AM
Sorry if I'm chucking something into a discussion I don't understand as well as I think I do (HTML and XML background), but - are you basically trying to do this:

Numbered list
Other text
Continue numbered list
?

Have you tried *wince* using the same ol id?

ie:

<ol id="page_one">
<li>Division Bell</li>
<li>Atom Hearth Mother</li>
<li>Relics</li>
<li>Dark Side of the Moon</li>
<li>Wish You Were Here</li>
</ol><ol id="page_one">
<li>The Wall</li>
<li>More</li>
<li>Piper at the gates of Dawn</li>
<li>Final Cut</li>
<li>Meddle</li>
</ol>

Does that cause nasty things to happen in Epub validation?

HarryT
07-14-2010, 04:01 AM
On www.w3.org (http://www.w3.org/TR/html401/struct/lists.html#h-10.2) it specifically says:

In ordered lists, it is not possible to continue list numbering automatically from a previous list or to hide numbering of some list items. However, authors can reset the number of a list item by setting its value attribute. Numbering continues from the new value for subsequent list items.

EricDP
07-14-2010, 10:40 AM
Does this really not work?


<ol>
<li value="10">Line 10</li>
<li value="20">Line 20</li>
</ol>


Works in Sigil, does not work in ADE.

EricDP
07-14-2010, 10:49 AM
Have you tried *wince* using the same ol id?

ie:

<ol id="page_one">
<li>Division Bell</li>
<li>Atom Hearth Mother</li>
<li>Relics</li>
<li>Dark Side of the Moon</li>
<li>Wish You Were Here</li>
</ol><ol id="page_one">
<li>The Wall</li>
<li>More</li>
<li>Piper at the gates of Dawn</li>
<li>Final Cut</li>
<li>Meddle</li>
</ol>

I hadn't tried it, but it doesn't work either - not even in Sigil. It resets the counter.

ADE is so broken it doesn't seem to implement the 'content' tag at all. For example, I changed content: counter(item) ". "; to content: counter(item) ".x. "; to see if it was counting and just not resetting properly - the "x." doesn't even show up. It's just doing a regular OL without looking at what specific content I want to include.

Has anybody had any success with content in either ADE or Sigil? You should be able to do things like content: "Chapter " counter(item); and have that work too, showing "Chapter 1", "Chapter 2", etc., but I can't seem to make it work in ADE or Sigil. :(

Peter Sorotokin
07-14-2010, 11:45 AM
I hadn't tried it, but it doesn't work either - not even in Sigil. It resets the counter.

XHTML 1.1 (unlike HTML 4) does not support value attribute.

ADE is so broken it doesn't seem to implement the 'content' tag at all.


Of course, if you read OPS spec, you'd see that counter property cannot be used in this context in EPUB (remark for counter property says "[9] Must not be used within a style sheet whose @media value is other than aural"). But I am asking for too much, I know.

OPS is not really geared to truly open-ended styling. You best bet is to have some sort of transformation step (e.g. XSLT) as a part of packaging process. That would also allow you to use custom markup that can capture more semantics, which is useful for books.

HarryT
07-14-2010, 12:38 PM
XHTML 1.1 (unlike HTML 4) does not support value attribute.


What's the replacement for it, Peter? I'm really surprised that there's no way to implement numbered lists with numbers that you can choose yourself; it seems an extremely "retrograde" step to remove such a facility without providing a substitute.

Peter Sorotokin
07-14-2010, 03:01 PM
What's the replacement for it, Peter? I'm really surprised that there's no way to implement numbered lists with numbers that you can choose yourself; it seems an extremely "retrograde" step to remove such a facility without providing a substitute.

I think it will reappear in HTML5/XHTML5.

The sad truth is that automatic list numbering and counters are not integrated in CSS2. Supposedly, CSS3 will fix it with list-item counter name, but the spec as it stands is still incomplete (it does not explain how to handle nested numbered lists).

Also CSS numbering scheme is too simplistic does not match any real-world word processors, so its utility is very limited. It does work for simple things, but the moment you get into complex document transformations, the easiest thing to do is to simply insert all the generated content yourself.

HarryT
07-14-2010, 03:24 PM
Thank you for that explanation.

EricDP
07-14-2010, 04:47 PM
the easiest thing to do is to simply insert all the generated content yourself.

That's where I'm at now. Next challenge is getting the alignment correct - to pivot around the dot etc..

For example, center this so it will a pivot around the "." (and, of course, the "." isn't centered, and it will still wrap pages so a centered 'inline-block' table can't be used). Argh!


Part I
I. A chapter
II. Another
III. Now we're getting somewhere

Part II
IV. And it continues
XXIX. Getting exciting...
XXXIV. Time to finish

Peter Sorotokin
07-14-2010, 05:02 PM
That's where I'm at now. Next challenge is getting the alignment correct - to pivot around the dot etc..

For example, center this so it will a pivot around the "." (and, of course, the "." isn't centered, and it will still wrap pages so a centered 'inline-block' table can't be used). Argh!

Maybe I am missing something. How about just "display:inline-block; width: 3em; text-align: right" for the label? If your list items are long and have to go to multiple lines, something like "margin: 3em; text-indent: -3em" would help to make the label "hang" on the right.

Jellby
07-15-2010, 06:38 AM
Maybe I am missing something. How about just "display:inline-block; width: 3em; text-align: right" for the label?

If I remember correctly, inline-block is not in the required CSS subset of ePUB.

graycyn
09-07-2010, 09:30 AM
Well, it's funny I found this thread, because I've been struggling with this exact same thing all night. Have a book with 6 parts, 54 chapters. In my case, the chapters had rather long titles in some instances, so I had to create a span class to make certain of those work and look nice.

I will first say that I am a TOTAL noob at CSS and equally a noob at epub. So don't laugh too hard. I'm trying to make sense of it all with my 53 year old brain and not doing so well! And I was trying to duplicate the style of my old print book. I came pretty close, actually!

I used an unordered list, but then, to line up my decimals, I used as many non-breaking spaces as I needed to do it. And likewise to make my PART headings line up where I wanted.


<ul>
<li class="section">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PART ONE</li>
<li>&nbsp;&nbsp;1. &nbsp;This is a real noob solution</li>
<li>&nbsp;&nbsp;2.&nbsp;&nbsp;but it does seem to work in ADE and on Nook</li>
<li>&nbsp;&nbsp;4.&nbsp;&nbsp;even if it is awkward as hell</li>
<li>&nbsp;&nbsp;5.&nbsp;&nbsp;call me crazy</li>
<li>&nbsp;&nbsp;6.&nbsp;&nbsp;but this problem drove me nuts all night</li>
</ul>
<ul>
<li class="section">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PART TWO</li>
<li>10.&nbsp;&nbsp;I had 54 chapters</li>
<li>11.&nbsp;&nbsp;so I needed to make those decimals line up</li>
<li>12.&nbsp;&nbsp;this seemed to do it</li>
</ul>
Then I styled the unordered list so that there were no bullets.



ul {list-style: none;
list-style-position: outside;
list-style-image: none;
line-height: 1em;
}
It did work for me in ADE and on my Nook! Which is all I care about, since the book I'm doing is an effort just for me. I don't know if it would be a good idea to use this method on something to be actually published though. It might not work on every device.

Just thought I'd post in case it helps anyone.