- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 19 May 2011 20:34:56 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css3-lists In directory hutz:/tmp/cvs-serv28348 Modified Files: Overview.html Overview.src.html Log Message: Rearranged/reworded several things related to generating a representation of a counter value, to make them refer to a central algorithm and make the custom styles properly hook into the set of descriptors. Index: Overview.html =================================================================== RCS file: /sources/public/csswg/css3-lists/Overview.html,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- Overview.html 19 May 2011 18:16:13 -0000 1.42 +++ Overview.html 19 May 2011 20:34:54 -0000 1.43 @@ -182,16 +182,12 @@ <ul class=toc> <li><a href="#glyph-counters"><span class=secno>8.1. </span> Glyphs</a> - <li><a href="#complex-counters"><span class=secno>8.2. </span> Complex - counter styles</a> - <ul class=toc> - <li><a href="#ethiopic-numeric"><span class=secno>8.2.1. </span> The - ‘<code class=property>ethiopic-numeric</code>’ counter - style</a> + <li><a href="#ethiopic-numeric"><span class=secno>8.2. </span> The + ‘<code class=property>ethiopic-numeric</code>’ counter + style </a> - <li><a href="#cjk-counter-styles"><span class=secno>8.2.2. </span> The - Chinese longhand counter styles</a> - </ul> + <li><a href="#cjk-counter-styles"><span class=secno>8.3. </span> The + Chinese longhand counter styles </a> </ul> <li><a href="#counter-style"><span class=secno>9. </span> Defining Custom @@ -993,14 +989,15 @@ href="#list-style-type"><code class=property>list-style-type</code></a>’ is the name of a counter style, then the computed value of the ‘<code - class=property>content</code>’ property is ‘<code - class=css>counter(list-item, <a - href="#ltcounter-style"><i><counter-style></i></a>)</code>’, - where <a href="#ltcounter-style"><i><counter-style></i></a> is the + class=property>content</code>’ property is + <code><counter-prefix> counter(list-item, <counter-name>) + <counter-suffix></code>, where <i><counter-name></i> is the computed value of the ‘<a href="#list-style-type"><code - class=property>list-style-type</code></a>’ property, followed by a - string that is the suffix for the counter style in question (which may be - empty). <span class=issue>Fix this.</span> + class=property>list-style-type</code></a>’ property and + <i><counter-prefix></i> and <i><counter-suffix></i> are the values + of the <a href="#prefix"><i title=counter-prefix>prefix</i></a> and <a + href="#suffix"><i title=counter-suffix>suffix</i></a> descriptors for the + counter style with that name. <li>Otherwise the computed value is ‘<a href="#none"><code class=css>none</code></a>’. @@ -1089,6 +1086,14 @@ require special handling beyond what can be expressed in a stylesheet, though. Those counter styles are described in this section. + <p>The counter styles specified in this section have custom <a + href="#algorithm"><i title=counter-algorithm>algorithms for generating + counter values</i></a>, but are otherwise identical to a counter style + defined via the ‘<code class=css>@counter-style</code>’ rule, + described below. For example, an author can reference one of these styles + in an ‘<code class=property>override</code>’ type, reusing the + algorithm but swapping out some of the other descriptors. + <h3 id=glyph-counters><span class=secno>8.1. </span> Glyphs</h3> <p>CSS 2.1 defined three single-glyph counter styles (‘<code @@ -1123,23 +1128,8 @@ <dd>A filled square, similar to ■ U+25A0 BLACK SQUARE. </dl> - <h3 id=complex-counters><span class=secno>8.2. </span> Complex counter - styles</h3> - - <p>Nearly all counter styles can be described using the small set of - algorithms described by the ‘<a href="#type"><code - class=property>type</code></a>’ descriptor. A small handful, though, - require more complex handling which is too specialized to warrant crafting - a generalized algorithm to use in ‘<a href="#type"><code - class=property>type</code></a>’. Instead, their algorithms are - described here. Just like a counter style defined with the @counter-style - rule, these counter styles can be overridden by creating another - @counter-style rule with the same name, or can be used in the ‘<code - class=property>override</code>’ type to alter their descriptors - while keeping the algorithms described here. - - <h4 id=ethiopic-numeric><span class=secno>8.2.1. </span> The ‘<code - class=property>ethiopic-numeric</code>’ counter style</h4> + <h3 id=ethiopic-numeric><span class=secno>8.2. </span> The ‘<code + class=property>ethiopic-numeric</code>’ counter style</h3> <p>The Ethiopian numbering system is defined for all positive non-zero numbers. The following algorithm converts decimal digits to ethiopic @@ -1328,8 +1318,8 @@ U+137B <!-- odd --> U+137A U+136A. <!-- 90 2 --></p> </div> - <h4 id=cjk-counter-styles><span class=secno>8.2.2. </span> The Chinese - longhand counter styles</h4> + <h3 id=cjk-counter-styles><span class=secno>8.3. </span> The Chinese + longhand counter styles</h3> <p>Chinese, Japanese, and Korean have longhand counter styles, which have a structure similar to "one hundred thirteen thousand and twenty-three" in @@ -1383,9 +1373,6 @@ <li>If the counter value is 0, the representation is the character for 0 specified for the given counter style. Skip the rest of this algorithm. - <li>If the counter value is negative, run the rest of this algorithm with - the absolute value of the counter value instead. - <li>Initially represent the counter value as a decimal number. For each digit that is not 0, append the appropriate digit marker to the digit. The ones digit has no marker. @@ -1396,12 +1383,6 @@ <li>Drop any trailing zeros and collapse any remaining zeros into a single zero digit. - <li>For the Korean styles, insert a space (" " U+0020) between each group. - - <li>If the <var>negative flag</var> was set to true earlier in the - algorithm, prepend the appropriate negative sign for the given counter - style to the string. - <li>Replace the digits 0-9 with the appropriate character for the given counter style. Return the resultant string as the representation of the counter value. @@ -1412,8 +1393,10 @@ href="#fallback-style"><i title=counter-fallback>fallback descriptor</i></a> is ‘<code class=css>cjk-decimal</code>’, the <i title=counter-lower-range>lower range bound descriptor</i> is - -9999, and the <i title=counter-upper-range>upper range bound - descriptor</i> is 9999. + -9999, the <i title=counter-upper-range>upper range bound descriptor</i> + is 9999, and the <a href="#negative-sign"><i + title=counter-negative>negative sign</i></a> is given in the table of + glyphs for each style. <p>The following tables define the characters used in these styles: @@ -1809,7 +1792,37 @@ href="#glyphs"><code class=css>glyphs</code></a>’, and ‘<a href="#additive-glyphs"><code class=css>additive-glyphs</code></a>’ properties, but some counter styles instead have their algorithm - explicitly defined. + explicitly defined in the <a href="#predefined-counters">Predefined + Counter Styles</a> section. + + <p>When asked to <i title=generate-a-counter>generate a counter + representation</i> using a particular counter style for a particular + counter value, follow these steps: + + <ol> + <li>If the counter value is less than the <a href="#lower-range-bound"><i + title=counter-lower-bound>lower bound</i></a> or greater than the <a + href="#upper"><i title=counter-upper-bound>upper bound</i></a> of the + counter style, exit this algorithm and instead <i + title=generate-a-counter>generate a counter representation</i> using the + counter style's fallback style and the same counter value. + + <li>If the counter value is negative, set the <a + href="#negative"><var>negative</var></a> flag and run the rest of this + algorithm with the counter value set to its absolute value instead. + + <li>Using the counter value and the <a href="#algorithm"><i + title=counter-algorithm>counter algorithm</i></a> for the counter style, + generate an initial representation for the counter value. + + <li>If the <a href="#negative"><var>negative</var></a> flag is set, wrap + the initial representation in the counter style's <a + href="#negative-sign"><i title=counter-negative>negative sign</i></a>, as + specified in the section for the <a + href="#counter-style-negative">negative descriptor</a>. + + <li>Return the representation. + </ol> <p>The general form of an ‘<code class=css>@counter-style</code>’ rule is: @@ -1949,10 +1962,6 @@ <li>If <var>I</var> is 0, append <var>glyph(0)</var> to <var>S</var> and return <var>S</var>. - <li>If <var>I</var> is negative, set <a - href="#negative"><var>negative</var></a> to true and <var>I</var> to its - absolute value. - <li>While <var>I</var> is not equal to 0: <ol> <li>Prepend <var>glyph( <var>I</var> mod <var>N</var> )</var> to @@ -1962,10 +1971,6 @@ )</code>. </ol> - <li>If <a href="#negative"><var>negative</var></a> is true, alter - <var>S</var> according to the counter style's defined <a - href="#negative-sign"><i title=counter-negative>negative sign</i></a>. - <li>Return <var>S</var>. </ol> @@ -3915,10 +3920,10 @@ <li>range, <a href="#range" title=range><strong>9.5.</strong></a> <li>simp-chinese-formal, <a href="#simp-chinese-formal" - title=simp-chinese-formal><strong>8.2.2.</strong></a> + title=simp-chinese-formal><strong>8.3.</strong></a> <li>simp-chinese-informal, <a href="#simp-chinese-informal" - title=simp-chinese-informal><strong>8.2.2.</strong></a> + title=simp-chinese-informal><strong>8.3.</strong></a> <li><string>, <a href="#ltstring" title="<string>"><strong>3.</strong></a> @@ -3926,10 +3931,10 @@ <li>suffix, <a href="#suffix0" title=suffix><strong>9.4.</strong></a> <li>trad-chinese-formal, <a href="#trad-chinese-formal" - title=trad-chinese-formal><strong>8.2.2.</strong></a> + title=trad-chinese-formal><strong>8.3.</strong></a> <li>trad-chinese-informal, <a href="#trad-chinese-informal" - title=trad-chinese-informal><strong>8.2.2.</strong></a> + title=trad-chinese-informal><strong>8.3.</strong></a> <li>type, <a href="#type" title=type><strong>9.1.</strong></a> </ul> Index: Overview.src.html =================================================================== RCS file: /sources/public/csswg/css3-lists/Overview.src.html,v retrieving revision 1.84 retrieving revision 1.85 diff -u -d -r1.84 -r1.85 --- Overview.src.html 19 May 2011 19:10:17 -0000 1.84 +++ Overview.src.html 19 May 2011 20:34:54 -0000 1.85 @@ -653,10 +653,11 @@ <li>Otherwise, if the computed value of 'list-style-type' is the name of a counter style, then the computed value of the 'content' property - is ''counter(list-item, <i><counter-style></i>)'', where - <i><counter-style></i> is the computed value of the 'list-style-type' - property, followed by a string that is the suffix for the counter style - in question (which may be empty). <span class=issue>Fix this.</span></li> + is <code><counter-prefix> counter(list-item, <counter-name>) <counter-suffix></code>, + where <i><counter-name></i> is the computed value of the 'list-style-type' + property and <i><counter-prefix></i> and <i><counter-suffix></i> are + the values of the <i title='counter-prefix'>prefix</i> and <i title='counter-suffix'>suffix</i> + descriptors for the counter style with that name.</li> <li>Otherwise the computed value is ''none''.</li> </ol> @@ -725,7 +726,13 @@ contains a required UA stylesheet which defines a large number of counter styles using the ''@counter-style'' rule. A few styles require special handling beyond what can be expressed in a stylesheet, though. Those counter styles are described - in this section. + in this section.</p> + + <p>The counter styles specified in this section have custom + <i title='counter-algorithm'>algorithms for generating counter values</i>, but are + otherwise identical to a counter style defined via the ''@counter-style'' rule, + described below. For example, an author can reference one of these styles in an + 'override' type, reusing the algorithm but swapping out some of the other descriptors.</p> <h3 id='glyph-counters'> @@ -760,19 +767,7 @@ -<h3 id='complex-counters'> -Complex counter styles</h3> - - <p>Nearly all counter styles can be described using the small set of algorithms - described by the 'type' descriptor. A small handful, though, require more complex - handling which is too specialized to warrant crafting a generalized algorithm to - use in 'type'. Instead, their algorithms are described here. Just like a counter style - defined with the @counter-style rule, these counter styles can be overridden by - creating another @counter-style rule with the same name, or can be used in the - 'override' type to alter their descriptors while keeping the algorithms described here.</p> - - -<h4 id='ethiopic-numeric'> +<h3 id='ethiopic-numeric'> The 'ethiopic-numeric' counter style</h4> <p>The Ethiopian numbering system is defined for all positive non-zero numbers. @@ -902,7 +897,7 @@ U+136A. <!-- 90 2 --></p> </div> -<h4 id='cjk-counter-styles'> +<h3 id='cjk-counter-styles'> The Chinese longhand counter styles</h4> <p>Chinese, Japanese, and Korean have longhand counter styles, which have @@ -949,9 +944,6 @@ <li>If the counter value is 0, the representation is the character for 0 specified for the given counter style. Skip the rest of this algorithm.</li> - <li>If the counter value is negative, run the rest of this algorithm - with the absolute value of the counter value instead.</li> - <li>Initially represent the counter value as a decimal number. For each digit that is not 0, append the appropriate digit marker to the digit. The ones digit has no marker.</li> @@ -962,10 +954,6 @@ <li>Drop any trailing zeros and collapse any remaining zeros into a single zero digit.</li> - <li>If the <var>negative flag</var> was set to true earlier in the - algorithm, prepend the appropriate negative sign for the given counter - style to the string.</li> - <li>Replace the digits 0-9 with the appropriate character for the given counter style. Return the resultant string as the representation of the counter value.</li> @@ -974,8 +962,9 @@ <p>For all of these counter styles, the <i title='counter-suffix'>suffix descriptor</i> is "、" U+3001, the <i title='counter-fallback'>fallback descriptor</i> is ''cjk-decimal'', the <i title='counter-lower-range'>lower range bound descriptor</i> - is -9999, and the <i title='counter-upper-range'>upper range bound descriptor</i> - is 9999.</p> + is -9999, the <i title='counter-upper-range'>upper range bound descriptor</i> + is 9999, and the <i title='counter-negative'>negative sign</i> is given in the table + of glyphs for each style.</p> <p>The following tables define the characters used in these styles:</p> @@ -1250,7 +1239,30 @@ <p>The algorithm is usually specified implicitly by a combination of the ''type'', ''glyphs'', and ''additive-glyphs'' properties, but some counter styles - instead have their algorithm explicitly defined.</p> + instead have their algorithm explicitly defined in the + <a href='#predefined-counters'>Predefined Counter Styles</a> section.</p> + + <p>When asked to <i title='generate-a-counter'>generate a counter representation</i> + using a particular counter style for a particular counter value, follow these steps:</p> + + <ol> + <li>If the counter value is less than the <i title='counter-lower-bound'>lower bound</i> + or greater than the <i title='counter-upper-bound'>upper bound</i> of the counter + style, exit this algorithm and instead <i title='generate-a-counter'>generate a counter representation</i> + using the counter style's fallback style and the same counter value.</li> + + <li>If the counter value is negative, set the <var>negative</var> flag and + run the rest of this algorithm with the counter value set to its absolute value instead.</li> + + <li>Using the counter value and the <i title='counter-algorithm'>counter algorithm</i> + for the counter style, generate an initial representation for the counter value.</li> + + <li>If the <var>negative</var> flag is set, wrap the initial representation in the + counter style's <i title='counter-negative'>negative sign</i>, as specified in + the section for the <a href='#counter-style-negative'>negative descriptor</a>.</li> + + <li>Return the representation.</li> + </ol> <p>The general form of an ''@counter-style'' rule is:</p> @@ -1370,9 +1382,6 @@ <li>If <var>I</var> is 0, append <var>glyph(0)</var> to <var>S</var> and return <var>S</var>.</li> - <li>If <var>I</var> is negative, set <var>negative</var> to - true and <var>I</var> to its absolute value.</li> - <li>While <var>I</var> is not equal to 0: <ol> @@ -1383,9 +1392,6 @@ </ol> </li> - <li>If <var>negative</var> is true, alter <var>S</var> according to the - counter style's defined <i title='counter-negative'>negative sign</i>.</li> - <li>Return <var>S</var>.</li> </ol>
Received on Thursday, 19 May 2011 20:34:58 UTC