W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [css-counter-styles] discontiguous ranges

From: Reece Dunn <msclrhd@googlemail.com>
Date: Wed, 20 Feb 2013 14:15:17 +0000
Message-ID: <CAGdtn26ihoAYWygpj1Ue+72DQBhuQEZk9ML0Ot-05YoGZ5hZBw@mail.gmail.com>
To: Peter Moulder <peter.moulder@monash.edu>, www-style list <www-style@w3.org>
Hi,

Using the latest http://dev.w3.org/csswg/css-counter-styles-3/ (section
3.5) as a reference:

    [ [ <integer> | infinite ]{2} ]#
    This defines a comma-separated list of ranges.

This means that something like |range: 5 9, 22 30;| is valid.

    The range of the counter style is the union of all the ranges defined
in the list.

Therefore, |range: 1 5, 5 10;| and |range: 1 10;| are identical.

    If a counter style is used to represent a counter value outside of its
ranges, the counter style instead drops down to its fallback counter style.

This means that if you have something like:

    @counter-style multirange {
        system: cyclic;
        symbols: '*';
        range: 0 1, 5 10;
    }

will cause the counter style to fallback when n=2.

IIUC, the rationale for this is when extending counter-styles. E.g.:

    @counter-style lower-roman-extended {
        system override lower-roman;
        range: 5000 19999;
        additive-symbols: 5000 'v\772' , 10000 'x\772' ; /* v-bar, x-bar,
... */
    }

Here, the range of lower-roman (1-4999) is combined with
lower-roman-extended (5000-19999) to create the range 1-19999.

NOTE: For this example to work, the additive-symbols need to be merged
(which they are not according to the current spec.). Otherwise, the symbols
from lower-roman need to be added to lower-roman-extended.

NOTE: If additive-symbols were to be merged, they would need to override
exising additive tuples. For example:

    @counter-style lower-roman-unicode {
        system override lower-roman;
        additive-symbols: 1 \u2017 , 2 \u2018 , ... ; /* i, ii, ... */
    }

It might make more sense to restrict ranges to consecutive ranges (i.e.
ranges that do not have gaps). This should preserve the intent of the spec,
while keeping the implementation optimal (you only need one min-max pair to
store the range). If a range would have gaps, the range is dropped.

Thanks,
- Reece


On 20 February 2013 12:57, Peter Moulder <peter.moulder@monash.edu> wrote:

> Considering that:
>
>   - of the ~140 counter styles given both normatively (in previous
>     versions of css-counter-styles) and in the examples, not one uses the
> option of
>     multiple ranges;
>
>   - multiple ranges don't add to the expressive power: one can accomplish
> the same
>     with fallback and override (admittedly with less readability);
>
>   - multiple ranges have a cost in testing and implementation (complexity
> of representation
>     and accessing that data structure, and corresponding parsing and its
> error handling);
>
>   - the current text of http://www.w3.org/TR/css3-lists/ only gives a
> single range;
>
> I think it reasonable not to implement multiple ranges, and I suggest
> removing
> the option of multiple ranges from the spec.
>
> (No rationale needed if you disagree.)
>
> pjrm.
>
>
Received on Wednesday, 20 February 2013 14:15:49 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:06 GMT