W3C home > Mailing lists > Public > www-style@w3.org > February 2012

[paginated-masters] Element master templates (was: planA/planB)

From: Alan Stearns <stearns@adobe.com>
Date: Wed, 22 Feb 2012 14:00:49 -0800
To: "www-style@w3.org Style" <www-style@w3.org>
Message-ID: <CB6AA591.BC21%stearns@adobe.com>
Hey all,

There's been a bunch of discussion about extending @page rules to provide
master templates for paginated layout. That's where my thinking started as
well, but currently I'm considering using master templates at an element
level instead of for the entire document.

I like the ideas in GCPM for paged presentations, and there you can set
overflow-style on a single element. I think it would be interesting to use
that switch for turning on a paginated display and provide a means to
associate such a paginated element with a master template.

A master template can define boxes (or slots) that can contain content - the
content can come from the element, a named flow, or be generated content.
Since these master templates apply to paginated elements, if the content
associated with any slot overflows, a new paged view is created with
additional boxes until all of the content is displayed.

Because I would like to make master templates work with the ideas from GCPM,
I have a notion of an implicit master template with an implicit slot. The
implicit master template has a single implicit slot that contains the
paginated element's content. So the following four examples are equivalent -
they all give the same rendering as specified in GCPM. Examples 2-4 would
never actually be used without adding more boxes to the template.

1. (no master template defined)
   #content { overflow-style: paged-x; }

2. (template with implicit content slot)
   #content { overflow-style:paged-x; }
   @master-template { }

3. (template with explicit content slot)
   #content { overflow-style:paged-x; }
   @master-template {
     template-slots: content;
     <slot-syntax>(content) { }
   }

4. (template using an explicit region slot)
   #content { overflow-style:paged-x; }
   #content > * { flow-into: content-flow; }
   @master-template {
     template-slots: main;
     <slot-syntax>(main) {
       flow-from: content-flow;
     }
   }
    
I don't know what the correct syntax for addressing slots should be, so I'm
using <slot-syntax> here as a stand-in. The template-slots descriptor lets
you create named slots in the template and specify their order if that
matters for positioning.

Master templates can create more boxes to suit the intended design:

A simple header for each page:

   #content { overflow-style:paged-x; }
   @master-template {
     template-slots: header, content;
     <slot-syntax>(header) {
       content: "title string";
     }
     <slot-syntax>(content) { }
   }

A simple footer for each page:

   #content { overflow-style:paged-x; }
   @master-template {
     template-slots: content, footer;
     <slot-syntax>(content) { }
     <slot-syntax>(footer) {
       content: "author string";
     }
   }

Displaying two articles side-by-side:

   .article1 { overflow-style:paged-x; }
   .article2 { flow-into:second-article; }
   @master-template {
     template-slots: content, right;
     <slot-syntax>(content) {
       width: 40%;
       padding: 5%
       float:left;
     }
     <slot-syntax>(right) {
       flow-from: second-article;
       width: 40%;
       padding: 5%
       float:right;
     }
   }

Please let me know what you think. There is a lot more that would need to be
defined, and I'm not tied to any of the specific terms or syntax I'm using
here. But I think that the idea of using an @rule to arrange boxes and
assign content in a master template should work.

Thanks,

Alan
Received on Wednesday, 22 February 2012 22:01:18 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:51 GMT