HTML tags optimization

Discussion in 'Python' started by DENG, Sep 2, 2005.

  1. DENG

    DENG Guest

    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...
     
    DENG, Sep 2, 2005
    #1
    1. Advertising

  2. DENG

    Steve Holden Guest

    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/
     
    Steve Holden, Sep 2, 2005
    #2
    1. Advertising

  3. Re: [OT] HTML tags optimization

    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 ''.split('@').collect{|p|
    p.split('.').collect{|w| w.reverse}.join('.')}.join('@')"
     
    bruno modulix, Sep 2, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dean H. Saxe
    Replies:
    0
    Views:
    1,043
    Dean H. Saxe
    Jan 3, 2004
  2. Rob Nicholson
    Replies:
    3
    Views:
    759
    Rob Nicholson
    May 28, 2005
  3. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    911
    Andy Dingley
    Jan 8, 2005
  4. DENG
    Replies:
    6
    Views:
    304
  5. Ravikiran

    Zero Optimization and Sign Optimization???

    Ravikiran, Nov 17, 2008, in forum: C Programming
    Replies:
    22
    Views:
    877
    Thad Smith
    Nov 24, 2008
Loading...

Share This Page