By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,944 Members | 1,819 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,944 IT Pros & Developers. It's quick & easy.

HTML tags optimization

P: n/a
hi all,

i want to do some optimizations for HTML tags,

something like this:

<i><b>TEXT1</b></i><b><i><u>TEXT2</u></i></b>

optimise to

<i><b>TEXT1<u>TEXT2</u></b><i>

at the very beginning, i was thinking of analysing each text-block, to
know their color, size, if is bold or italic, but i found it was too
complicated.

e.g

<font color=red><font size=6>TEXT1</font></font>

optimise to

<font color=red size=6>TEXT1</font>

but if there is TEXT2 exist

<font color=red><font size=6>TEXT1</font>TEXT2</font>

we can not do any optimization.

my problem is I can not find a method to treat all those situation, I
had too much thinking and get fool now

anyone can give me some advices?

thanks

PS:

other examples:

1
<font size=5><font size=7>TEXT</font></font>
=>
<font size=7>TEXT</font>

2
<i>TEXT </i><i>TEXT</i>
=>
<i>TEXT TEXT</i>

3
<i>TEXT<i>TEXT</i></i>
=>
<i>TEXT</i>

etc...

Sep 2 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
DENG wrote:
hi all,

i want to do some optimizations for HTML tags,

something like this:

<i><b>TEXT1</b></i><b><i><u>TEXT2</u></i></b>

optimise to

<i><b>TEXT1<u>TEXT2</u></b><i>

at the very beginning, i was thinking of analysing each text-block, to
know their color, size, if is bold or italic, but i found it was too
complicated.

[etc ...]

Are you expecting the answers to be different that they were two days ago?

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 2 '05 #2

P: n/a
DENG wrote:
(snip same post as two days ago)

<ot>
In case you don't know, google.groups is just a web interface (and
archive) to usenet groups. No need to repost the same question twice...
</ot>

BTW, for what you want to do (which is mostly a waste of time IMHO, but
what, that's your time, not mine), the obvious, CS101 answer is to first
build an AST of your document, then transform this AST - collapsing
nodes when possible etc -, then write it back as (if possible valid) html.
--
bruno desthuilliers
ruby -e "print 'o****@xiludom.gro'.split('@').collect{|p|
p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
Sep 2 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.