Hello,
Is this plugn that I use (thanks btw !) still alive ?
Thanks
]]>produce invalid html
does not check encoding
does not check duplicate id or existing id
does not use DOM XML (would cleanup much of the mess)
Please correct HTML Bugs and ID generation bug
Actually the plugin insert <span id=”blah”><h(x)>title</h(x)></span> which is invalid HTML. I managed to hack correct the code by changing this to <h(x)><span id=”blah”>title</span></h(x)> which is valid. A much better approach would be to insert the id=”blah” directly like:
<h(x) id=”blah”>title</h(x)>, as well as supporting HTML5 style <h> and preserving existing id if some exist.
Another annoying bug is the generation of the id. Actually it does not handle UTF-8 charset other than the ASCII part extracted from inner title. My guess is generating id with prefix+sequence would be enough simple and ok like id=”wp-toc-xxx”.
Other annoying bug is the ordering of closing is wrong as all are packed at the end. Something is wrong withe the proper nesting and produce another invalid HTML code.
After all, the code rely on regexreplace for subsitution, I wonder if it would not be preferable to rely on DOMDocument for ID insertion and proper nested OL UL nested tag handling.
]]>