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. 12
      doc/doc.js

12
doc/doc.js

@ -23,6 +23,10 @@ NodeDoc.generateToc = function()
cur_level = this.tagName.substr(1, 1);
if (last_level != 0 && cur_level <= last_level) {
html.push("</li>")
}
if (cur_level > last_level)
{
html.push('<ul><li>');
@ -38,15 +42,11 @@ NodeDoc.generateToc = function()
}
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;
});
html.push('</ul>');
html.push('</li></ul>');
var $toc = $('#toc').append(html.join('')).find('ul li ul').each(function()
{
@ -175,4 +175,4 @@ NodeDoc.setupSmoothScrolling = function()
}
});
};
NodeDoc.init();
NodeDoc.init();

Loading…
Cancel
Save