W3C home > Mailing lists > Public > www-style@w3.org > April 2011

Re: [css3-lists] CJK numbering algorithms

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 21 Apr 2011 14:02:10 -0700
Message-ID: <BANLkTinR-bBGM4jVkHV1Bzz0JPAdrCRZjg@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
So, let's try this algorithm again.


 1. If the number is zero, use the digit for zero. End algorithm.

 2. Starting from the right (ones place), split the decimal number
    into groups of four digits.

 3. For each group with a non-zero value, append the appropriate
    group marker to the group.  The ones group has no marker.

 4. Within each group, for each digit that is not 0, append
    the appropriate digit marker after the digit. The ones digit
    of each group has no marker.

 5. Replace all digits 1-9 according to the table below.

 6. Simplify:
      * For the Chinese informal styles, for any group with a value
        between ten and nineteen, remove the digit before the tens
        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, leaving
        only the marker.
      * For Korean informal styles, if the value of the ten-thousands
        group is 1, drop the digit (but leave the group marker).

 7. Drop zeros:
      * For the Chinese styles, drop any leading zeros
        in the largest group.  Drop any trailing zeros for all
        non-zero groups.  For each group, collapse any remaining adjacent
        zeros into a single zero.  For the Chinese informal styles,
        drop any groups with a value of zero.
      * For the Japanese and Korean styles, drop all zeros.

 9. Insert spaces (U+0020) between groups for the Korean styles.


I think this correctly synthesizes all three of the algorithms and
their formal/informal distinctions.  I'm not particularly happy with
the way I've worded 7.1, though.

~TJ
Received on Thursday, 21 April 2011 21:02:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:39 GMT