Hi, 


>-----Original Message-----
>From: [email protected] [mailto:[email protected]] On Behalf Of
>Kristen Carlson Accardi
>Sent: Tuesday, June 22, 2010 11:17 AM
>To: [email protected]
>Subject: Re: [PATCH 1/2] stkutil: convert text attributes to html
>
>On Mon, 21 Jun 2010 19:51:06 -0700
>Kristen Carlson Accardi <[email protected]> wrote:
>
>> On Tue, 22 Jun 2010 00:45:39 +0200
>> andrzej zaborowski <[email protected]> wrote:
>>
>> > Can we always end_format() and start_format() when the formatting
>> > changes, and just once instead of in a loop?  Here's a test case that
>> > I'm worried about:
>> >
>> > text is "abc"
>> > attribute 1 (red text) starts at 0, len 2
>> > attribute 2 (blue text) starts at 1, len 2
>> >
>> > the generated html, by my reading will look like this:
>> > <span style="color: red;">a<span style="color: blue;">b</span>c</span>
>>
>> I ran this test just to make sure, the generated html is not as
>> you fear and is correct (I used different colors though)
>>
>> <html><body><span style="color: #347235;background-color:
>#FFFFFF;">a<span style="color: #0000A0;background-color:
>#FFFFFF;">b</span></span>c</body></html>
>
>Hum, ok, this is not correct.... I see your concern and will fix.

When you fix your current algorithm, can we think about these optimizations at 
the same time?
1. The attribute overlapping may split the text into undesirable pieces. That 
is, we may find opportunities to merge the adjacent ones together at last. 
2. Some embedded attributes may be omitted. Taking your above case as example, 
the second "background-color:#FFFFFF" can be omitted.
3. Part of attributes, not the whole, can be merged together. For example: <red 
bold>a</red bold><red italic>b</red italic> "may" (not always bring benefit) be 
optimized as <red><bold>a</bold><italic>b</italic></red>. 

The target of these optimizations is to make to generated html file as small as 
possible. I guess this is a NP-complete problem, and not easy to handle :) 


Regards,
-Yang
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to