[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Hebrew list-style-type in khtml?
- To: schlpbch(at-nospam)iam.unibe.ch
- Subject: Re: Fwd: Hebrew list-style-type in khtml?
- From: Herouth Maoz <herouth(at-nospam)netvision.net.il>
- Date: Mon, 5 Nov 2001 10:36:07 +0200
- Cc: linux-il(at-nospam)cs.huji.ac.il
- In-Reply-To: <E160VYz-0002Y9-00@witch.dyndns.org>
- References: <E160VYz-0002Y9-00@witch.dyndns.org>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
The following message has been forwarded to the linux-il mailing
list, and I took it upon myself to answer you as I was dealing with
this exact issue a couple of days ago, and I solved it for myself
using PHP.
- - - Forwarded message - - -
>From the KDE-Mailing-List I conclude, that you are a hebrew speaking
person.
I?m currently considering implementing Hebrew list-style-type in khtml
http://www.w3.org/TR/REC-CSS2/generate.html#propdef-list-style-type
but I?m not sure wether this is used at all in Hebrew-isch pages.
As it`s not straight forward to implement (you have a complicated way
of
counting :) ), what is your opinion on that?
Andreas
- - - End of forwarded message - - -
Actually, as far as implementing it is concerned, it's certainly not
too hard. At least, the basic algorithm for translating a number to a
Hebrew numeral is easy. Here is how I did it in PHP:
You use a small table (a hash table in PHP), to connect each letter
to its numeric value. In non-PHP languages, this would be a simple
array, with each entry having two members - a char and a short int.
Oh, and order it in descending order (tav first, aleph last).
The letters aleph (iso8859-8 character 224 decimal) to tet (232) have
the values 1-9 respectively.
The letters yod (233) to zadik (246) have the values 10-90
respectively. Note that here there are certain letters which won't be
in the table, so you actually have character codes 233, 235, 236,
238, 240, 241, 242, 244, 246.
The letters kof (247) to Tav (250) have the values 100-400
respectively.
Assume the numeric value you have to translate to Hebrew is N, and
the string where you want to store the value is S, which is initially
empty.
loop on each of the entries in the value table. Let C and V be the
members of the current entry in each iteration:
- - while ( N >= V ) do
- - - - S = S concatenated to C
- - - - N -= V
That's it... Of course, this algorithm always has 22 iterations in
the outer loop. The inner loop will actually iterate once for each of
the letters aleph (224) to shin (249). For Tav (250), it will iterate
N/400 times. So you may make it more efficient by simply
concatenating N/400 instances of Tav first, and then doing this
algorithm from shin downwards, which will give you a constant time
for your algorithm. (well, not exactly, the N/400 loop will just move
elsewhere).
Sorry for not giving the unicode values of the letters - I use
ISO8859-8 more than I do unicode.
Herouth
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il