Fixed build script to exclude untagged snippets

This commit is contained in:
Angelos Chalaris
2017-12-14 19:02:15 +02:00
parent 06018e143a
commit cd4d6ba9e8
3 changed files with 15 additions and 5 deletions

View File

@ -52,13 +52,13 @@ catch (err){
try {
output += `${startPart+'\n'}`;
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
for(var 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`;
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
output += `* [${taggedSnippet[0][0].toUpperCase() + taggedSnippet[0].replace(/-/g,' ').slice(1)}](#${taggedSnippet[0].replace(/\(/g,'').replace(/\)/g,'').toLowerCase()})\n`
output += '\n';
}
for(var tag of [...new Set(Object.entries(tagDbData).map(t => t[1]))].sort((a,b) => a.localeCompare(b))){
for(var 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`;
for(var taggedSnippet of Object.entries(tagDbData).filter(v => v[1] === tag))
output += `\n${snippets[taggedSnippet[0]+'.md']+'\n[⬆ back to top](#table-of-contents)\n'}`;