RE: [css3-gcpm] [css3-page] Named page lists

Also sprach Refstrup, Jacob Grundtvig:

 > >  > <div class="chapter">
 > >  > <h2>Chapter 1 heading</h2>
 > >  > This is the prose of the 1st chapter. Flows into 2nd page.
 > >  > </div>
 > >  > <div class="chapter">
 > >  > <h2>Chapter 2 heading</h2>
 > >  > This is the prose of the 1st chapter.
 > >  > </div>
 > >  >
 > >  > It would seem that the author would want the first page of each
 > >  > chapter to have title in the top-left page margin.
 > >
 > > No, the last rule in the style sheet says that there should be no such
 > > title on the first page of each chapter.
 > 
 > Missed that. If we have:
 > 
 > @page chapter:first { @top-left { content: "Chapter " counter(chapter-count) }
 > # assume for now that counter(chapter-count) just works :-)
 > 
 > Then we'll generate two pages -- of which I want the first one to
 > have "Chapter 1" and the second to have "Chapter 2" in it's header
 > (because they are first pages of a chapter).

Yes, this will work. Both div elements will start a new page group (I
think this is a useful term) due to non-auto values on the 'page'
property. And :first will match the first page of a page group.

 > > In my mind, which is arguably quite simple, it appears easier. Here's
 > > a pseudo-algorithm:
 > >
 > >   n = element.page;
 > >
 > >   if (n == auto) then p = ancestor.page; /* and so forth
 > > until a non-auto value, or the root element is found */
 > >
 > >   if (n != name-of-the-current-page) then {
 > >      page-break();
 > >      create-new-page(n);
 > >      name-of-the-current-page = n;
 > >   }
 > >
 > > When a new page is created, all the rules set on that page --
 > > including left, right and first -- must be applied.
 > >
 > > Does this make sense?
 > 
 > Helps but I'm not quite there yet. I'm not worried about page
 > breaks 'cos I think you've nailed that pretty good; I'm worried
 > about what the chapter:first rule matches. I am saying that the
 > intent of the above modified CSS and HTML is to have chapter:first
 > match both page.

Yes, agreed, that's what the proposal does.

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Friday, 11 July 2008 22:17:49 UTC