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

[css-counter-styles] 'symbolic' algorithm

From: Simon Sapin <simon.sapin@exyr.org>
Date: Fri, 07 Jun 2013 12:58:31 +0900
Message-ID: <51B15A67.4030706@exyr.org>
To: www-style@w3.org
Hi,

The algorithm for the 'symbolic' system is defined as:

> To construct the representation, run the following algorithm:
>
> Let N be the length of the list of counter symbols, value initially be the counter value, S initially be the empty string, and symbol(n) be the nth counter symbol in the list of counter symbols (0-indexed).
>
>     1. Let the chosen symbol be symbol(value mod N).
>     2. Let the representation length be floor( (value - 1) / N ).
>     3. Append the chosen symbol to S a number of times equal to the representation length.
>
> Finally, return S.


For value = 1, symbols being 0-indexed, symbol(value mod N) is the 
*second* symbol. It should be the first.

For value <= N, this algorithm gives length = 0 and thus an empty 
representation. It should be length = 1 instead.

Unless I missed something, lines 1 and 2 of the algorithm should be 
changed to:

     1. Let the chosen symbol be symbol((value - 1) mod N).
     2. Let the representation length be floor( (value - 1) / N ) + 1.

-- 
Simon Sapin
Received on Friday, 7 June 2013 03:58:57 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:12 UTC