Closed (fixed)
Project:
Table of Contents
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
28 Mar 2012 at 18:39 UTC
Updated:
24 Apr 2013 at 07:50 UTC
After I add [toc] to the page, it does not gets validated from validator.w3.org as it has some html coding errors.
<div class="toc" id="toc">
<div class="toc-title">Contents</div>
<div class="toc-list">
<ul>
</li>
<li class="toc-level-1"><a href="#Test1">Test1</a></li>
<li class="toc-level-1"><a href="#Test2">Test2</a></li>
<li class="toc-level-1"><a href="#Test3">Test3</a></li>
</ul>
</div>
</div>
</li> <-- this is an unnecessary code which is being added to the html code
Comments
Comment #1
AlexisWilke commentedIn my test, it looks like correct HTML...
First you'd need to check with a tool like wget to report exactly what your website spits out because in a browser it is most often tweaked by the browser. Otherwise, it looks like somehow one of your anchors did not make it right to the table of contents...
Thank you.
Alexis Wilke
Comment #2
himagarwal commentedI checked it with Internet Explorer and Google Chrome using http://validator.w3.org and both shows the same problem.
I'm using following settings when the error appears
Minimum heading level: H3
Maximum heading level: H3
But error disappears when I set it as follows:
Minimum heading level: H2
Maximum heading level: H3
But, I only want H3 to show up in table of contents.
Also, I checked the source code of my page and each and every H3 were outputting fine. All H3 anchors were able to make it to the table of contents.
So, I think there is some problem with setting both minimum and maximum heading level is H3.
Comment #3
AlexisWilke commentedAh! Okay! I think you hit a problem that was mentioned before. If you have any H2 tags, then I think that it will add another <ul> tag without any <li>, or at least not the proper way...
Is your page public? Could you give us a URL?
Thank you.
Alexis
Comment #4
himagarwal commentedI have sent you the link through your contact page. Please check your email.
Comment #5
AlexisWilke commentedOkay, I found the problem. I was using $index as a flag to know whether the entry was the very first one or not. If not, then I added a </li>. This is fixed in the development version for now.
D6 commit: http://drupal.org/node/1507372
I'm moving that to version 7.x now because it is likely that the problem still exists in that version.
Thank you for your persistence.
Alexis
Comment #6
slv_ commentedI Will have a look into this for for 7.x.
Comment #7
slv_ commentedThis is now committed to 7.x. Thanks Alexis and himagarwal
Comment #8
rvbcocardes commentedConcerning the w3c validator, I obtain another error :
Validation Output: Error
Line 119, Column 16: end tag for element "p" which is not open
The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.
Checked my source code : the closing
</p>is inserted by the module in the last line of the module insertion in my page...Thank you for your comments and/or help,
Cheers,
RVB