Re: [css-counter-styles] Behavior of zero in system 'alphabetic' & 'symbolic'

On Mon, Feb 24, 2014 at 2:23 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
> On Tue, Feb 25, 2014 at 8:49 AM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
>> On Sun, Feb 23, 2014 at 12:12 AM, Xidorn Quan <quanxunzhen@gmail.com> wrote:
>>> Hi,
>>>
>>> The spec says, 'alphabetic' and 'symbolic' are "defined only over
>>> strictly positive counter values", while they are also
>>> negative-capable. Consequently, if an author defines a style:
>>>
>>> @counter-style a { system: symbolic; range: -10 10; symbols: a; }
>>>
>>> and use value -2 - 2, then, according to the rules, he will get: -aa,
>>> -a, 0, a, aa. The zero in the middle seems to be strange. I propose
>>> that we could make the defination cover zero, and generate an empty
>>> sequence for zero.
>>
>> I agree that the 0 in the middle is strange, but I think it's even
>> stranger to generate an empty counter representation.  Note that I'd
>> also have to then hook into the rest of the algorithm, so that it
>> doesn't get a prefix, suffix, or pad added to it.
>
> I don't think it is necessary to hook into the rest. Other descriptors
> could be processed as normal.

That gets super weird, then, because almost all types have a suffix.
You'd get a list like:

  -aa. Negative two
  -a.  Negative one
  .    Zero
  a.   One
  aa.  Two

That just doesn't make sense.

> In fact, you remind me that, it could be
> combined with pad to make it meaningful. For example, we can define
> the following counter style:
>
> @counter-style { system: symbolic; range: -10 10; symbols: a; pad: 1 z; }
>
> so that we could have -aa, a, z, a, aa. However, if you don't allow
> the symbolic to cover zero, to achieve the same effect, the author
> will have to do some fallback magic.

Fallback magic makes way more sense than abusing pad in this way:

@counter-style lots-of-as { system: symbolic: range: -10 10; symbols:
a; fallback: lots-of-as-zero; }
@counter-style lots-of-as-zero { system: cyclic; range: 0 0; symbols: z; }

Fallback magic is how I generally solve some of the extra weird parts
of a few systems, anyway.  It works well.

~TJ

Received on Monday, 24 February 2014 23:35:31 UTC