Skip to content

Commit f6fa6dc

Browse files
committed
Changed page-templates proposal to be element- rather than document-based
1 parent 3a7a37f commit f6fa6dc

1 file changed

Lines changed: 128 additions & 52 deletions

File tree

css3-page-template/Overview.src.html

Lines changed: 128 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head profile="http://www.w3.org/2006/03/hcard">
44
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5-
<title>CSS Page Templates Module Level 3</title>
5+
<title>CSS Paginated Templates Module Level 3</title>
66
<link rel="stylesheet" type="text/css" href="../default.css">
77
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS]">
88
<link id="st" href="../alternate-spec-style.css" rel="stylesheet"
@@ -31,7 +31,7 @@
3131
<body><div class="head">
3232
<!--logo-->
3333

34-
<h1>CSS Page Templates Module Level 3</h1>
34+
<h1>CSS Paginated Templates Module Level 3</h1>
3535

3636
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
3737

@@ -67,10 +67,10 @@ <h2 class="no-num no-toc" id="abstract">Abstract</h2>
6767

6868
<p>CSS is a language for describing the rendering of structured documents
6969
(such as HTML and XML) on screen, on paper, in speech, etc. This module
70-
contains the features of CSS level&nbsp;3 relating to paged view templates.
70+
contains the features of CSS level&nbsp;3 relating to paginated templates.
7171
It includes and extends the functionality of CSS level&nbsp;2 [[!CSS21]],
7272
which builds on CSS level&nbsp;1 [[CSS1]].
73-
The main extension compared to level&nbsp;2 is the ability to specify one or more templates for a paged view to use to render content.
73+
The main extension compared to level&nbsp;2 is the ability to specify one or more paginated templates that be used to render content.
7474

7575
<h2 class="no-num no-toc" id="status">Status of this document</h2>
7676

@@ -89,9 +89,11 @@ <h2 id="intro">
8989

9090
<p>CSS beyond level 2 is a set of modules, divided up to allow the specifications to develop incrementally, along with their implementations. This specification is one of those modules.
9191

92-
<p>This module describes how to define page templates in CSS. Page templates consist of anonymous boxes called slots created to contain content. Layouts done with page templates mainly determine the size of slots from the template definition instead of the intrinsic size of their content. When content does not fit into a template slot, additional pages are created with more slots to contain the overflow content.
92+
<p>This module describes how to define paginated templates in CSS. Paginated templates consist of anonymous boxes called slots created by CSS to contain content. Layouts that use paginated templates mainly determine the size of these slots from the template definition instead of the intrinsic size of their content. When content does not fit into a template slot, additional pages are created with more slots to contain the overflow content.
9393

94-
<p>Multiple page templates can be defined for a given document. Which template is used for each page can be defined by a selector or by choosing a template based on available content.
94+
<p>Multiple paginated templates can be defined for a given document. Which template is used for each paginated element can be defined by a selector or by choosing a template based on available content. Elements can further constrain the applicable template set by listing which templates should apply.
95+
96+
<p class="issue">The terms 'template' and 'page' are overloaded in CSS, but they are the words that most clearly describe the concept. Other suggestions are welcome, but only if they are more helpful than onelook.com (which suggested "Captain Submarine").
9597

9698
<h3 id="placement">
9799
Module Interactions</h3>
@@ -104,49 +106,102 @@ <h3 id="values">
104106
<var class="replaceme"></var>
105107

106108
<h2 id="templates-and-slots">
107-
Page Templates and Slots</h2>
109+
Paginated Templates and Slots</h2>
110+
111+
<p>An @template rule defines a template. Templates contain one or more slots to display content. An element uses paginated templates to display its own content and/or content from named flows if its 'overflow-style' property is set to any of the paged-* values defined in css3-gcpm. If a document defines no paginated templates, then there is an implicit paginated template with a single slot containing the paginated element's contents.
108112

109-
<p class="issue">Should we extend the existing @page rule or create a new @page-template or @page-master rule?
110-
<p class="issue">Alternately, we could use concepts from WebComponents to define templates.
113+
<p>A slot is an anonymous box in a paginated template where content can be placed. In an @template rule the template-slots property lists how many slots can be created in a particular template, their names, and their order. Each named slot can be addressed and styled with a ::slot(name) pseudo-element.
111114

112-
<p>A slot is an anonymous box in a page template where content can be placed. In an @page rule the positioned-slots property lists how many slots exist in a particular template, their names, and their order. Each named slot can be addressed and styled with the ::slot() pseudo-element.
115+
<div class='example'>
116+
<p>Sample @template syntax with no content assignments
117+
<pre>
118+
@template {
119+
template-slots: one, two, three;
120+
::slot(one) { }
121+
::slot(two) { }
122+
::slot(three) { }
123+
}
124+
</pre>
125+
</div>
113126

114-
<p class="issue">Should the property name be page-slots instead of positioned-slots?
127+
<p>If an @template rule does not assign a value to the template-slots property then one default 'content' slot exists, which contains the element's content. The 'content' slot can be specified in the slot list in the template-slots property. If the template-slots property does not include 'content' in its list then an element that uses that template does not display its own content.
128+
129+
<div class='example'>
130+
<p>An @template rule that creates header and footer slots around the paginated element's content
131+
<pre>
132+
@template {
133+
template-slots: header, content, footer;
134+
::slot(header) { }
135+
::slot(content) { }
136+
::slot(footer) { }
137+
}
138+
</pre>
139+
</div>
115140

116-
<p>Slots can be assigned content from named flows. If any slot in a template has overflow content, a new page is created with a new set of slots to receive the overflow content. Slots with the same named flow assignment (within a template and/or across pages created from templates) form a region chain.
141+
<p>Slots can be assigned content from named flows. Slots can contain generated content assigned from the content property. Slots only instantiate if they are assigned content from a named flow, or the computed value of their 'content' property does not match its initial value.
117142

118-
<p>Slots can contain generated content assigned from the content property. Slots only instantiate if they are assigned content from a named flow, or the computed value of their 'content' property does not match its initial value.
143+
<p>If any slot in a paginated template has overflow content, a new page is created with a new set of slots to receive the overflow content. Slots with the same named flow assignment (within a template and/or across pages created from templates) form a region chain.
119144

120-
<p>The default size for a paged view is the size of the viewport.
145+
<p>The default size for a template is the size of the viewport. If no @template rule is specified the document contains one viewport-sized template with a default 'content' slot.
121146

122-
<p class="issue">Do we need to define vertical-align behavior for slots, the way css3-layout does?
147+
<p class="issue">Slot pseudo-elements are a first pass at defining CSS-created boxes to house content. Alternately, we could use concepts from WebComponents to define the boxes. Whichever way the boxes are created there needs to be a way of accessing the template structure through scripting.
123148

124149
<p class="issue">Is there a need to create more structure, nesting slots within slots?
125150

151+
<h2 id="conditional-templates">
152+
Template Selection</h2>
153+
154+
<p>Multiple templates can be defined for a single document. An element that uses paginated templates either selects a template from the entire document set or a subset defined by the 'template-set' property. Each page view created uses a single template. This template can be chosen from the applicable set using a selector, or by matching available content using the 'required-flow' property.
155+
156+
<p class="issue">Instead of specifying a template-set, should there be a way of scoping @template rules to an element? The purpose of template-set is to be able to share template sets between elements.
157+
158+
<h3 id='templates-property'>
159+
Associating Templates with Elements</h3>
160+
161+
<p>An element with 'overflow-style:paged-*' set will render a paginated view. The contents of each page in the paginated view will be determined by a single template.
162+
126163
<div class='example'>
127-
<p class="issue">Add graphics for all of the examples.
164+
<p>The simplest example takes all of the content in the document and flows it into a paginated template with a single slot. This template will display a viewport's worth of content at a time, and will create a new slot on a new page each time content overflows.
165+
166+
The four examples below are equivalent.
167+
168+
<pre>
169+
body { overflow-style:paged-x; }
170+
</pre>
171+
172+
<pre>
173+
body { overflow-style:paged-x; }
174+
@template { }
175+
</pre>
128176

129-
<p>The simplest example takes all of the content in the document and flows it into a page template with a single slot. This template will display a viewport's worth of content at a time, and will create a new slot on a new page each time content overflows.
130177
<pre>
131-
body { flow-into: body; }
178+
body { overflow-style:paged-x; }
179+
@template {
180+
template-slots: content;
181+
::slot(content) { }
182+
}
183+
</pre>
132184

133-
@page {
134-
positioned-slots: main;
185+
<pre>
186+
body { overflow-style:paged-x; }
187+
body > * { flow-into: body; }
188+
@template {
189+
template-slots: main;
135190
::slot(main) {
136191
flow-from: body;
137192
}
138193
}
139194
</pre>
140-
<p class="issue">Should there be an implicit 'body' flow?
141195
</div>
142196

143197
<div class='example'>
144-
<p>A page template could contain two side-by-side slots that paginate two separate articles. This example fills the left side of the paged view with content from article1 and the right side with content from article2. New pages and slots are created until the content from both articles is exhausted.
198+
<p>A paginated template could contain two side-by-side slots that paginate two separate articles. This example fills the left side of the paged view with content from article1 and the right side with content from article2. New pages and slots are created until the content from both articles is exhausted. If one article is longer than the other then in this simple example template the longer article will continue taking up just its half of the page.
145199
<pre>
200+
body { overflow-style:paged-x; }
146201
#article1 { flow-into: article1; }
147202
#article2 { flow-into: article2; }
148-
@page {
149-
positioned-slots: left, right;
203+
@template {
204+
template-slots: left, right;
150205
::slot (left) {
151206
flow-from: article1;
152207
width: 40%;
@@ -157,7 +212,7 @@ <h2 id="templates-and-slots">
157212
flow-from: article2;
158213
width: 40%;
159214
padding: 5%
160-
float: left;
215+
float: right;
161216
}
162217
}
163218
&lt;body&gt;
@@ -168,12 +223,13 @@ <h2 id="templates-and-slots">
168223
</div>
169224

170225
<div class='example'>
171-
<p>The example above could position the slots using grid layout rather than floats.
226+
<p>The example above could position the slots using grid layout rather than floats. In this simple example the longer article will take up the entire page once the shorter article is exhausted.
172227
<pre>
228+
body { overflow-style:paged-x; }
173229
#article1 { flow-into: article1; }
174230
#article2 { flow-into: article2; }
175-
@page {
176-
positioned-slots: left, right;
231+
@template {
232+
template-slots: left, right;
177233
display:grid;
178234
grid-columns: 1fr 1fr;
179235
::slot (left) {
@@ -194,28 +250,47 @@ <h2 id="templates-and-slots">
194250
</pre>
195251
</div>
196252

197-
<p class="issue">Add an example of side-by-side article pagination using multicol slots, using more columns for each side of the page with more viewport width. If the articles were different lengths, once the shorter article was exhausted then remaining pages would fill with columns from the longer article.
253+
<div class='example'>
254+
<p>This version of the side-by-side example uses multicol slots, using more columns for each side of the page with more viewport width. If the articles were different lengths, once the shorter article was exhausted then remaining pages would fill with columns from the longer article.
255+
<pre>
256+
body { overflow-style:paged-x; }
257+
#article1 { flow-into: article1; }
258+
#article2 { flow-into: article2; }
259+
@template {
260+
template-slots: left, right;
261+
::slot (left) {
262+
flow-from: article1;
263+
padding: 5%;
264+
column-width: 20em;
265+
}
266+
::slot (right) {
267+
flow-from: article2;
268+
padding: 5%
269+
column-width: 20em;
270+
}
271+
}
272+
&lt;body&gt;
273+
&lt;article id='article1'&gt;...content...&lt;/article&gt;
274+
&lt;article id='article2'&gt;...content...&lt;/article&gt;
275+
&lt;/body&gt;
276+
</pre>
277+
</div>
198278

199279
<p class="issue">Add an example using media queries to choose between portrait and landscape templates.
200280

201-
<h2 id="conditional-templates">
202-
Conditional Template Selection</h2>
203-
204-
<p>Multiple templates can be defined for a single document. Each page view created uses a single template. This template can be chosen using a selector, or by matching available content using the 'required-flow' property.
205-
206281
<h3 id='ordered-templates'>
207282
Selecting Templates by Page Order</h3>
208283

209-
<p>Selectors such as :first can be used on a page template to define a separate template for pages that match the selector.
284+
<p>Selectors such as :first can be used on a paginated template to define a separate template for pages that match the selector.
210285

211-
<p class="issue">Should we allow :left and :right for viewing more than one page at a time in a viewport? Should we have :nth(x) selectors?
286+
<p class="issue">Should we use :left and :right and allow viewing more than one page at a time in a viewport? Should we have :nth(x) selectors?
212287

213288
<div class='example'>
214-
<p>Any of the side-by-side two-article examples from the previous section could have an @page :first {} template that defined a fancy layout for the first page slots
289+
<p>Any of the side-by-side two-article examples from the previous section could have an @template :first {} rule that defined a fancy layout for the first page slots
215290
<p class="issue">define "fancy."
216291
<pre>
217-
@page :first {
218-
positioned-slots: first-left, first-right;
292+
@template :first {
293+
template-slots: first-left, first-right;
219294
::slot (first-left) {
220295
//fancy styling
221296
flow-from: article1;
@@ -231,13 +306,14 @@ <h3 id='ordered-templates'>
231306
<h3 id='selection-from-available-content'>
232307
Selecting Templates from Available Content</h3>
233308

234-
<p>The 'required-flow' property can be used in a page template to list named flows that must have available content in order for the template to be used. If more than one template has a 'required-flow' value that matches the available content, the first template that matches will be used.
309+
<p>The 'required-flow' property can be used in a paginated template to list named flows that must have available content in order for the template to be used. If more than one template has a 'required-flow' value that matches the available content, the first template that matches will be used.
235310

236311
<div class='example'>
237-
<p>Using the same two-article markup as in previous examples, these page templates will display an inital page with the beginning of both articles. If article1 has more content than will fit on that first page, the next pages will show only content from the first article. When the content from the first article is consumed, then pages will follow with content from the second article.
312+
<p>"Continued on" layout.
313+
<p>Using the same two-article markup as in previous examples, these paginated templates will display an inital page with the beginning of both articles. If article1 has more content than will fit on that first page, the next pages will show only content from the first article. When the content from the first article is consumed, then pages will follow with content from the second article.
238314
<pre>
239-
@page :first {
240-
positioned-slots: left, right;
315+
@template :first {
316+
template-slots: left, right;
241317
::slot (left) {
242318
flow-from: article1;
243319
width: 40%;
@@ -251,26 +327,26 @@ <h3 id='selection-from-available-content'>
251327
float: left;
252328
}
253329
}
254-
@page {
255-
positioned-slots: first;
330+
@template {
331+
template-slots: first;
256332
required-flow: article1;
257333
::slot(first) {
258334
flow-from: article1;
259-
column-width: 12em;
335+
column-width: 20em;
260336
}
261337
}
262-
@page {
263-
positioned-slots: second;
338+
@template {
339+
template-slots: second;
264340
required-flow: article2;
265341
::slot(second) {
266342
flow-from: article2;
267-
column-width: 12em;
343+
column-width: 20em;
268344
}
269345
}
270346
</pre>
271347
</div>
272348

273-
<p class="issue">IDPF has a more complex notion of 'available' content. For example, consider a content source that contains a single article with images scattered throughout. Assign the images to a flow named 'images' and the rest of the article to a flow named 'text'. Then define two page templates - one that has slots only for the text flow, and another that has slots for both the text and images flows. Each time a page is laid out, the original article is scanned to see whether an image element would have shown up on the page. If so, then that content from the 'images' flow is available for the purpose of selecting a template.
349+
<p class="issue">IDPF has a more complex notion of 'available' content. For example, consider a content source that contains a single article with images scattered throughout. Assign the images to a flow named 'images' and the rest of the article to a flow named 'text'. Then define two paginated templates - one that has slots only for the text flow, and another that has slots for both the text and images flows. Each time a page is laid out, the original article is scanned to see whether an image element would have shown up on the page. If so, then that content from the 'images' flow is available for the purpose of selecting a template.
274350

275351
<div class='example'>
276352
<p>Assume you have an article that contains both pull quotes and images. If only images <em>or</em> pull quotes would occur on a page, position those elements in the center right of the template. But if both images <em>and</em> pull quotes would appear, position the images in the top left and the pull quotes in the bottom right.
@@ -280,12 +356,12 @@ <h3 id='selection-from-available-content'>
280356
<h2 id="page-template-navigation">
281357
Navigating Pages</h2>
282358

283-
<p class="issue">Should this specification define navigation? We could adopt the Paged Presentations properties from GCPM.
359+
<p class="issue">Should this specification define navigation? We could just refer to css3-gcpm.
284360

285361
<h2 id="cssom">
286362
CSS Object Model Modifications</h2>
287363

288-
<p class='issue'>There should be extensive OM defined to access pages and slots. Lots to fill out here.
364+
<p class='issue'>There should be extensive OM defined to access pages and slots. Templates, pages and slots should be able to accept event handlers. Anchors should navigate to the appropriate page. What content fits in each slot and page should be accessible. Lots to fill out here.
289365

290366
<h2 id="conformance">
291367
Conformance</h2>

0 commit comments

Comments
 (0)