- From: Refstrup, Jacob Grundtvig <jacob.refstrup@hp.com>
- Date: Fri, 11 Jul 2008 17:53:00 +0000
- To: Håkon Wium Lie <howcome@opera.com>
- CC: "www-style@w3.org" <www-style@w3.org>
Håkon wrote:
> 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.
>
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).
> > 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 :)
Sorry.
>
> 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.
Hope that sentence computes better :)
- Jacob
Received on Friday, 11 July 2008 17:54:59 UTC