@@ -182,16 +182,12 @@ <h2 class="no-num no-toc" id=contents> Table of contents</h2>
182182 < ul class =toc >
183183 < li > < a href ="#glyph-counters "> < span class =secno > 8.1. </ span > Glyphs</ a >
184184
185- < li > < a href ="#complex-counters "> < span class =secno > 8.2. </ span > Complex
186- counter styles</ a >
187- < ul class =toc >
188- < li > < a href ="#ethiopic-numeric "> < span class =secno > 8.2.1. </ span > The
189- ‘< code class =property > ethiopic-numeric</ code > ’ counter
190- style</ a >
185+ < li > < a href ="#ethiopic-numeric "> < span class =secno > 8.2. </ span > The
186+ ‘< code class =property > ethiopic-numeric</ code > ’ counter
187+ style </ a >
191188
192- < li > < a href ="#cjk-counter-styles "> < span class =secno > 8.2.2. </ span > The
193- Chinese longhand counter styles</ a >
194- </ ul >
189+ < li > < a href ="#cjk-counter-styles "> < span class =secno > 8.3. </ span > The
190+ Chinese longhand counter styles </ a >
195191 </ ul >
196192
197193 < li > < a href ="#counter-style "> < span class =secno > 9. </ span > Defining Custom
@@ -993,14 +989,15 @@ <h3 id=content-property><span class=secno>6.1. </span> Generating the
993989 href ="#list-style-type "> < code
994990 class =property > list-style-type</ code > </ a > ’ is the name of a counter
995991 style, then the computed value of the ‘< code
996- class =property > content</ code > ’ property is ‘< code
997- class =css > counter(list-item, < a
998- href ="#ltcounter-style "> < i > <counter-style> </ i > </ a > )</ code > ’,
999- where < a href ="#ltcounter-style "> < i > <counter-style> </ i > </ a > is the
992+ class =property > content</ code > ’ property is
993+ < code > <counter-prefix> counter(list-item, <counter-name> )
994+ <counter-suffix> </ code > , where < i > <counter-name> </ i > is the
1000995 computed value of the ‘< a href ="#list-style-type "> < code
1001- class =property > list-style-type</ code > </ a > ’ property, followed by a
1002- string that is the suffix for the counter style in question (which may be
1003- empty). < span class =issue > Fix this.</ span >
996+ class =property > list-style-type</ code > </ a > ’ property and
997+ < i > <counter-prefix> </ i > and < i > <counter-suffix> </ i > are the values
998+ of the < a href ="#prefix "> < i title =counter-prefix > prefix</ i > </ a > and < a
999+ href ="#suffix "> < i title =counter-suffix > suffix</ i > </ a > descriptors for the
1000+ counter style with that name.
10041001
10051002 < li > Otherwise the computed value is ‘< a href ="#none "> < code
10061003 class =css > none</ code > </ a > ’.
@@ -1089,6 +1086,14 @@ <h2 id=predefined-counters><span class=secno>8. </span> Predefined Counter
10891086 require special handling beyond what can be expressed in a stylesheet,
10901087 though. Those counter styles are described in this section.
10911088
1089+ < p > The counter styles specified in this section have custom < a
1090+ href ="#algorithm "> < i title =counter-algorithm > algorithms for generating
1091+ counter values</ i > </ a > , but are otherwise identical to a counter style
1092+ defined via the ‘< code class =css > @counter-style</ code > ’ rule,
1093+ described below. For example, an author can reference one of these styles
1094+ in an ‘< code class =property > override</ code > ’ type, reusing the
1095+ algorithm but swapping out some of the other descriptors.
1096+
10921097 < h3 id =glyph-counters > < span class =secno > 8.1. </ span > Glyphs</ h3 >
10931098
10941099 < p > CSS 2.1 defined three single-glyph counter styles (‘< code
@@ -1123,23 +1128,8 @@ <h3 id=glyph-counters><span class=secno>8.1. </span> Glyphs</h3>
11231128 < dd > A filled square, similar to ■ U+25A0 BLACK SQUARE.
11241129 </ dl >
11251130
1126- < h3 id =complex-counters > < span class =secno > 8.2. </ span > Complex counter
1127- styles</ h3 >
1128-
1129- < p > Nearly all counter styles can be described using the small set of
1130- algorithms described by the ‘< a href ="#type "> < code
1131- class =property > type</ code > </ a > ’ descriptor. A small handful, though,
1132- require more complex handling which is too specialized to warrant crafting
1133- a generalized algorithm to use in ‘< a href ="#type "> < code
1134- class =property > type</ code > </ a > ’. Instead, their algorithms are
1135- described here. Just like a counter style defined with the @counter-style
1136- rule, these counter styles can be overridden by creating another
1137- @counter-style rule with the same name, or can be used in the ‘< code
1138- class =property > override</ code > ’ type to alter their descriptors
1139- while keeping the algorithms described here.
1140-
1141- < h4 id =ethiopic-numeric > < span class =secno > 8.2.1. </ span > The ‘< code
1142- class =property > ethiopic-numeric</ code > ’ counter style</ h4 >
1131+ < h3 id =ethiopic-numeric > < span class =secno > 8.2. </ span > The ‘< code
1132+ class =property > ethiopic-numeric</ code > ’ counter style</ h3 >
11431133
11441134 < p > The Ethiopian numbering system is defined for all positive non-zero
11451135 numbers. The following algorithm converts decimal digits to ethiopic
@@ -1328,8 +1318,8 @@ <h4 id=ethiopic-numeric><span class=secno>8.2.1. </span> The ‘<code
13281318 U+137B <!-- odd --> U+137A U+136A. <!-- 90 2 --> </ p >
13291319 </ div >
13301320
1331- < h4 id =cjk-counter-styles > < span class =secno > 8.2.2 . </ span > The Chinese
1332- longhand counter styles</ h4 >
1321+ < h3 id =cjk-counter-styles > < span class =secno > 8.3 . </ span > The Chinese
1322+ longhand counter styles</ h3 >
13331323
13341324 < p > Chinese, Japanese, and Korean have longhand counter styles, which have a
13351325 structure similar to "one hundred thirteen thousand and twenty-three" in
@@ -1383,9 +1373,6 @@ <h4 id=cjk-counter-styles><span class=secno>8.2.2. </span> The Chinese
13831373 < li > If the counter value is 0, the representation is the character for 0
13841374 specified for the given counter style. Skip the rest of this algorithm.
13851375
1386- < li > If the counter value is negative, run the rest of this algorithm with
1387- the absolute value of the counter value instead.
1388-
13891376 < li > Initially represent the counter value as a decimal number. For each
13901377 digit that is not 0, append the appropriate digit marker to the digit.
13911378 The ones digit has no marker.
@@ -1396,12 +1383,6 @@ <h4 id=cjk-counter-styles><span class=secno>8.2.2. </span> The Chinese
13961383 < li > Drop any trailing zeros and collapse any remaining zeros into a single
13971384 zero digit.
13981385
1399- < li > For the Korean styles, insert a space (" " U+0020) between each group.
1400-
1401- < li > If the < var > negative flag</ var > was set to true earlier in the
1402- algorithm, prepend the appropriate negative sign for the given counter
1403- style to the string.
1404-
14051386 < li > Replace the digits 0-9 with the appropriate character for the given
14061387 counter style. Return the resultant string as the representation of the
14071388 counter value.
@@ -1412,8 +1393,10 @@ <h4 id=cjk-counter-styles><span class=secno>8.2.2. </span> The Chinese
14121393 href ="#fallback-style "> < i title =counter-fallback > fallback
14131394 descriptor</ i > </ a > is ‘< code class =css > cjk-decimal</ code > ’,
14141395 the < i title =counter-lower-range > lower range bound descriptor</ i > is
1415- -9999, and the < i title =counter-upper-range > upper range bound
1416- descriptor</ i > is 9999.
1396+ -9999, the < i title =counter-upper-range > upper range bound descriptor</ i >
1397+ is 9999, and the < a href ="#negative-sign "> < i
1398+ title =counter-negative > negative sign</ i > </ a > is given in the table of
1399+ glyphs for each style.
14171400
14181401 < p > The following tables define the characters used in these styles:
14191402
@@ -1809,7 +1792,37 @@ <h2 id=counter-style><span class=secno>9. </span> Defining Custom Counter
18091792 href ="#glyphs "> < code class =css > glyphs</ code > </ a > ’, and ‘< a
18101793 href ="#additive-glyphs "> < code class =css > additive-glyphs</ code > </ a > ’
18111794 properties, but some counter styles instead have their algorithm
1812- explicitly defined.
1795+ explicitly defined in the < a href ="#predefined-counters "> Predefined
1796+ Counter Styles</ a > section.
1797+
1798+ < p > When asked to < i title =generate-a-counter > generate a counter
1799+ representation</ i > using a particular counter style for a particular
1800+ counter value, follow these steps:
1801+
1802+ < ol >
1803+ < li > If the counter value is less than the < a href ="#lower-range-bound "> < i
1804+ title =counter-lower-bound > lower bound</ i > </ a > or greater than the < a
1805+ href ="#upper "> < i title =counter-upper-bound > upper bound</ i > </ a > of the
1806+ counter style, exit this algorithm and instead < i
1807+ title =generate-a-counter > generate a counter representation</ i > using the
1808+ counter style's fallback style and the same counter value.
1809+
1810+ < li > If the counter value is negative, set the < a
1811+ href ="#negative "> < var > negative</ var > </ a > flag and run the rest of this
1812+ algorithm with the counter value set to its absolute value instead.
1813+
1814+ < li > Using the counter value and the < a href ="#algorithm "> < i
1815+ title =counter-algorithm > counter algorithm</ i > </ a > for the counter style,
1816+ generate an initial representation for the counter value.
1817+
1818+ < li > If the < a href ="#negative "> < var > negative</ var > </ a > flag is set, wrap
1819+ the initial representation in the counter style's < a
1820+ href ="#negative-sign "> < i title =counter-negative > negative sign</ i > </ a > , as
1821+ specified in the section for the < a
1822+ href ="#counter-style-negative "> negative descriptor</ a > .
1823+
1824+ < li > Return the representation.
1825+ </ ol >
18131826
18141827 < p > The general form of an ‘< code
18151828 class =css > @counter-style</ code > ’ rule is:
@@ -1949,10 +1962,6 @@ <h4 id=numeric><span class=secno>9.1.2. </span> numeric</h4>
19491962 < li > If < var > I</ var > is 0, append < var > glyph(0)</ var > to < var > S</ var > and
19501963 return < var > S</ var > .
19511964
1952- < li > If < var > I</ var > is negative, set < a
1953- href ="#negative "> < var > negative</ var > </ a > to true and < var > I</ var > to its
1954- absolute value.
1955-
19561965 < li > While < var > I</ var > is not equal to 0:
19571966 < ol >
19581967 < li > Prepend < var > glyph( < var > I</ var > mod < var > N</ var > )</ var > to
@@ -1962,10 +1971,6 @@ <h4 id=numeric><span class=secno>9.1.2. </span> numeric</h4>
19621971 )</ code > .
19631972 </ ol >
19641973
1965- < li > If < a href ="#negative "> < var > negative</ var > </ a > is true, alter
1966- < var > S</ var > according to the counter style's defined < a
1967- href ="#negative-sign "> < i title =counter-negative > negative sign</ i > </ a > .
1968-
19691974 < li > Return < var > S</ var > .
19701975 </ ol >
19711976
@@ -3915,21 +3920,21 @@ <h2 class=no-num id=index>Index</h2>
39153920 < li > range, < a href ="#range " title =range > < strong > 9.5.</ strong > </ a >
39163921
39173922 < li > simp-chinese-formal, < a href ="#simp-chinese-formal "
3918- title =simp-chinese-formal > < strong > 8.2.2 .</ strong > </ a >
3923+ title =simp-chinese-formal > < strong > 8.3 .</ strong > </ a >
39193924
39203925 < li > simp-chinese-informal, < a href ="#simp-chinese-informal "
3921- title =simp-chinese-informal > < strong > 8.2.2 .</ strong > </ a >
3926+ title =simp-chinese-informal > < strong > 8.3 .</ strong > </ a >
39223927
39233928 < li > <string> , < a href ="#ltstring "
39243929 title ="<string> "> < strong > 3.</ strong > </ a >
39253930
39263931 < li > suffix, < a href ="#suffix0 " title =suffix > < strong > 9.4.</ strong > </ a >
39273932
39283933 < li > trad-chinese-formal, < a href ="#trad-chinese-formal "
3929- title =trad-chinese-formal > < strong > 8.2.2 .</ strong > </ a >
3934+ title =trad-chinese-formal > < strong > 8.3 .</ strong > </ a >
39303935
39313936 < li > trad-chinese-informal, < a href ="#trad-chinese-informal "
3932- title =trad-chinese-informal > < strong > 8.2.2 .</ strong > </ a >
3937+ title =trad-chinese-informal > < strong > 8.3 .</ strong > </ a >
39333938
39343939 < li > type, < a href ="#type " title =type > < strong > 9.1.</ strong > </ a >
39353940 </ ul >
0 commit comments