前幾天在w3c的網站閒逛的時候,無意間看到
CSS3-lists的Working Draft,發現中文數字已經被加入list-style-type裡面了(真是太好了,我已經等好久了),但不幸的是,我也在裡面看到許多的bug,在這裡簡單跟大家報告一下
CJK世界裡面常用的計數系統,有大,小寫數字,天干,地支,數字系統比較複雜,除了數字當中夾雜著單位量詞(130460 -> 十三萬零四百六十),而且還有各種不同的寫法(大,小寫;簡,繁體,日文),所以CSS3裡面也分成兩個部分定義
1. cjk-ideographic algorithm (先轉換成CJK數字的格式)
2. cjk numbering system's table (再轉換成不同文字的寫法)
首先說一下我認為有哪些問題
1. cjk-ideographic algorithm內容有誤
2. 大,小寫的cjk-ideographic algorithm應該不同(目前都是用同一套演算法)
3. suffix跟我們的使用習慣不合,而且搭配起來有點難看 @_@
4. cjk numbering system's table的內容寫錯了
1. cjk-ideographic algorithm內容有誤
下面是CSS3對cjk-ideographic algorithm的說明:
引言回覆:
The cjk-ideographic algorithm is used by several numbering systems, using different sets of digits. These systems are defined for numbers greater than or equal to 0 and less than 1016. Numbers less than zero or equal to or greater than 1016 should use the decimal system. The core algorithm is as follows:
1. Split the decimal number into groups of four digits, starting with the least significant digit.
2. Ignoring groups that have the value zero, append the second group marker to the second group, the third group marker to the third group, and the fourth group marker to the fourth group. These markers are defined in the tables for the specific numbering systems. The first group has no marker.
3. For each group, ignoring digits that have the value zero, append the second digit marker to the second digit, the third digit marker to the third digit, and the fourth digit marker to the fourth digit. These markers are defined in the tables for the specific numbering systems. The first digit has no marker.
4. For any group with a value less than 20, remove the second digit (the 1 in the tens column). Leave any associated markers.
5. Concatenate the groups back into a single string, least significant group last.
6. Collapse any consecutive runs of 0 digits to a single 0.
7. Replace each digit with the relevant character selected from the numbering system's table.
The suffix for the cjk-ideographic numbering systems is a dot . U+002E. Is there a better suffix to use?
If specified explicitly, the cjk-ideograph keyword should be handled like trad-chinese-informal.
那我們就按照他的步驟實際轉換一次看看吧,假設現在有一個數字1035000030050011,轉換的過程如下:
step1: 1035 / 0000 / 3005 / 0011
step2: 1035<GM4> / 0000 / 3005<GM2> / 0011
step3: 1<DM4>03<DM2>5<GM4> / 0000 / 3<DM4>005<GM2> / 001<DM2>1
step4: 1<DM4>03<DM2>5<GM4> / 0000 / 3<DM4>005<GM2> / 00<DM2>1
step5: 1<DM4>03<DM2>5<GM4>00003<DM4>005<GM2>00<DM2>1
step6: 1<DM4>03<DM2>5<GM4>03<DM4>05<GM2>0<DM2>1
step7: 一千零三十五兆零三千零五萬零十一
看到哪裡不對勁了嗎?應該是一千零三十五兆零三千零五萬零一十一,step 4把十位數字的一砍掉是錯誤的,一般只有在20以下的數字(例如:十一,十二)才會省略掉十位數字的一,但是step 4把所有小於20的group的十位數字都砍掉了,這條規則應該改成If the total number less than 20才對,(神奇的是,我用FireFox 0.93去看我的測試網頁,結果居然是正確的,看來FireFox並沒有完全遵循W3C的規範...呵
)
2. 大,小寫的cjk-ideographic algorithm應該不同
第二個問題也跟第一個問題有關,即使是20以下的數字,用大寫數字(國字數字)書寫的時候也不應該省略掉十位數字的壹(例如:壹拾貳,壹拾參),大寫數字本來就是為了防止紀錄錯誤而定義的比較嚴謹的格式,而且大多被使用在金錢往來,帳目紀錄方面,據我所了解是不能省略壹的
3. suffix跟我們的使用習慣不合,而且搭配起來很難看 @_@
目前定義的suffix是. U+002E,但是在台灣一般是習慣用、 U+3001,不知道大陸跟日本的習慣是怎麼樣,請知道的網友幫忙提供一下意見吧
。CSS3-lists WD也在旁邊標注"Is there a better suffix to use?"。不過,後面還定義了一個pseudo-element ::marker,即使預設的suffix大家不滿意,還是可以自定一個,所以這個問題影響比較不大(例如:li::marker {content: counter(counter, cjk-ideographic) "、"}但目前FireFox好像還不支援這個功能)。
4. cjk numbering system's table的內容寫錯了
一共有japanese-formal, japanese-informal, simp-chinese-formal, simp-chinese-informal, trad-chinese-formal, trad-chinese-informal六種,只要是中文字的使用者應該可以很容易看出來錯在哪裡吧!在此列出正確的版本
simp-chinese-formal
Second Group Marker 万 U+4E07
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 拾 U+62FE
Third Digit Marker 佰 U+4F70
Fourth Digit Marker 仟 U+4EDF
Digit 0 零 U+96F6
Digit 1 壹 U+58F9
Digit 2 贰 U+8D30
Digit 3 叁 U+53C1
Digit 4 肆 U+8086
Digit 5 伍 U+4F0D
Digit 6 陆 U+9646
Digit 7 柒 U+67D2
Digit 8 捌 U+634C
Digit 9 玖 U+7396
simp-chinese-informal
Second Group Marker 万 U+4E07
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 十 U+534E
Third Digit Marker 百 U+767E
Fourth Digit Marker 千 U+5343
Digit 0 零 U
Digit 1 一 U+4E00
Digit 2 二 U+4E8C
Digit 3 三 U+4E09
Digit 4 四 U+56DB
Digit 5 五 U+4E94
Digit 6 六 U+516D
Digit 7 七 U+4E03
Digit 8 八 U+516B
Digit 9 九 U+4E5D
trad-chinese-formal
Second Group Marker 萬 U+842C
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 拾 U+62FE
Third Digit Marker 佰 U+4F70
Fourth Digit Marker 仟 U+4EDF
Digit 0 零 U+96F6
Digit 1 壹 U+58F9
Digit 2 貳 U+8CB3
Digit 3 參 U+53C3
Digit 4 肆 U+8086
Digit 5 伍 U+4F0D
Digit 6 陸 U+9678
Digit 7 柒 U+67D2
Digit 8 捌 U+634C
Digit 9 玖 U+7396
trad-chinese-informal
Second Group Marker 萬 U+842C
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 十 U+534E
Third Digit Marker 百 U+767E
Fourth Digit Marker 千 U+5343
Digit 0 零 U+96F6
Digit 1 一 U+4E00
Digit 2 二 U+4E8C
Digit 3 三 U+4E09
Digit 4 四 U+56DB
Digit 5 五 U+4E94
Digit 6 六 U+516D
Digit 7 七 U+4E03
Digit 8 八 U+516B
Digit 9 九 U+4E5D
japanese-formal
Second Group Marker 万 U+4E07
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 拾 U+62FE
Third Digit Marker 佰 U+4F70
Fourth Digit Marker 仟 U+4EDF
Digit 0 零 U+96F6
Digit 1 壹 U+58F9
Digit 2 貳 U+8CB3
Digit 3 參 U+53C3
Digit 4 肆 U+8086
Digit 5 伍 U+4F0D
Digit 6 陸 U+9678
Digit 7 柒 U+67D2
Digit 8 捌 U+634C
Digit 9 玖 U+7396
japanese-informal
Second Group Marker 万 U+4E07
Third Group Marker 億 U+5104
Fourth Group Marker 兆 U+5146
Second Digit Marker 拾 U+62FE
Third Digit Marker 佰 U+4F70
Fourth Digit Marker 仟 U+4EDF
Digit 0 零 U+96F6
Digit 1 一 U+4E00
Digit 2 二 U+4E8C
Digit 3 三 U+4E09
Digit 4 四 U+56DB
Digit 5 五 U+4E94
Digit 6 六 U+516D
Digit 7 七 U+4E03
Digit 8 八 U+516B
Digit 9 九 U+4E5D
關於1, 3項是以台灣的使用習慣為準,不知道大陸香港日本的習慣會不會與我們不同,而關於第2項,可能就連台灣人的看法都不一定一樣吧 ^^|||
這份CSS3 module: lists, Working Draft是2002年11月發布的,我想在這一段時間應該已經有人把這些Bug呈報上去了吧,不知道在哪裡可以找到Bug report(我在Mail Archives裡面找不到相關的討論),請大家提供一些意見吧