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

RE: thoughts on page templates

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Thu, 2 Feb 2012 04:47:27 +0000
To: Håkon Wium Lie <howcome@opera.com>
CC: "www-style@w3.org list" <www-style@w3.org>
Message-ID: <D51C9E849DDD0D4EA38C2E539856928412E2C693@TK5EX14MBXC218.redmond.corp.microsoft.com>
>From: Håkon Wium Lie [mailto:howcome@opera.com]
>Sent: Tuesday, December 13, 2011 9:51 AM
>Your long posting is thoughtful. But, alas, I don't understand much of it.

I have made those ideas into a wiki page [1], part of a set of pages that we have set up for discussions on regions and pages [2]. I hope we can make something productive out of it when we discuss in person.

>Are you saying there's a one-to-one relationship between elements and
>regions? This doesn't sound right to me -- the whole purpose of regions is
>to flow a stream of elements into them, no?

Only sometimes. I was saying that 1:1 regions are useful for placeholders - important building block for templates.

> Are you saying that
>  region-type: page
>would overflow the content that happens to end up in that region into
>pages? If so, when will you escape these pages and move to the next region?
>Only when you have an explicit break of some kind, I guess?

Exactly the topic we need to discuss more and get to an agreement on what "page" means in various contexts. 

Here "region-type:page" is meant to designate that the region actually represents a "page" in overall design or UI (as opposed to being e.g. a column). Once the role of the region is known, breaks inside the content can make intelligent decisions (such as on "break-before:page" knowing that the next region is in fact another page, not simply next column).

>So, you are saying that, but setting "region-type: box" on the H1 element,
>you somehow invite the boxes that the DIV element create, but not the DIV
>element itself?

Apparently a bad choice for value name. 'placeholder' could be better. But I think we have even better ideas with region options, will explain later. For now updating the wiki that this idea is too raw.

> > 3.       Page view with generated pages
> >
> > There may be many ways to generate pages from templates, but the  >
>outcome is reasonable to expect to be something like this:
> >
> > <div id="page-view">
> >      <!-- custom UI for page fiew -->
> >      <div id="page-container">
> >            <!-- generated pages, may or may not be in DOM -->
> >            <div id="page1"></div>
> >            <div id="page2"></div>
> >            ...
> >            <div id="pageN"></div>
> >      </div>
> > </div>
>I'm not sure that HTML should be used as a template language.
>Templates (at least the type we're dicussing here) are for presentational
>purposes. And elements are for (mostly) semantic purposes. So, I'd rather
>use CSS for this. Peter is using an at-rule
>(@region) to create regions instead of elements.

Actually I am using HTML here to show hierarchy of objects (elements or pseudo-elements). Not sure what else I could use that would be equally readable. 

Actual template language could be XML, CSS or something new, the important part is that for full control of page layout, nested nodes need to be generated.

> >      Div#page-container { content:pages }
>What doe this mean?

The next example represents the idea better:
	Div#page-container { content:pages(first-template-flow-name) }

That is similar to "overflow:paged", but it is trying to deal with template pages, potentially containing multiple flows (so simply placing the content in the "page container" is not a viable option).

The idea is that once the first template is selected, templates for following pages can be picked automatically based on flows already in use and available templates. Details are not  thought through yet on that approach.

> > 4.2. Event for page template selection  
> > ...
> > Could be like this:
> >
> >      function onNewPage(e) {
> >            if (e.pageNumber == 1) {
> >                 e.pageTemplate = "template-cover";
> >            } else {
> >                 e.pageTemplate = "template-two-column";
> > }
> >                 }
>Calling JS directly from CSS is, ahem, experimental.

Calling JS directly from layout process is not experimental, it is a bad idea. But providing a notification that layout is not progressing because there are no more pages is completely reasonable -- script is called when layout is completed and crates more work for layout to do later. That's exactly how printing works in IE (just no templates).


Anyway, those were raw ideas sent just after November F2F discussions. I am sure we'll come up with more solid ideas soon.

[1] http://wiki.csswg.org/spec/css3-region-templates
[2] http://wiki.csswg.org/spec#brainstorming

Received on Thursday, 2 February 2012 04:48:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:11 UTC