The table of contents <div> is output inside a <p>, which is invalid.

The module is also outputting duplicate opening and closing <ol> tags:

<h2>Table of Contents</h2>
<ol>
<ol>
<li> ... 
CommentFileSizeAuthor
#2 tableofcontents.patch2.87 KBbrian_may

Comments

deviantintegral’s picture

I will be able to get down to working on 5.x hopefully next week after all of my assignments/essays/midterms are done. Can someone else verify this issue with the 5.x module? Note that if you wrap the

tag in

's, it will generate invalid markup.

Here is an example of valid markup on the 4.7 version.

Is there a chance another input filter is adding the

tags?

brian_may’s picture

StatusFileSize
new2.87 KB

I have attached a patch which seems to solve this issue.

This is not necessarily the best solution or properly formatted, but it solves the immediate problem for me.

I switched to a recursive solution because I had problems visualising a non-recursive solution.

deviantintegral’s picture

Status: Active » Closed (fixed)

I haven't seen this problem crop back up in my sites or in the latest version of the code (version 2.x). I'm closing this unless I hear of more people having issues.

Note that if you put the

inside of a tag, my module won't change anything. It's up to the user to ensure that they don't wrap it in something.

--Andrew