Move uncategorized snippets to end
This commit is contained in:
@ -52,18 +52,35 @@ try {
|
|||||||
// Add the start static part
|
// Add the start static part
|
||||||
output += `${startPart+'\n'}`;
|
output += `${startPart+'\n'}`;
|
||||||
// Loop over tags and snippets to create the table of contents
|
// Loop over tags and snippets to create the table of contents
|
||||||
|
let uncategorizedOutput = '';
|
||||||
for(let tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
for(let tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
||||||
output +=`### ${capitalize(tag, true)}\n`;
|
if(capitalize(tag, true)=='Uncategorized') {
|
||||||
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
uncategorizedOutput +=`### _${capitalize(tag, true)}_\n`;
|
||||||
output += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()})\n`
|
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
output += '\n';
|
uncategorizedOutput += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()})\n`
|
||||||
|
uncategorizedOutput += '\n';
|
||||||
|
} else {
|
||||||
|
output +=`### ${capitalize(tag, true)}\n`;
|
||||||
|
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
|
output += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()})\n`
|
||||||
|
output += '\n';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
output += uncategorizedOutput;
|
||||||
|
uncategorizedOutput = '';
|
||||||
// Loop over tags and snippets to create the list of snippets
|
// Loop over tags and snippets to create the list of snippets
|
||||||
for(let tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
for(let tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].filter(v => v).sort((a,b) => a.localeCompare(b))){
|
||||||
output +=`## ${capitalize(tag, true)}\n`;
|
if(capitalize(tag, true)=='Uncategorized') {
|
||||||
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
uncategorizedOutput +=`## _${capitalize(tag, true)}_\n`;
|
||||||
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;
|
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
|
uncategorizedOutput += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;
|
||||||
|
} else {
|
||||||
|
output +=`## ${capitalize(tag, true)}\n`;
|
||||||
|
for(let taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
|
||||||
|
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
output += uncategorizedOutput;
|
||||||
// Add the ending static part
|
// Add the ending static part
|
||||||
output += `\n${endPart+'\n'}`;
|
output += `\n${endPart+'\n'}`;
|
||||||
// Write to the README file
|
// Write to the README file
|
||||||
|
|||||||
Reference in New Issue
Block a user