Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re: Fixing Bad HTML

by seattlejohn (Deacon)
on Nov 17, 2002 at 23:05 UTC ( [id://213614]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Fixing Bad HTML
in thread Fixing Bad HTML

Though I'd be inclined to disallow sloppy markup like this (as others have suggested), one option I've used in the past is to backtrack up the stack looking for a matching tag and autoclosing any open tags I pass along the way.

In this case that would proceed something like this. You get to the </B> and look at the tag at the top of the stack. It's not a <B>, it's an <I>, so you generate a </I> yourself and pop that off the stack, then try again. This time it is a <B> so you can just pop it off the top and you move on.

The next closing tag is </I>. Since there's no matching open tag on the stack, you simply remove it.

        $perlmonks{seattlejohn} = 'John Clyman';

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://213614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found