W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Re: [css3-lists] Specifying new list-types

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 9 Sep 2010 13:22:01 -0700
Message-ID: <AANLkTikw9W+C+-fpriSNVXw55a+exgjYLH_ppduTbUEA@mail.gmail.com>
To: Behdad Esfahbod <behdad@behdad.org>
Cc: fantasai <fantasai.lists@inkedblade.net>, www-style list <www-style@w3.org>
On Thu, Sep 9, 2010 at 1:02 PM, Behdad Esfahbod <behdad@behdad.org> wrote:
> [resending from correct address.  Thunderbird tries to outsmart me...]
>
> On 09/08/10 20:52, fantasai wrote:
>> > On 09/08/2010 05:33 PM, Behdad Esfahbod wrote:
>>> >> On 09/08/10 19:51, fantasai wrote:
>>>> >>>
>>>> >>>   - I agree with Charles about having a 'prefix' parameter in
>>>> >>>     addition to 'suffix'; that seems useful. Not so sure about
>>>> >>>     the need for 'infix'.
>>> >>
>>> >> Infix would be useful with additive to do most language-based numberings.
>>> >> Think of an infix of " and ".
>> >
>> > I'm failing to come up with the example you're thinking of.
>> >
>> > If you want to *write out* numbers, it gets complicated fast.
>> > But that's not really something one uses for list numbering.
> Yes, that's what I was thinking about.  I thought that's what language-based
> numbering refers to?
>
> At any rate, such numbering is useful to have for section / chapter numbering
> as well as page numbering, maybe not for lists.  I know I've had to implement
> it in Persian LaTeX implementations more than once.

You can do one form of written English as a plain additive list-type.
This omits the "and", but that's okay for many cases.

@list written-english {
  type: additive;
  range: 1-199;
  additive-glyphs: "one hundred " 100, "ninety " 90, "eighty " 80,
"seventy " 70, "sixty " 60, "fifty " 50, "fourty " 40, "thirty " 30,
"twenty " 20, "nineteen" 19, "eighteen" 18, "seventeen" 17, "sixteen"
16, "fifteen" 15, "fourteen" 14, "thirteen" 13, "twelve" 12, "eleven"
11, "ten" 10, "nine" 9, "eight" 8, "seven" 7, "six" 6, "five" 5,
"four" 4, "three" 3, "two" 2, "one" 1;
}

For example, for the value 123, the algorithm will work as follows:

1. Walk the list to find the first item with a weight less than or
equal to the current value.  This is the ("one hundred" 100) value.
Append "one hundred" to the current marker string, and subtract 100
from the current value.  Current value is now 23.

2. Walk the list.  Next value leq than 23 is ("twenty" 20).  Append
"twenty ", decrement by 20.  Current value is now 3.

3. Walk the list.  Next value leq than 3 is ("three" 3).  Append
"three", decrement by 3.  Since the current value is now 0, stop the
algorithm.

The final marker string is "one hundred twenty three".

There are several additional features I could add that might make this
better, but I'd probably want to see some written-number patterns in
other languages to see if it's worthwhile enough to do so.  If a
feature only allows a single additional language to be written, it's
not worth it.

~TJ
Received on Thursday, 9 September 2010 20:22:53 GMT

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