Re: [css3-lists] CJK numbering algorithms

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 UTC