diff --git a/scripts/build.js b/scripts/build.js
index e63ba7101..251b755f9 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -120,70 +120,46 @@ try {
Object.entries(tagDbData)
.map(t => t[1][0])
.filter(v => v)
- .sort((a, b) => a.localeCompare(b))
- )
+ .sort((a, b) => capitalize(a, true) === 'Uncategorized' ? 1 : capitalize(b, true) === 'Uncategorized' ? -1 : a.localeCompare(b)))
];
// Add the start static part
output += `${startPart + '\n'}`;
- let uncategorizedOutput = '';
// Loop over tags and snippets to create the table of contents
for (const tag of tags) {
const capitalizedTag = capitalize(tag, true);
-
- if (capitalizedTag === 'Uncategorized') {
- uncategorizedOutput += `### _${capitalizedTag}_\n\n\nView contents
\n\n`;
- for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
- uncategorizedOutput += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()}${taggedSnippet[1].includes('advanced')?'-':''})\n`;
- }
- uncategorizedOutput += '\n \n\n';
- } else {
- output += `### ${
- EMOJIS[tag] || ''
- } ${capitalizedTag}\n\n\nView contents
\n\n`;
- for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
- output += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()}${taggedSnippet[1].includes('advanced')?'-':''})\n`;
- }
- output += '\n \n\n';
+ output += `### ${
+ EMOJIS[tag] || ''
+ } ${capitalizedTag}\n\n\nView contents
\n\n`;
+ for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
+ output += `* [\`${taggedSnippet[0]}\`](#${taggedSnippet[0].toLowerCase()}${taggedSnippet[1].includes('advanced')?'-':''})\n`;
}
+ output += '\n \n\n';
}
- output += uncategorizedOutput;
- uncategorizedOutput = '';
-
// Loop over tags and snippets to create the list of snippets
for (const tag of tags) {
const capitalizedTag = capitalize(tag, true);
- // 
- if (capitalizedTag === 'Uncategorized') {
- uncategorizedOutput += `---\n ## _${capitalizedTag}_\n`;
- for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
- uncategorizedOutput += `\n${snippets[taggedSnippet[0] + '.md'] +
- '\n
[⬆ back to top](#table-of-contents)\n\n'}`;
- }
- } else {
- output += `---\n ## ${EMOJIS[tag] || ''} ${capitalizedTag}\n`;
- for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
- let data = snippets[taggedSnippet[0] + '.md'];
- // Add advanced tag
- if(taggedSnippet[1].includes('advanced')){
- data = data.split(/\r?\n/);
- data[0] = data[0] +' ';
- data = data.join('\n');
- }
- data =
- data.slice(0, data.lastIndexOf('```js')) +
- '\nExamples
\n\n' +
- data.slice(data.lastIndexOf('```js'), data.lastIndexOf('```')) +
- data.slice(data.lastIndexOf('```')) +
- '\n \n';
- output += `\n${data + '\n
[⬆ Back to top](#table-of-contents)\n\n'}`;
+ output += `---\n ## ${EMOJIS[tag] || ''} ${capitalizedTag}\n`;
+ for (const taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) {
+ let data = snippets[taggedSnippet[0] + '.md'];
+ // Add advanced tag
+ if(taggedSnippet[1].includes('advanced')){
+ data = data.split(/\r?\n/);
+ data[0] = data[0] +' ';
+ data = data.join('\n');
}
+ data =
+ data.slice(0, data.lastIndexOf('```js')) +
+ '\nExamples
\n\n' +
+ data.slice(data.lastIndexOf('```js'), data.lastIndexOf('```')) +
+ data.slice(data.lastIndexOf('```')) +
+ '\n \n';
+ output += `\n${data + '\n
[⬆ Back to top](#table-of-contents)\n\n'}`;
}
}
- output += uncategorizedOutput;
// Add the ending static part
output += `\n${endPart + '\n'}`;
// Write to the README file
diff --git a/scripts/web.js b/scripts/web.js
index 4baddfd87..c3612f7f8 100644
--- a/scripts/web.js
+++ b/scripts/web.js
@@ -80,7 +80,6 @@ tagDbData = util.readTags();
try {
// Add the start static part
output += `${startPart + '\n'}`;
- let uncategorizedOutput = '';
// Loop over tags and snippets to create the table of contents
for (let tag of [...new Set(Object.entries(tagDbData).map(t => t[1][0]))]
.filter(v => v)
@@ -100,10 +99,8 @@ try {
.replace(/`;
output += ` `;
- uncategorizedOutput = '';
// Loop over tags and snippets to create the list of snippets
for (let tag of [...new Set(Object.entries(tagDbData).map(t => t[1][0]))]
.filter(v => v)