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

Also sprach Refstrup, Jacob Grundtvig:

 > One of the examples that you refered to had:
 > 
 > > >   div.chapter { page: chapter }
 > > >   h2 { string-set: title content() }
 > > >   @page chapter:left { @top-left { content: string(title) }}
 > > >   @page chapter:first { @top-left { content: none }}
 > 
 > With the following document fragment:
 > 
 > <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.

 > Imagine this document generating two pages -- they'll both be named
 > 'chapter'; but in this case we want chapter:first to match both of
 > them.

Yes.

 > Therefore when checking for <named-page>:first you'd have to go
 > back to the nearest ancestor with a page valid other than 'auto'
 > and match first iff the current page is the first page for that
 > ancestor to appear.

I ran out of memory trying to parse that sentence :)

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?

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

Received on Friday, 11 July 2008 16:59:15 UTC