From 908673a3fa226438a2b11f1a1779f8edaf3f8145 Mon Sep 17 00:00:00 2001
From: saku
Date: Sun, 22 Jun 2025 13:24:23 +0900
Subject: [PATCH 01/14] restore old spec
---
css-counter-styles-3/Overview.bs | 365 ++++++++++++++++++++++++++++++-
1 file changed, 358 insertions(+), 7 deletions(-)
diff --git a/css-counter-styles-3/Overview.bs b/css-counter-styles-3/Overview.bs
index 2f54f50dbfc..a9ab9c1b15d 100644
--- a/css-counter-styles-3/Overview.bs
+++ b/css-counter-styles-3/Overview.bs
@@ -2056,8 +2056,9 @@ Longhand East Asian Counter Styles
████████ ████ ██ ██ ████ ██ ████████ ████████ ██████ ██████ ██ ██
-->
-
-Japanese: ''japanese-informal'' and ''japanese-formal''
+Limited-range Implementation (required)
+
+Japanese: ''japanese-informal'' and ''japanese-formal''
- japanese-informal
@@ -2098,8 +2099,8 @@ Japanese: ''japanese-informal'' and ''japanese-formal''
-
-Korean: ''korean-hangul-formal'', ''korean-hanja-informal'', and ''korean-hanja-formal''
+
+Korean: ''korean-hangul-formal'', ''korean-hanja-informal'', and ''korean-hanja-formal''
- korean-hangul-formal
@@ -2154,8 +2155,8 @@ Korean: ''korean-hangul-formal'', ''korean-hanja-informal'', and ''korean-hanja-
-
-Chinese: ''simp-chinese-informal'', ''simp-chinese-formal'', ''trad-chinese-informal'', and ''trad-chinese-formal''
+
+Chinese: ''simp-chinese-informal'', ''simp-chinese-formal'', ''trad-chinese-informal'', and ''trad-chinese-formal''
- simp-chinese-informal
@@ -2184,7 +2185,7 @@ Chinese: ''simp-chinese-informal'', ''simp-chinese-formal'', ''trad-chinese-info
(It exists for legacy reasons.)
- The Chinese longhand styles are defined by almost identical algorithms
+ The Chinese longhand styles are defined by almost identical algorithms
(specified as a single algorithm here, with the differences called out when relevant),
but use different sets of characters,
as specified by the table following the algorithm.
@@ -2361,6 +2362,356 @@ Chinese: ''simp-chinese-informal'', ''simp-chinese-formal'', ''trad-chinese-info
+Extended Implementation (optional)
+
+ Some counter styles described in earlier chapters have been limited to an artifically small (though still useful) range to reduce the overall complexity of the spec and the task of implementing those styles. However, some implementations might consider the extra complexity worthwhile for the additional range it offers to authors. To accomodate this, this section describes how to extend the limited counter-styles to a larger range.
+
+ This entire section is normative, but optional. User-agents may ignore it and still be conformant. If a user-agent implements some of the extended forms described in this section, they must be implemented as described here.
+
+ The Chinese longhand styles are defined out to 10k with a [=Chinese|specialized algorithm=], while the Japanese and Korean longhand styles are defined similarly as ''additive'' styles. However, these styles are defined out to 1016 in common usage. The following section describes an alternative algorithm for these styles.
+
+ The Chinese and Japanese styles are defined for all numbers between -1016 and 1016, exclusive; the Korean styles are defined for all non-negative numbers less than 1016. For numbers outside this range, the ''cjk-decimal'' style is used. All of the styles are defined by almost identical algorithms (specified as a single algorithm here, with the differences called out when relevant), but use different sets of characters. The list following the algorithm gives the name of each counter style using this algorithm, and the individual character sets used by each style.
+
+
+ - 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.
+
+
- Initially represent the counter value as a decimal number. Starting
+ from the right (ones place), split the decimal number into groups of
+ four digits.
+
+
- For each group with a non-zero value, append the appropriate group
+ marker to the group. The ones group has no marker.
+
+
- Within each group, for each digit that is not 0, append the appropriate
+ digit marker to the digit. The ones digit of each group has no marker.
+
+
- Drop ones:
+
+ - For the Chinese informal styles, for any group with a value
+ between ten and nineteen, remove the tens digit (leave the digit
+ marker).
+
+
- For the Japanese informal and Korean informal styles, if any
+ of the digit markers are preceded by the digit 1, and that digit
+ is not the first digit of the group, remove the digit (leave the
+ digit marker).
+
+
- For Korean informal styles, if the value of the ten-thousands
+ group is 1, drop the digit (leave the digit marker).
+
+
+
+ - Drop zeros:
+
+ - For the Japanese and Korean styles, drop all zero digits.
+
+
- For the Chinese styles, drop any trailing zeros for all
+ non-zero groups and collapse (across groups) each remaining
+ consecutive group of zeros into a single zero digit.
+
+
+ - For the Korean styles, insert a space (" " U+0020) between each group.
+
+
- 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.
+
+
+ For all of these counter styles, the '@counter-style/suffix' is "、" U+3001, the '@counter-style/fallback' is ''cjk-decimal'', and the '@counter-style/negative' is given in the tables below, or else is the initial value of the descriptor. For Chinese and Japanese, the '@counter-style/range' is ''-9999999999999999 9999999999999999'' (-1016+1 and 1016-1), while for Korean it's ''0 9999999999999999'' (again, 1016-1).
+
+ The following tables define the characters used in these styles:
+
+
+
+ | Values
+ | Codepoints
+ |
+ | simp-chinese-informal
+ | simp-chinese-formal
+ | trad-chinese-informal
+ | trad-chinese-formal
+ |
+
+
+ | Digit 0
+ | 零 U+96F6
+ | 零 U+96F6
+ | 零 U+96F6
+ | 零 U+96F6
+ |
+ | Digit 1
+ | 一 U+4E00
+ | 壹 U+58F9
+ | 一 U+4E00
+ | 壹 U+58F9
+ |
+ | Digit 2
+ | 二 U+4E8C
+ | 贰 U+8D30
+ | 二 U+4E8C
+ | 貳 U+8CB3
+ |
+ | Digit 3
+ | 三 U+4E09
+ | 叁 U+53C1
+ | 三 U+4E09
+ | 參 U+53C3
+ |
+ | Digit 4
+ | 四 U+56DB
+ | 肆 U+8086
+ | 四 U+56DB
+ | 肆 U+8086
+ |
+ | Digit 5
+ | 五 U+4E94
+ | 伍 U+4F0D
+ | 五 U+4E94
+ | 伍 U+4F0D
+ |
+ | Digit 6
+ | 六 U+516D
+ | 陆 U+9646
+ | 六 U+516D
+ | 陸 U+9678
+ |
+ | Digit 7
+ | 七 U+4E03
+ | 柒 U+67D2
+ | 七 U+4E03
+ | 柒 U+67D2
+ |
+ | Digit 8
+ | 八 U+516B
+ | 捌 U+634C
+ | 八 U+516B
+ | 捌 U+634C
+ |
+ | Digit 9
+ | 九 U+4E5D
+ | 玖 U+7396
+ | 九 U+4E5D
+ | 玖 U+7396
+ |
+ | Second Digit Marker
+ | 十 U+5341
+ | 拾 U+62FE
+ | 十 U+5341
+ | 拾 U+62FE
+ |
+ | Third Digit Marker
+ | 百 U+767E
+ | 佰 U+4F70
+ | 百 U+767E
+ | 佰 U+4F70
+ |
+ | Fourth Digit Marker
+ | 千 U+5343
+ | 仟 U+4EDF
+ | 千 U+5343
+ | 仟 U+4EDF
+ |
+ | Second Group Marker
+ | 万 U+4E07
+ | 万 U+4E07
+ | 萬 U+842C
+ | 萬 U+842C
+ |
+ | Third Group Marker
+ | 亿 U+4EBF
+ | 亿 U+4EBF
+ | 億 U+5104
+ | 億 U+5104
+ |
+ | Fourth Group Marker
+ | 万亿 U+4E07 U+4EBF
+ | 万亿 U+4E07 U+4EBF
+ | 兆 U+5146
+ | 兆 U+5146
+ |
+ | Negative Sign
+ | 负 U+8D1F
+ | 负 U+8D1F
+ | 負 U+8CA0
+ | 負 U+8CA0
+ |
+
+
+
+
+
+ | Values
+ | Codepoints
+ |
+ | japanese-informal
+ | japanese-formal
+ |
+
+
+ | Digit 0
+ | 〇 U+3007
+ | 零 U+96F6
+ |
+ | Digit 1
+ | 一 U+4E00
+ | 壱 U+58F1
+ |
+ | Digit 2
+ | 二 U+4E8C
+ | 弐 U+5F10
+ |
+ | Digit 3
+ | 三 U+4E09
+ | 参 U+53C2
+ |
+ | Digit 4
+ | 四 U+56DB
+ | 四 U+56DB
+ |
+ | Digit 5
+ | 五 U+4E94
+ | 伍 U+4f0D
+ |
+ | Digit 6
+ | 六 U+516D
+ | 六 U+516D
+ |
+ | Digit 7
+ | 七 U+4E03
+ | 七 U+4E03
+ |
+ | Digit 8
+ | 八 U+516B
+ | 八 U+516B
+ |
+ | Digit 9
+ | 九 U+4E5D
+ | 九 U+4E5D
+ |
+ | Second Digit Marker
+ | 十 U+5341
+ | 拾 U+62FE
+ |
+ | Third Digit Marker
+ | 百 U+767E
+ | 百 U+767E
+ |
+ | Fourth Digit Marker
+ | 千 U+5343
+ | 阡 U+9621
+ |
+ | Second Group Marker
+ | 万 U+4E07
+ | 萬 U+842C
+ |
+ | Third Group Marker
+ | 億 U+5104
+ | 億 U+5104
+ |
+ | Fourth Group Marker
+ | 兆 U+5146
+ | 兆 U+5146
+ |
+ | Negative Sign
+ | マイナス U+30DE U+30A4 U+30CA U+30B9
+ |
+
+
+
+
+
+ | Values
+ | Codepoints
+ |
+ | korean-hangul-formal
+ | korean-hanja-informal
+ | korean-hanja-formal
+ |
+
+
+ | Digit 0
+ | 영 U+C601
+ | 零 U+96F6
+ | 零 U+96F6
+ |
+ | Digit 1
+ | 일 U+C77C
+ | 一 U+4E00
+ | 壹 U+58F9
+ |
+ | Digit 2
+ | 이 U+C774
+ | 二 U+4E8C
+ | 貳 U+8CB3
+ |
+ | Digit 3
+ | 삼 U+C0BC
+ | 三 U+4E09
+ | 參 U+53C3
+ |
+ | Digit 4
+ | 사 U+C0AC
+ | 四 U+56DB
+ | 四 U+56DB
+ |
+ | Digit 5
+ | 오 U+C624
+ | 五 U+4E94
+ | 五 U+4E94
+ |
+ | Digit 6
+ | 육 U+C721
+ | 六 U+516D
+ | 六 U+516D
+ |
+ | Digit 7
+ | 칠 U+CE60
+ | 七 U+4E03
+ | 七 U+4E03
+ |
+ | Digit 8
+ | 팔 U+D314
+ | 八 U+516B
+ | 八 U+516B
+ |
+ | Digit 9
+ | 구 U+AD6C
+ | 九 U+4E5D
+ | 九 U+4E5D
+ |
+ | Second Digit Marker
+ | 십 U+C2ED
+ | 十 U+5341
+ | 拾 U+62FE
+ |
+ | Third Digit Marker
+ | 백 U+BC31
+ | 百 U+767E
+ | 百 U+767E
+ |
+ | Fourth Digit Marker
+ | 천 U+CC9C
+ | 千 U+5343
+ | 仟 U+4EDF
+ |
+ | Second Group Marker
+ | 만 U+B9CC
+ | 萬 U+842C
+ | 萬 U+842C
+ |
+ | Third Group Marker
+ | 억 U+C5B5
+ | 億 U+5104
+ | 億 U+5104
+ |
+ | Fourth Group Marker
+ | 조 U+C870
+ | 兆 U+5146
+ | 兆 U+5146
+ |
+
+