View Single Post
Old 10-30-2007, 01:31 PM   #82
jbenny
Addict
jbenny has a complete set of Star Wars action figures.jbenny has a complete set of Star Wars action figures.jbenny has a complete set of Star Wars action figures.jbenny has a complete set of Star Wars action figures.
 
Posts: 323
Karma: 358
Join Date: May 2007
Device: Tablet PC and Nokia N800
Paragraph Numbers

Just fooling around, I tried a few things to implement paragraph numbers. The CSS 2.0 spec talks about "Generated content" http://www.w3.org/TR/REC-CSS2/generate.html. I tried this, but the examples would not work in Firefox, so I didn't even try it in Digital Editions.

The next thing I tried was floating a span next to a paragraph, like so:
span.pnum { float:left; width:4em; }
This seemed to work. After adding the same amount of left margin to the paragraph to simulate a separate column, things looked good in Firefox.
p { margin-left: 4em; }
I then created an epub, using this method. The epub is attached. Rename if from .zip to .epub. If you want to see how this looks in your browser, just extract the HTML file from the archive.

Since FBReader still does not support CSS, of course things displayed badly. The Lector plugin, using Firefox for rendering, displayed exactly as native Firefox. The only real test at this point was Digital Editions. Sorry to say, DE got it almost right. The numbers and paragraphs are in their own columns, as they should be. However, the paragraphs all start one line below the corresponding number. This isn't what we wanted, but is still useable.

It is possible that my quickly thrown together example is not correct in some way and that this may be the reason that DE isn't doing what we want. I will have to look at this a little closer before laying the blame on DE.

EDIT: I was thinking that using span outside a block element was probably not correct XHTML, so I wrapped each span/paragraph pair in a div for correctness. This didn't make any difference in how things displayed in FF or DE.

Edit: Using a separate div for each column was my first thought (like the way you would do it on a web page). However, since these are separate block elements, how would you keep the numbers in sync with the paragraphs? Using an in-line span was a lot easier.
Attached Files
File Type: zip ParagraphNumbers.zip (2.1 KB, 283 views)

Last edited by jbenny; 10-30-2007 at 01:46 PM.
jbenny is offline   Reply With Quote