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

[css-counter-styles] Algorithm of 'symbolic' is incorrect

From: Xidorn Quan <quanxunzhen@gmail.com>
Date: Sun, 23 Feb 2014 19:52:38 +1100
Message-ID: <CAMdq69_DMJRRYa-yaE0cqxO-rXGRLet_ZKpraOZvqVk6UvqiOw@mail.gmail.com>
To: www-style list <www-style@w3.org>
Hi,

In the current draft, the algorithm of system 'symbolic' seems to be
incorrect. We use the style "footnote" defined in the spec for
example:

Let counter value = 1, N = 4, then

1. chosen symbol = symbol(1 mod 4) = symbol(1) = ⁑ (SHOULD be '*')
2. representation length = floor( (1 - 1) / 4 ) = 0 (SHOULD be 1)
3. S = representation length * chosen symbol = (empty sequence)

The correct algorithm should be:

Let N be the length of the list of counter symbols, value 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 - 1) mod N).
2. Let the representation length be ceil(value / N).
3. Append the chosen symbol to S a number of times equal to the
representation length.

Finally, return S.

Regards,
Xidorn Quan
Received on Sunday, 23 February 2014 08:53:46 UTC

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