counters: total count

I was thinking about the problem of getting a total pages count to put in
print footers and the various permutations of that one might want. There
was a proposal for a 'pages' or 'total-pages' counter at some point. I'm
thinking a better option would be a total-count() function for the 'content'
property. That allows the function to apply to any counter, and it could
take advantage of counter-reset and counter-increment to include/exclude
pages or do section counts.

example:

   @page { @bottom-right { content: counter(page) "of" total-count(page); } }

example:

   @page { counter-increment: page; }

   @page { @bottom-right { content: counter(page) "of" total-count(page); } }

   @page titlepage { counter-increment: none; }

example:

   .prologue { counter-reset: page; page: frontmatter; }
   .main { counter-reset: page; page: main; }

   @page { @bottom-right { content: counter(page) "of" total-count(page); } }

   @page frontmatter { @bottom-right {
      content: counter(page, lower-roman) "of" total-count(page);
   } }

example:

   @media speech {
     li:first-child::marker {
       content: counter(list-item) "of" total-count(list-item);
     }
   }

~fantasai

Received on Monday, 15 October 2007 23:05:21 UTC