in static/js/com/toc.js [98:139]
__create: function (list, from, to) {
var that = this;
var createLinks = that.createLinks;
var ul, li, a, title;
var section, sectionContent;
var css = that.cssClasses;
var i, len;
if (list.length == 0) {
return null;
}
ul = document.createElement('ul');
ul.className = css.tocList;
for (i = 0, len = list.length; i < len; i++) {
section = list[i];
li = document.createElement('li');
li.className = css.tocListItem.replace('#', section.level);
if (createLinks) {
title = document.createElement('a');
title.href = "#" + section.id;
title.appendChild(document.createTextNode(section.title));
}
else {
title = document.createTextNode(section.title);
}
li.appendChild(title);
if (section.content.length > 0 &&
section.content[0].level >= from &&
section.content[0].level <= to) {
sectionContent = that.__create(section.content, from, to);
li.appendChild(sectionContent);
}
ul.appendChild(li);
}
return ul;
},