40 lines
807 B
Plaintext
40 lines
807 B
Plaintext
<%
|
|
|
|
function layoutTocBody() {
|
|
if (toc(page.content).length > 0) {
|
|
return toc(page.content, {
|
|
list_number: item.list_number,
|
|
min_depth: item.min_depth,
|
|
max_depth: item.max_depth
|
|
})
|
|
}
|
|
return ''
|
|
}
|
|
|
|
function layoutTocHeader(title) {
|
|
var el = ''
|
|
el += `<div class="widget-header dis-select">`
|
|
el += `<span class="name">${title || __("meta.toc")}</span>`
|
|
el += `</div>`
|
|
return el
|
|
}
|
|
|
|
function layoutDiv(fallback) {
|
|
const tocBody = layoutTocBody()
|
|
if (tocBody.length == 0) {
|
|
return ''
|
|
}
|
|
var el = ''
|
|
el += `<widget class="widget-wrapper${scrollreveal(' ')} toc" id="data-toc" collapse="${item.collapse}">`
|
|
el += layoutTocHeader()
|
|
el += `<div class="widget-body">`
|
|
el += tocBody
|
|
el += `</div>`
|
|
el += `</widget>`
|
|
return el
|
|
}
|
|
|
|
%>
|
|
|
|
<%- layoutDiv() %>
|