8000 csswg-drafts/css-page-template/Overview.html at 0ddbd6a0e8ffcddddb839fa914f11cca7a971146 · w3c/csswg-drafts · GitHub
Skip to content 8000

Latest commit

 

History

History
867 lines (725 loc) · 33 KB

File metadata and controls

867 lines (725 loc) · 33 KB
block. Attempting to define template rejection rather than selection
might also prove fruitful.</div>
</div>
<div class=example>
<p>In this example the divs are paginated using the last template found
from the set of templates that apply to the div. The first div uses
template three, the second div uses template two, and the third div uses
template one.
<pre>
div { overflow-style: paged-x; }
.either-one-or-two { template-set: one two; }
.only-one { template-set: one; }
@template one { ... }
@template two { ... }
@template three { ... }
&lt;div class='any-template'&gt; ... &lt;/div&gt;
&lt;div class='either-one-or-two'&gt; ... &lt;/div&gt;
&lt;div class='only-one'&gt; ... &lt;/div&gt;
</pre>
</div>
<h3 id=ordered-templates><span class=secno>3.1. </span>Selecting Templates
by Page Order</h3>
<p>Selectors such as :first can be used on a pagination template to define
a separate template for pages that match the selector.
<div class="issue-marker wrapper">
<div class=issue-marker>
<div class=issue-details>Should :left and :right be allowed with a way of
displaying more than one page at a time in a viewport? Should :nth(x)
selectors be allowed?</div>
</div>
<div class=issue-marker>
<div class=issue-details>Describe how @template rules cascade with names
and selectors (or how they do not cascade, if that's preferable).</div>
</div>
</div>
<div class=example>
<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.
<pre>
@template side-by-side:first {
@slot left {
//fancy styling
flow-from: article1;
}
@slot right {
//fancy styling
flow-from: article2;
}
}
</pre>
</div>
<div class="issue-marker wrapper">
<div class=issue-marker>
<div class=issue-details>define "fancy."</div>
</div>
<div class=issue-marker>
<div class=issue-details>Depending on how template selection is defined,
there will likely be scenarios where degenerate template sets can either
fail to display all of the content or result in an infinite loop of page
generation. This first draft falls into the latter category (make a
:first template with a slot that overflows, but fail to include an
assignment for that slot's content in all other templates), so this will
need to be addressed with more selection rules.</div>
</div>
</div>
<h3 id=selection-from-required-flows><span class=secno>3.2.
</span>Selecting Templates from Required Flows</h3>
<p>The ‘<code class=property>required-flow</code>’ property can be used
in a pagination template to list named flows that must still have content
in order for the template to be used. If more than one template has a
‘<code class=property>required-flow</code>’ value that matches the
remaining flow content, the last template that matches will be used.
<div class=example>
<p>"Continued on" layout.
<p>These pagination templates will display an initial page with the
beginning of both the ‘<code class=property>lead-story</code>’ flow
and a ‘<code class=property>related-article</code>’ flow. If the lead
story has more content than will fit on that first page, the next page(s)
will show only content from that lead story. When the content from the
lead story is exhausted, then pages will follow with content from the
related article.
<p> <img alt="side-by-side flows on a page"
src="images/side-by-side-1.png" width=120> <img
alt="columns continuing just the first flow"
src="images/first-article-columns.png" width=120> <span
style="font-size:50px">…</span> <img
alt="columns ending the first flow" src="images/first-article-end.png"
width=120> <img alt="columns continuing the second flow"
src="images/second-article-columns.png" width=120> <span
style="font-size:50px">…</span>
<pre>
body { overflow-style: paged-x; }
.lead-story { flow-into: lead-flow; }
.related-article { flow-into: related-flow; }
@template related {
required-flow: related-flow;
@slot content {
flow-from: related-flow;
column-width: 20em;
}
}
@template lead {
required-flow: lead-flow;
@slot content {
flow-from: lead-flow;
column-width: 20em;
}
}
@template continued-on:first {
@slot lead {
flow-from: lead-flow;
width: 40%;
height: 90%;
padding: 5%;
float: left;
}
@slot related {
flow-from: related-flow;
width: 40%;
height: 90%;
padding: 5%
float: left;
}
}
&lt;body&gt;
&lt;article class='lead-story'&gt;...content...&lt;/article&gt;
&lt;article class='related-article'&gt;...content...&lt;/article&gt;
&lt;/body&gt;
</pre>
</div>
<h3 id=selection-from-available-content><span class=secno>3.3.
</span>Selecting Templates from Available Content</h3>
<p>Pagination templates can be selected based on the order of content in
the DOM tree. Content may be split out into one or more named flows, but
the original order can be discovered in the DOM and used for template
selection.
<p>Pagination templates have a ‘<code class=property>primary</code>’
content flow. The primary flow for a pagination template is usually the
content of the paginated element. If no slot in the template displays the
element contents, then the primary flow of the pagination template is the
first named flow in its required-flow declaration.
<p>When selecting the pagination template for the next page, the primary
flow in the original markup can be scanned to determine whether any
out-of-flow content in other named flows was originally related to the
next page of primary flow. If this is the case, then those named flows
have ‘<code class=property>available</code>’ content for the purpose
of selecting an appropriate template that can display this content.
<p>Pagination templates can have an ‘<code
class=property>available-content</code>’ declaration listing the named
flows that must have available content for the template to be selected.
Templates with more ‘<code class=property>available-content</code>’
flow matches take precedence over fewer or no ‘<code
class=property>available-content</code>’ flow matches. If a template
with an ‘<code class=property>available-content</code>’ declaration is
chosen, only the available content in those flows is displayed in the
slots associated with those flows.
<div class=example>
<p>Clarification example (not meant to be a valid use case)
<p>Consider an article element that contains images scattered throughout.
Assign the images to a flow named ‘<code
class=property>images</code>’ and the rest of the article to a flow
named ‘<code class=property>text</code>’. Then define two pagination
templates - one that has slots only for the ‘<code
class=property>text</code>’ flow, and another that has slots for both
the ‘<code class=property>text</code>’ and ‘<code
class=property>images</code>’ flows. Both templates require the
‘<code class=property>text</code>’ flow, but the second template also
requires the ‘<code class=property>images</code>’ flow and has an
‘<code class=property>available-content</code>’ declaration listing
the ‘<code class=property>images</code>’ flow. Each time a page is
laid out, the original article element is scanned to see whether an image
element is in the next page's worth of content (determined by some
DOM-tree-scanning heuristic – not layout). If so, then that content
from the ‘<code class=property>images</code>’ flow is available for
the purpose of selecting a template.
</div>
<div class=example>
<p>Motivational example (meant as a use case)
<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.
<div class=issue-marker>
<div class=issue-details>code this example</div>
</div>
</div>
<h2 id=cssom><span class=secno>4. </span>CSS Object Model</h2>
<div class=issue-marker>
<div class=issue-details>There should be extensive OM defined to access
pages and slots. What page is being displayed should be available. Pages
and slots should accept event handlers. Anchors should navigate to the
appropriate page (as should search). What content fits in each slot and
page should be determinable. Lots to fill out here.</div>
</div>
<div class=example>
<p>Motivational example
<p>Given the side-by-side paginated template for French and English, allow
the user to click and drag the French text from the right to the left to
switch sides for both flows.
</div>
<h2 id=conformance><span class=secno>5. </span>Conformance</h2>
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
<p>The editor is grateful to the CSS working group for their feedback and
help with the genesis of this specification.
<p>In addition, the editor would like to thank the following individuals
for their contributions, either during the conception of CSS Pagination
Templates or during its development and specification review process:
<ul>
<li>Rossen Atanassov
<li>Tab Atkins
<li>Razvan Caliman
<li>Alexandru Chiculita
<li>Sylvain Galineau
<li>Vincent Hardy
<li>David Hyatt
<li>Brad Kemper
<li>Håkon Wium Lie
<li>Alex Mogilevsky
<li>Christoph Päper
<li>Peter Sorotokin
<li>Stephen Zilles
</ul>
<h2 class=no-num id=references>References</h2>
<h3 class=no-num id=normative-references>Normative references</h3>
<!--begin-normative-->
<!-- Sorted by label -->
<dl class=bibliography><!---->
</dl>
<!--end-normative-->
<h3 class=no-num id=other-references>Other references</h3>
<!--begin-informative-->
<!-- Sorted by label -->
<dl class=bibliography><!---->
<dt id=CSS3-REGIONS>[CSS3-REGIONS]
<dd>Vincent Hardy; Rossen Atanassov; Alan Stearns. <a
href="http://www.w3.org/TR/2013/WD-css3-regions-20130528/"><cite>CSS
Regions Module Level 1.</cite></a> 28 May 2013. W3C Working Draft. (Work
in progress.) URL: <a
href="http://www.w3.org/TR/2013/WD-css3-regions-20130528/">http://www.w3.org/TR/2013/WD-css3-regions-20130528/</a>
</dd>
<!---->
<dt id=CSS3GCPM>[CSS3GCPM]
<dd>Håkon Wium Lie. <a
href="http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/"><cite>CSS
Generated Content for Paged Media Module.</cite></a> 29 November 2011.
W3C Working Draft. (Work in progress.) URL: <a
href="http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/">http://www.w3.org/TR/2011/WD-css3-gcpm-20111129/</a>
</dd>
<!---->
<dt id=CSS3GRID>[CSS3GRID]
<dd>Alex Mogilevsky; Markus Mielke. <a
href="http://www.w3.org/TR/2007/WD-css3-grid-20070905"><cite>CSS Grid
Positioning Module Level 3.</cite></a> 5 September 2007. W3C Working
Draft. (Work in progress.) URL: <a
href="http://www.w3.org/TR/2007/WD-css3-grid-20070905">http://www.w3.org/TR/2007/WD-css3-grid-20070905</a>
</dd>
<!---->
</dl>
<!--end-informative-->
<h2 class=no-num id=index>Index</h2>
<!--begin-index-->
<ul class=indexlist></ul>
<!--end-index-->
<!-- template markup for issues pulled from Bugzilla -->
<!--
<script type="text/template" id="issue-template">
<div class="issue-marker" style="display:none" data-bug_id="{{bug_id}}" data-bug_status="{{bug_status}}">
<a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id={{bug_id}}">Bug-{{bug_id}}</a>
<div class="issue-details">
<p class="short-desc">{{short_desc}}</p>
</div>
</div>
</script>
<script type="text/javascript" src="../shared/scripts/BugzillaTrackerUtil.js"></script>
<script type="text/javascript" src="../shared/scripts/BugzillaTracker.js"></script>
<script type="text/javascript">
checkSpecificationIssues('CSS', 'Page Template');
</script>
<div id="issue-manager">
<h2>Issue manager</h2>
<form action="#">
<label>
<input type="radio" name="issue-filter" value="all" checked/>
All issues
</label>
<label>
<input type="radio" name="issue-filter" value="updated" />
Updated issues
</label>
<label>
<input type="radio" name="issue-filter" value="new" />
New issues
</label>
</form>
-->
<!-- all the bugs are dumped the #issue-list after being retreived and matched to the ones in the page -->
<!--
<div id="issue-list">
</div>
</div>
-->
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-declaration:"~/SGML/HTML4.decl"
sgml-default-doctype-name:"html"
sgml-minimize-attributes:t
sgml-nofill-elements:("pre" "style" "br")
sgml-live-element-indicator:t
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:t
sgml-general-insert-case:lower
sgml-always-quote-attributes:t
sgml-indent-step:nil
sgml-indent-data:t
sgml-parent-document:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->