Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Ensuring HTML is "balanced"

by apotheon (Deacon)
on Mar 06, 2006 at 22:13 UTC ( [id://534771]=note: print w/replies, xml ) Need Help??


in reply to Re: Ensuring HTML is "balanced"
in thread Ensuring HTML is "balanced"

It's true that knowing where the tag should be closed can be a tricky guesstimation at best in many circumstances. There's a simple way to decide where to put the closing tag when in doubt, though: just stick it in the last possible place to have it nest properly. Thus, in your example, the </i> would be placed just before the </b>, like so:

<b>Which <i>exact text was supposed to be italics?</i></b>

While this may not give you exactly what the original poster intended, it does help to get your code to validate properly.

print substr("Just another Perl hacker", 0, -2);
- apotheon
CopyWrite Chad Perrin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found