Re: Outline Numbered Lists

2009/6/19 fantasai <fantasai.lists@inkedblade.net>:
> Dylan Just wrote:
>>
>> I think that a list-style-outline:outline would be better than a new
>> list-style-type, as it means we can do outlines for different
>> list-style-types.
>> E.g. it'd let you do:
>> 1.
>> 1.a.
>> 1.a.i.
>> 1.a.ii.
>
> This is an interesting case right here, one you can't do with counters().
> counters() can only take one counter-style, and it has no way of looking
> up what styles have been used previously.

You can do it with "creative selectors", ie manually referencing all
counters and relative style at all nesting level. Horrible but
working.

> We could maybe introduce a new counter-style, I'll call it 'auto' for now,
> that, when it looks up a counter instance, associates the element's
> list-style-type with the counter and uses that style for that counter.
> Not exactly sure how to describe the counter instance's relationship to
> the relevant element, but I /think/ that should be possible.

Uhm... If I understand it correctly, a value of "auto" uses, for each
counter in scope with that name, the "list-style-type" of the element
which last incremented it (regardless of the type used in counter() /
counters() on that element or associated pseudo-elements).

So the example becomes:
ol {
list-style-type: cycle(decimal,lower-alpha,lower-roman);
}
ol > li::marker {
content: counters(list-item,auto,".");
}

with the following assumptions
- cycle() and ::marker are supported
- list-item counter is automatically reset by ol
- li is "display:list-item"

> (I can see it being useful even with counter(); you can change the style
> of the counter without fiddling with the content property that sets it.)

Actually, it is a must, if you want to reduce ::marker magic to a
default stylesheet.

> ~fantasai
>
>

Giovanni

Received on Friday, 19 June 2009 11:26:11 UTC