Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 07-05-2013, 09:51 PM   #16
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 270
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
My little project is really coming togeather; your explainations have really helped a lot

So I tried emulate a numbering style that I've seen many times:

H1's = Section x
H2's = Chapter x

Except that the H2 counter doesn't get reset to 1 when the H1 changes, and the H1's continue to Increment:

Section 1
Chapter 1
Chapter 2
Chapter 3

Section 2
Chapter 4
Chapter 5
Chapter 6

It looks so easy. I have the H2's continuing to increment, but the H1 counter remains 'stuck' at 1.

Can anyone see what I'm doing wrong, or not doing right?

Code:
body
{
counter-reset:h1number;
counter-reset:h2number;
}

h1:before 
{
counter-increment:h1number;
content:"Section# " counter(h1number) " – ";
}

h2:before 
{
counter-increment:h2number;
content:"Chapter# " counter(h2number) " – ";
}

Thanks

Paul
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	30
Size:	75.5 KB
ID:	107793  
Attached Files
File Type: epub Test CSS Counter2.epub (2.8 KB, 15 views)
phossler is offline   Reply With Quote
Old 07-05-2013, 11:01 PM   #17
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Try this
Code:
body {
    counter-reset: h1number;
}
h1:before {
    content: "Section # " counter(h1number) " - ";
    counter-increment: h1number;  
}
h1 {
    counter-reset: h2number;
}
h2:before {
    content: "Chapter# " counter(h2number) " - ";
    counter-increment: h2number;
}
Based on http://www.w3.org/TR/CSS21/generate.html
PeterT is offline   Reply With Quote
 
Enthusiast
Old 07-06-2013, 11:02 AM   #18
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 270
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
Thanks, but that's pretty much where I started, before I tried to be clever

Look at the screen shot which has your CSS. The H1's increment, but the H2's reset to 1 when the H1 changes.

I was trying to get the two counters to run 'independently' without the H2 counter reseting to 1 in the h1 { } so that the H1 counter just count up, and the h2 counters also just count up

So I was trying to get an automated numbering like I saw in some books, and I decided to try getting the counter's to give me:

Section 1
Chapter 1
Chapter 2
Chapter 3

Section 2 <------ should be incremented, but remains = 1 in my CSS
Chapter 4 <----- not reset to 1, but just incremented
Chapter 5
Chapter 6

Section 3 <------ should be incremented, but remains = 1 in my CSS
Chapter 7 <----- not reset
Chapter 8
Chapter 9

If all else fails, I'll go back to the outline numbering that I know works

Paul
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	30
Size:	80.3 KB
ID:	107851  
phossler is offline   Reply With Quote
Old 07-06-2013, 11:49 AM   #19
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
All I can say is that when i tried it worked perfectly. Chapters incremented and reset and sections increased.

Sorry to have wasted your time.
PeterT is offline   Reply With Quote
Old 07-06-2013, 01:54 PM   #20
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
One final idea... Try
Code:
body
{
counter-reset:h1number h2number;
}
Also keep in mind this will ONLY work if the entire book is in a single (x)html file. As soon as you have multiples.... it will reset within each file.
PeterT is offline   Reply With Quote
Old 07-06-2013, 04:42 PM   #21
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 270
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
Quote:
All I can say is that when i tried it worked perfectly. Chapters incremented and reset and sections increased.
Could you attach a small epub so I can see how you did it?

In my test doc with your CSS, the H1's increment, but the H2's reset to 1 within each H1

I was trying to have both the H1's and H2's count up independently with out resetting so I'd end up with something like

Section 1
Chapter 1
Chapter 2
Chapter 3

Section 2
Chapter 4
Chapter 5
Chapter 6

Section 3
Chapter 7
Chapter 8
Chapter 9



Paul
Attached Files
File Type: epub Test CSS Counter3.epub (2.7 KB, 19 views)
phossler is offline   Reply With Quote
Old 07-06-2013, 05:03 PM   #22
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
See attached

Section #1 - One
Chapter #1 - One-One
Chapter #2 - One-Two
Section #2 - Two
Chapter #3 - Two-One
Section #3 - Three
Chapter #4 - Three-One
Chapter #5 - Three-Two
Chapter #6 - Three-Three
Section #4 - Four
Chapter #7 - Four-One
Attached Files
File Type: epub Test CSS Counter4.epub (2.8 KB, 20 views)
PeterT is offline   Reply With Quote
Old 07-06-2013, 06:21 PM   #23
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 270
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
Works well

Thanks for your efforts

Paul
phossler is offline   Reply With Quote
Old 07-06-2013, 06:28 PM   #24
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
All I changed was to put the two counter-reset's for body in a single CSS statement....
PeterT is offline   Reply With Quote
Old 07-06-2013, 09:15 PM   #25
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 2,247
Karma: 11710167
Join Date: Apr 2010
Location: Phoenix, AZ
Device: Kindle2, iPad, KindleFire and NookColor
Quote:
Originally Posted by PeterT View Post
One final idea... Try
Code:
body
{
counter-reset:h1number h2number;
}
Also keep in mind this will ONLY work if the entire book is in a single (x)html file. As soon as you have multiples.... it will reset within each file.
Yes...I just want to say, as clever as this coding is, and it is, (Gods know, I wish it would work for lists that you need to interrupt and restart, across the board) I seriously hope that this is a VERY short book. ;-) I get the squishies thinking about how this will work if it's a really long, dense, single-file ePUB/MOBI. FWIW.

Hitch
Hitch is offline   Reply With Quote
Old 07-06-2013, 09:30 PM   #26
PeterT
Taking a break; Fed up
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 6,527
Karma: 43458940
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
Hitch; I agree totally with you on that! I will admit though all this does pique my interest in learning more about CSS!
PeterT is offline   Reply With Quote
Old 07-07-2013, 09:58 AM   #27
phossler
Addict
phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!phossler is faster than a rolling 'o,' stronger than silent 'e,' and leaps capital 'T' in a single bound!
 
Posts: 270
Karma: 50154
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
@PeterT --

Quote:
Also keep in mind this will ONLY work if the entire book is in a single (x)html file. As soon as you have multiples.... it will reset within each file.

@Hitch --

Quote:
I seriously hope that this is a VERY short book. ;-) I get the squishies thinking about how this will work if it's a really long, dense, single-file ePUB/MOBI. FWIW.
Yea, unfortunately the book that I was trying to cleanup and to fix the formatting on (which I hoped to use non-resetting numbering in) is structured with each chapter in a seperate file.

So the technique works well on the single file epubs but not on the multi-file ones (where it would really make life easier) ... darn. That also explains the situation I was seeing with a larger multi-html file test also

Still, there's going to be times when the technique is useful and will save me some grunt work

Paul

Last edited by phossler; 07-07-2013 at 10:13 AM.
phossler is offline   Reply With Quote
Old 07-07-2013, 11:51 AM   #28
theducks
Grand Sorcerer
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 14,263
Karma: 5495472
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2, Astak Pocket Pro, K4NT
Many a time I have wished for a numbering plugin that worked on consecutive-selected files that would Insert/replace or After a specified pattern.

The tool would also allow choice of numbering styles:
1)Arabic, II)Roman, Three)Text
with an optional user supplied Prefix string: eg. Chapter, Part, Section

I just don't trust Calculated on the fly Chapter heading. 1 glitch and the TOC or other reference goes horribly wrong.

<ol>'s are already notoriously erratic
theducks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
line-counter needed schuster Calibre 4 05-15-2011 12:15 PM
Classic over the counter iandix Barnes & Noble NOOK 7 02-07-2010 05:48 AM
No Page Counter andavane Bookeen 2 10-25-2009 04:32 AM


All times are GMT -4. The time now is 01:13 PM.


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