TOC html
Jump to navigation
Jump to search
| Line 60: | Line 60: | ||
function walk_through_TOC(children,parent,depth) { | function walk_through_TOC(children,parent,depth) { | ||
| − | |||
if(!children || !Object.keys(children).length) { | if(!children || !Object.keys(children).length) { | ||
return | return | ||
} | } | ||
| + | |||
| + | |||
| + | depth++ | ||
| + | |||
for(var value of children) { | for(var value of children) { | ||
| Line 70: | Line 73: | ||
// '&&' does not work ! | // '&&' does not work ! | ||
if(value.path) { | if(value.path) { | ||
| + | |||
if(value.state.selected) { | if(value.state.selected) { | ||
| − | + | wiki_list.push('#'.repeat(depth) + '[[' + value.path + '|' + value.text + ']]') | |
| + | } | ||
| − | + | } else { | |
| − | + | ||
| − | + | if(value.state.selected) { | |
| − | + | wiki_list.push('#'.repeat(depth) + value.text) | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | wiki_list.push('#'.repeat( | ||
} | } | ||
| + | |||
} | } | ||
| Line 92: | Line 92: | ||
} | } | ||
| + | |||
| + | |||
} | } | ||
| − | |||
var contents = $ci('#TOC_contents').val(); | var contents = $ci('#TOC_contents').val(); | ||
Revision as of 08:57, 1 October 2020