Browse Source

Fix doc.js so that it doesn't misnest menu items in the TOC

v0.7.4-release
Aria Stewart 15 years ago
committed by Ryan Dahl
parent
commit
8ec21059dd
  1. 10
      doc/doc.js

10
doc/doc.js

@ -23,6 +23,10 @@ NodeDoc.generateToc = function()
cur_level = this.tagName.substr(1, 1); cur_level = this.tagName.substr(1, 1);
if (last_level != 0 && cur_level <= last_level) {
html.push("</li>")
}
if (cur_level > last_level) if (cur_level > last_level)
{ {
html.push('<ul><li>'); html.push('<ul><li>');
@ -38,15 +42,11 @@ NodeDoc.generateToc = function()
} }
html.push('<a href="#' + $this.attr('id') + '">' + $this.text().replace(/\(.*\)$/gi, '') + '</a>'); html.push('<a href="#' + $this.attr('id') + '">' + $this.text().replace(/\(.*\)$/gi, '') + '</a>');
if (cur_level == last_level || cur_level > last_level)
{
html.push('</li>');
}
last_level = cur_level; last_level = cur_level;
}); });
html.push('</ul>'); html.push('</li></ul>');
var $toc = $('#toc').append(html.join('')).find('ul li ul').each(function() var $toc = $('#toc').append(html.join('')).find('ul li ul').each(function()
{ {

Loading…
Cancel
Save