Skip to content

Commit 4ae9f29

Browse files
committed
[css-counter-styles-3] Add a 'width' descriptor to @counter-style.
1 parent 27e39ac commit 4ae9f29

2 files changed

Lines changed: 165 additions & 101 deletions

File tree

css-counter-styles-3/Overview.html

Lines changed: 107 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010

1111
<meta content="CSS Counter Styles Level 3" name=dcterms.title>
1212
<meta content=text name=dcterms.type>
13-
<meta content=2013-02-11 name=dcterms.issued>
13+
<meta content=2013-02-19 name=dcterms.issued>
1414
<meta content="http://dev.w3.org/csswg/css-counter-styles-3/"
1515
name=dcterms.creator>
1616
<meta content=W3C name=dcterms.publisher>
17-
<meta content="http://www.w3.org/TR/2013/ED-css-counter-styles-3-20130211/"
17+
<meta content="http://dev.w3.org/csswg/css-counter-styles-3/"
1818
name=dcterms.identifier>
1919
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
2020
<link href="../default.css" rel=stylesheet type="text/css">
@@ -32,13 +32,13 @@
3232

3333
<h1>CSS Counter Styles Level 3</h1>
3434

35-
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 11 February
35+
<h2 class="no-num no-toc" id=longstatus-date>Editor's Draft 19 February
3636
2013</h2>
3737

3838
<dl>
3939
<dt>This version:
4040

41-
<dd><!--<a href="http://www.w3.org/TR/2013/ED-css-counter-styles-3-20130211/">http://www.w3.org/TR/2013/WD-css-counter-styles-3-20130211/</a>-->
41+
<dd><!--<a href="http://www.w3.org/TR/2013/ED-css-counter-styles-3-20130219/">http://www.w3.org/TR/2013/WD-css-counter-styles-3-20130219/</a>-->
4242
<a
4343
href="http://dev.w3.org/csswg/css-counter-styles-3/">http://dev.w3.org/csswg/css-counter-styles-3/</a>
4444

@@ -229,15 +229,19 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
229229
Limiting the counter scope: the ‘<code class=property>range</code>
230230
descriptor</a>
231231

232-
<li><a href="#counter-style-fallback"><span class=secno>3.6. </span>
232+
<li><a href="#counter-style-width"><span class=secno>3.6. </span>
233+
Constant-width Representations: the ‘<code
234+
class=property>width</code>’ descriptor</a>
235+
236+
<li><a href="#counter-style-fallback"><span class=secno>3.7. </span>
233237
Defining fallback: the ‘<code class=property>fallback</code>
234238
descriptor</a>
235239

236-
<li><a href="#counter-style-symbols"><span class=secno>3.7. </span>
240+
<li><a href="#counter-style-symbols"><span class=secno>3.8. </span>
237241
Marker characters: the ‘<code class=property>symbols</code>’ and
238242
<code class=property>additive-symbols</code>’ descriptors</a>
239243

240-
<li><a href="#counter-style-speak-as"><span class=secno>3.8. </span>
244+
<li><a href="#counter-style-speak-as"><span class=secno>3.9. </span>
241245
Speech Synthesis: the ‘<code class=property>speak-as</code>
242246
descriptor</a>
243247
</ul>
@@ -789,41 +793,6 @@ <h4 id=alphabetic-system><span class=secno>3.1.4. </span> Bijective
789793
correctly.
790794
</div>
791795

792-
<div class=example>
793-
<p>Alphabetic styles may also be used to simulate a fixed-width numeric
794-
style:
795-
796-
<pre>
797-
@counter-style <dfn id=fixed-decimal>fixed-decimal</dfn> {
798-
system: alphabetic;
799-
symbols: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9';
800-
}
801-
802-
ol {
803-
list-style: fixed-decimal;
804-
counter-reset: list-item 1111;
805-
}
806-
</pre>
807-
808-
<p>This will produce lists that look like:
809-
810-
<pre>
811-
0001. One
812-
0002. Two
813-
0003. Three
814-
0004. Four
815-
0005. Five
816-
0006. Six
817-
</pre>
818-
819-
<p>Two-digit numbers start at value 11, three-digit numbers start at value
820-
111, etc..
821-
822-
<p class=issue>Should I instead explicitly provide a fixed-width numeric
823-
counter system? I'd like to see if this sort of numbering is used in the
824-
wild first.
825-
</div>
826-
827796
<p> If there are <var>N</var> <i>counter symbols</i>, the representation is
828797
a base <var>N</var> alphabetic number using the <i>counter symbols</i> as
829798
digits. To construct the representation, run the following algorithm:
@@ -1207,7 +1176,67 @@ <h3 id=counter-style-range><span class=secno>3.5. </span> Limiting the
12071176
limits. Should we require UAs to support all values in a signed 2-byte
12081177
int, or a signed 4-byte int?
12091178

1210-
<h3 id=counter-style-fallback><span class=secno>3.6. </span> Defining
1179+
<h3 id=counter-style-width><span class=secno>3.6. </span> Constant-width
1180+
Representations: the ‘<a href="#descdef-width"><code
1181+
class=property>width</code></a>’ descriptor</h3>
1182+
1183+
<table class=descdef>
1184+
<tbody>
1185+
<tr>
1186+
<th>Name:
1187+
1188+
<td><dfn id=descdef-width>width</dfn>
1189+
1190+
<tr>
1191+
<th>Value:
1192+
1193+
<td><var>&lt;integer></var> &amp;&amp; <a
1194+
href="#ltsymbol"><var>&lt;symbol></var></a>
1195+
1196+
<tr>
1197+
<th>Initial:
1198+
1199+
<td>0 ""
1200+
</table>
1201+
1202+
<p> The ‘<a href="#descdef-width"><code
1203+
class=property>width</code></a>’ descriptor allows an author to specify
1204+
a "fixed-width" counter style, where representations shorter than the
1205+
width are padded with a particular character.
1206+
1207+
<dl>
1208+
<dt>auto
1209+
1210+
<dd> This descriptor has no effect on counter representations.
1211+
1212+
<dt><var>&lt;integer></var> &amp;&amp; <a
1213+
href="#ltsymbol"><var>&lt;symbol></var></a>
1214+
1215+
<dd> The <var>&lt;integer></var> specifies a minimum width that all
1216+
counter representations must reach. If a counter representation would be
1217+
generated using less <a href="#ltsymbol"><var>&lt;symbol></var></a>s than
1218+
the specified <var>&lt;integer></var> (before adding
1219+
prefixes/suffixes/negatives), pad the front of the representation with
1220+
copies of the specified <a href="#ltsymbol"><var>&lt;symbol></var></a>
1221+
until the number of symbols reaches the specified width.
1222+
<p> If the counter value is negative, reduce the width by one or two,
1223+
depending on whether the second <var>&lt;string></var> value is omitted
1224+
or provided, respectively, in the ‘<a href="#descdef-negative"><code
1225+
class=property>negative</code></a>’ descriptor for the given counter
1226+
style.
1227+
</dl>
1228+
1229+
<div class=example> The most common example of "fixed-width" numbering is
1230+
zero-padded decimal numbering. If an author knows that the numbers used
1231+
will be less than a thousand, for example, it can be zero-padded with a
1232+
simple ‘<code class=css>width: 3 "0";</code>’ descriptor, ensuring
1233+
that all of the representations are 3 digits wide.
1234+
<p> This will cause, for example, 1 to be represented as "001", 20 to be
1235+
represented as "020", 300 to be represented as "300", and -4 to be
1236+
represented as "-04".
1237+
</div>
1238+
1239+
<h3 id=counter-style-fallback><span class=secno>3.7. </span> Defining
12111240
fallback: the ‘<a href="#descdef-fallback"><code
12121241
class=property>fallback</code></a>’ descriptor</h3>
12131242

@@ -1260,7 +1289,7 @@ <h3 id=counter-style-fallback><span class=secno>3.6. </span> Defining
12601289
significantly easier for implementations to just detect and reject
12611290
circular fallback graphs, that would probably be acceptable.
12621291

1263-
<h3 id=counter-style-symbols><span class=secno>3.7. </span> Marker
1292+
<h3 id=counter-style-symbols><span class=secno>3.8. </span> Marker
12641293
characters: the ‘<a href="#descdef-symbols"><code
12651294
class=property>symbols</code></a>’ and ‘<a
12661295
href="#descdef-additive-symbols"><code
@@ -1276,7 +1305,7 @@ <h3 id=counter-style-symbols><span class=secno>3.7. </span> Marker
12761305
<tr>
12771306
<th>Value:
12781307

1279-
<td>[ &lt;string> | &lt;image> | &lt;identifier> ]+
1308+
<td><a href="#ltsymbol"><var>&lt;symbol></var></a>+
12801309

12811310
<tr>
12821311
<th>Initial:
@@ -1294,14 +1323,18 @@ <h3 id=counter-style-symbols><span class=secno>3.7. </span> Marker
12941323
<tr>
12951324
<th>Value:
12961325

1297-
<td>[ &lt;integer> && [ &lt;string> | &lt;image> | &lt;identifier> ] ]#
1326+
<td>[ <var>&lt;integer></var> &amp;&amp; <a
1327+
href="#ltsymbol"><var>&lt;symbol></var></a> ]#
12981328

12991329
<tr>
13001330
<th>Initial:
13011331

13021332
<td>N/A
13031333
</table>
13041334

1335+
<pre class=prod><dfn
1336+
id=ltsymbol>&lt;symbol></dfn> = &lt;string> | &lt;image> | &lt;identifier></pre>
1337+
13051338
<p>The ‘<a href="#descdef-symbols"><code
13061339
class=property>symbols</code></a>’ and ‘<a
13071340
href="#descdef-additive-symbols"><code
@@ -1360,7 +1393,7 @@ <h3 id=counter-style-symbols><span class=secno>3.7. </span> Marker
13601393
separate it from the following one, or else they'll be considered
13611394
adjacent, and part of the same identifier.
13621395

1363-
<h3 id=counter-style-speak-as><span class=secno>3.8. </span> Speech
1396+
<h3 id=counter-style-speak-as><span class=secno>3.9. </span> Speech
13641397
Synthesis: the ‘<a href="#descdef-speak-as"><code
13651398
class=property>speak-as</code></a>’ descriptor</h3>
13661399

@@ -3636,7 +3669,7 @@ <h2 class=no-num id=descriptor-index>Descriptor index</h2>
36363669
<th><a class=property
36373670
href="#descdef-additive-symbols">additive-symbols</a>
36383671

3639-
<td>[ &lt;integer> && [ &lt;string> | &lt;image> | &lt;identifier> ] ]#
3672+
<td>[ &lt;integer> &amp;&amp; &lt;symbol> ]#
36403673

36413674
<td>N/A
36423675

@@ -3685,7 +3718,7 @@ <h2 class=no-num id=descriptor-index>Descriptor index</h2>
36853718
<tr>
36863719
<th><a class=property href="#descdef-symbols">symbols</a>
36873720

3688-
<td>[ &lt;string> | &lt;image> | &lt;identifier> ]+
3721+
<td>&lt;symbol>+
36893722

36903723
<td>N/A
36913724

@@ -3696,6 +3729,13 @@ <h2 class=no-num id=descriptor-index>Descriptor index</h2>
36963729
&lt;integer>?] | [ override &lt;counter-style-name> ]
36973730

36983731
<td>symbolic
3732+
3733+
<tr>
3734+
<th><a class=property href="#descdef-width">width</a>
3735+
3736+
<td>&lt;integer> &amp;&amp; &lt;symbol>
3737+
3738+
<td>0 ""
36993739
</table>
37003740
<!--end-descriptors-->
37013741

@@ -3707,16 +3747,16 @@ <h2 class=no-num id=index>Index</h2>
37073747
href="#additive" title="section 3.1.6."><strong>3.1.6.</strong></a>
37083748

37093749
<li>additive-symbols, <a href="#descdef-additive-symbols"
3710-
title="section 3.7."><strong>3.7.</strong></a>
3750+
title="section 3.8."><strong>3.8.</strong></a>
37113751

37123752
<li>additive tuple, <a href="#additive-tuple"
3713-
title="section 3.7."><strong>3.7.</strong></a>
3753+
title="section 3.8."><strong>3.8.</strong></a>
37143754

37153755
<li><a href="#speak-as-alphabetic"><code
37163756
class=css>alphabetic</code></a>’, <a href="#alphabetic"
37173757
title="section 3.1.4."><strong>3.1.4.</strong></a>, <a
37183758
href="#speak-as-alphabetic"
3719-
title="section 3.8."><strong>3.8.</strong></a>
3759+
title="section 3.9."><strong>3.9.</strong></a>
37203760

37213761
<li><a href="#armenian"><code class=css>armenian</code></a>’, <a
37223762
href="#armenian" title="section 5.1."><strong>5.1.</strong></a>
@@ -3725,20 +3765,20 @@ <h2 class=no-num id=index>Index</h2>
37253765
title="section ??"><strong>??</strong></a>
37263766

37273767
<li><a href="#speak-as-auto"><code class=css>auto</code></a>’, <a
3728-
href="#speak-as-auto" title="section 3.8."><strong>3.8.</strong></a>
3768+
href="#speak-as-auto" title="section 3.9."><strong>3.9.</strong></a>
37293769

37303770
<li>box-corner, <a href="#box-corner"
37313771
title="section 3.1.2."><strong>3.1.2.</strong></a>
37323772

37333773
<li><a href="#speak-as-symbolic"><code class=css>bullet</code></a>’,
37343774
<a href="#speak-as-symbolic"
3735-
title="section 3.8."><strong>3.8.</strong></a>
3775+
title="section 3.9."><strong>3.9.</strong></a>
37363776

37373777
<li><a href="#circle"><code class=css>circle</code></a>’, <a
37383778
href="#circle" title="section 5.3."><strong>5.3.</strong></a>
37393779

37403780
<li>circled-lower-latin, <a href="#circled-lower-latin"
3741-
title="section 3.8."><strong>3.8.</strong></a>
3781+
title="section 3.9."><strong>3.9.</strong></a>
37423782

37433783
<li><a href="#cjk-decimal"><code class=css>cjk-decimal</code></a>’,
37443784
<a href="#cjk-decimal" title="section 5.1."><strong>5.1.</strong></a>
@@ -3774,13 +3814,13 @@ <h2 class=no-num id=index>Index</h2>
37743814
<li><a
37753815
href="#speak-as-counter-style"><var>&lt;counter-style-name></var></a>, <a
37763816
href="#speak-as-counter-style"
3777-
title="section 3.8."><strong>3.8.</strong></a>
3817+
title="section 3.9."><strong>3.9.</strong></a>
37783818

37793819
<li>counter-suffix, <a href="#suffix"
37803820
title="section 2."><strong>2.</strong></a>
37813821

37823822
<li>counter symbol, <a href="#counter-symbol"
3783-
title="section 3.7."><strong>3.7.</strong></a>
3823+
title="section 3.8."><strong>3.8.</strong></a>
37843824

37853825
<li>CSSCounterStyleRule, <a href="#csscounterstylerule"
37863826
title="section 7.2."><strong>7.2.</strong></a>
@@ -3820,17 +3860,14 @@ <h2 class=no-num id=index>Index</h2>
38203860
title="section 6.2."><strong>6.2.</strong></a>
38213861

38223862
<li>fallback, <a href="#descdef-fallback"
3823-
title="section 3.6."><strong>3.6.</strong></a>
3863+
title="section 3.7."><strong>3.7.</strong></a>
38243864

38253865
<li>first symbol value, <a href="#first-symbol-value"
38263866
title="section 3.1.2."><strong>3.1.2.</strong></a>
38273867

38283868
<li><a href="#fixed"><code class=css>fixed</code></a>’, <a
38293869
href="#fixed" title="section 3.1.2."><strong>3.1.2.</strong></a>
38303870

3831-
<li>fixed-decimal, <a href="#fixed-decimal"
3832-
title="section 3.1.4."><strong>3.1.4.</strong></a>
3833-
38343871
<li>footnote, <a href="#footnote"
38353872
title="section 3.1.3."><strong>3.1.3.</strong></a>
38363873

@@ -3903,7 +3940,7 @@ <h2 class=no-num id=index>Index</h2>
39033940

39043941
<li><a href="#speak-as-numeric"><code class=css>numeric</code></a>’,
39053942
<a href="#numeric" title="section 3.1.5."><strong>3.1.5.</strong></a>, <a
3906-
href="#speak-as-numeric" title="section 3.8."><strong>3.8.</strong></a>
3943+
href="#speak-as-numeric" title="section 3.9."><strong>3.9.</strong></a>
39073944

39083945
<li><a href="#override"><code class=css>override</code></a>’, <a
39093946
href="#override" title="section 3.1.7."><strong>3.1.7.</strong></a>
@@ -3928,7 +3965,7 @@ <h2 class=no-num id=index>Index</h2>
39283965
title="section 6.1.2."><strong>6.1.2.</strong></a>
39293966

39303967
<li>speak-as, <a href="#descdef-speak-as"
3931-
title="section 3.8."><strong>3.8.</strong></a>
3968+
title="section 3.9."><strong>3.9.</strong></a>
39323969

39333970
<li><a href="#square"><code class=css>square</code></a>’, <a
39343971
href="#square" title="section 5.3."><strong>5.3.</strong></a>
@@ -3942,11 +3979,14 @@ <h2 class=no-num id=index>Index</h2>
39423979
<li>suffix, <a href="#descdef-suffix"
39433980
title="section 3.4."><strong>3.4.</strong></a>
39443981

3982+
<li>&lt;symbol>, <a href="#ltsymbol"
3983+
title="section 3.8."><strong>3.8.</strong></a>
3984+
39453985
<li><a href="#symbolic"><code class=css>symbolic</code></a>’, <a
39463986
href="#symbolic" title="section 3.1.3."><strong>3.1.3.</strong></a>
39473987

39483988
<li>symbols, <a href="#descdef-symbols"
3949-
title="section 3.7."><strong>3.7.</strong></a>
3989+
title="section 3.8."><strong>3.8.</strong></a>
39503990

39513991
<li>&lt;symbols-function>, <a href="#type-symbols-function"
39523992
title="section 4."><strong>4.</strong></a>
@@ -3981,6 +4021,9 @@ <h2 class=no-num id=index>Index</h2>
39814021

39824022
<li><a href="#upper-roman"><code class=css>upper-roman</code></a>’,
39834023
<a href="#upper-roman" title="section 5.1."><strong>5.1.</strong></a>
4024+
4025+
<li>width, <a href="#descdef-width"
4026+
title="section 3.6."><strong>3.6.</strong></a>
39844027
</ul>
39854028
<!--end-index-->
39864029
<!--

0 commit comments

Comments
 (0)