Re: [css3-lists] CJK numbering algorithms

On 04/21/2011 04:48 PM, Tab Atkins Jr. wrote:
> I've made the change and rearranged the sections accordingly.  Can
> everyone check out
> <http://dev.w3.org/csswg/css3-lists/#cjk-counter-styles>  and make sure
> I haven't done anything dumb?

Editorial comments. Because I hate the "set the foo flag" style of spec-writing.


I suggest s/"spoken-out"/longhand/g;

  # Chinese, Japanese, and Korean all share almost identical "spoken-out"
  # counter styles, which are roughly similar to using "one, two, three..."
  # in English.

Replace with

  | Chinese, Japanese, and Korean have longhand counter styles, which
  | have a structure similar to "one hundred thirteen thousand and
  | twenty-three" in English.

Insert

  |                          There are formal and informal variants.
  | Note: The formal styles tend to be used in financial and legal
  | documents as their characters more difficult to alter.
  |
  | These counter styles are defined below:
  |
  | <dl>
  |   <dt>simp-chinese-informal</dt>
  |     <dd>The simplified Chinese informal style
  |   <dt>simp-chinese-formal</dt>
  |     <dd>The traditional Chinese formal style
  |   <dt>trad-chinese-formal</dt>
  |     <dd>The traditional Chinese informal style
  |   ...
  |   <dt>cjk-ideographic</dt>
  |     <dd>For legacy reasons, this counter-style is defined as an alias
  |       for trad-chinese-informal.
  | </dl>

This gives the reader an up-front overview of what they're dealing with.
You could even toss in an example or two into those definitions. It'll
also help web authors a lot, because they can now stop reading this
section: they already have a clear idea of what styles are available
and what they each mean.

  # The Chinese and Japanese styles are defined ... less than 10^16.

Append:

  | For numbers outside this range, the cjk-decimal style must be used.

and start a new paragraph for the intro to your algorithm.


Remove item two (setting the negative flag) and replace item nine with:

  | 9. If the counter is negative, replace the negative sign with the
  |    appropriate symbol.

Also, we're starting with a decimal representation. The algorithm just
runs a bunch of filters on the string, and the groups are just ways of
keeping track of parts of it. Nothing's getting reordered around, so
we don't need to make things overly complicated. This:

  # Recombine groups:
  #   For the Chinese and Japanese styles, concatenate the groups back into
  #   a single string, least significant group first (on the right).
  #   For the Korean styles, concatenate the groups back into a single
  #   string, least significant group first (on the right), with a space
  #  (‘ ’ U+0020) inserted between each group.

makes me think too much. Which is why I just had

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

My brain is not a computer. Please don't make it think like one. I don't
have enough RAM to pretend I'm a computer. Keeping track of arbitrary
flags and indices is hard. Sophisticated structures like a string that
has various parts of it labelled differently, however, are easy. It's
less "things" because it's one "thing".


Lastly, combine and split up the tables like I did in
   http://lists.w3.org/Archives/Public/www-style/2011Apr/0621.html

This puts the data right where you're dealing with it in the algorithm,
so you don't have to track across screens as you're trying to understand
what's going on. It splits the different types of characters according
to their roles in the algorithm, to help you understand how they are
different. It also puts all the styles parallel to each other, so you
can easily see the similarities in structure and differences in character
across the styles.

~fantasai

Received on Friday, 22 April 2011 20:08:14 UTC