LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-03-2005, 01:49 PM   #1
infidel
Member
 
Registered: Jun 2003
Location: Easley, SC, US
Distribution: Ubuntu 7.10, Mandrake 9.2
Posts: 91

Rep: Reputation: 15
Question Matching/marking HTML tag pairs--?


Hello, everyone. I'm in the middle of trying to work the snags out of a nightmarish, multiple-nested-tables HTML document (my last such page; CSS, here I come...). I know that there must be several closing tags missing, but I'm having a hard time eyeballing this lengthy file.

I'd rather not run HTML Tidy or something similar on it, because I don't always like the results. None of my text editors' syntax highlighting appears to be taking notice of anything amiss, although I've already found several open tags on my own. Is there any sort of application or script that simply "matches" tags, perhaps by applying different colors or numbers or something, in such a way that I can see where the openings are?

I've Googled this, but I can't come up with a set of search terms that renders anything promising.

Any guidance would be greatly appreciated. Thanks very much in advance.
 
Old 08-03-2005, 09:21 PM   #2
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
I just go through and manually tab out elements. When your code looks like this, those errors are much easier to spot.

Code:
<html>
<head>
  <title>Some Title</title>
</head>

<body>
<table border='...' ...>
  <tr>
    <td something='...'>
      <!-- a bunch of stuff -->
    </td>
    <td something_else=''>
      <!-- another table! -->
      <table border='0' width='33%'>
        <tr>
          <td>
            <a href='http://random.net/cgi-bin/login.cgi'>Login</a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
I use 2 spaces per logical element, some elements just don't make sense to space out. Some people use 4 spaces, that can be a little much seeing as how HTML gets very nested sometimes. When you're consistent with this type of spacing, you can spot errors easily, because tags won't align properly.

Other than proper spacing, try running the site through one of the W3C validators. Don't try to validate on strict, just copy/paste the appropriate 'transitional' doctype into your code (above the <html> tag), and see the results. The validator can spit a ton of errors at you, but if you step through 1 by 1, and keep uploading your page (or better yet, modifying the page on your live server) you can nail them out pretty fast.
 
Old 08-08-2005, 01:28 PM   #3
infidel
Member
 
Registered: Jun 2003
Location: Easley, SC, US
Distribution: Ubuntu 7.10, Mandrake 9.2
Posts: 91

Original Poster
Rep: Reputation: 15
Thanks, lowpro. I had actually tabbed everything out like you suggested before I posted, and was still having a hard time tracking everything down. W3C's html validator helped a little. Someone on a LUG mailing list suggested that I give table border colors (why that never occurred to me, I have no idea...), and that did the trick. Now I know exactly how sloppy of an html coder I really am.

Thanks again.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript / HTML <select> tag djgerbavore Programming 3 04-23-2005 10:51 AM
HTML: attribute height in tag table jaakkop Programming 4 03-22-2005 07:29 AM
html in cgi, closing a tag ludeKing Programming 2 05-09-2004 10:34 AM
PERL: split on html tag? ocularbob Programming 12 09-08-2003 05:52 PM
html .avi tag ?? itsjustme Programming 2 07-30-2003 12:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration