diff --git a/scripts/web.js b/scripts/web.js index 5a5b299b3..340173ebf 100644 --- a/scripts/web.js +++ b/scripts/web.js @@ -107,6 +107,10 @@ try { console.log(`${chalk.red('ERROR!')} During tag database loading: ${err}`); process.exit(1); } +const renderTagAndSnippets = (tag) => { + +} + // Create the output for the index.html file try { // Add the start static part @@ -115,23 +119,7 @@ try { // 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) - .sort((a, b) => a.localeCompare(b))) { - if (capitalize(tag, true) === 'Uncategorized') { - uncategorizedOutput += - `

` + - md - .render(`${capitalize(tag, true)}\n`) - .replace(/

/g, '') - .replace(/<\/p>/g, '') + - `

`; - for (let taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) - uncategorizedOutput += md - .render(`[${taggedSnippet[0]}](#${taggedSnippet[0].toLowerCase()})\n`) - .replace(/

/g, '') - .replace(/<\/p>/g, '') - .replace(/ capitalize(a, true) === 'Uncategorized' ? 1 : capitalize(b, true) === 'Uncategorized' ? -1 : a.localeCompare(b))) { output += `

` + md @@ -146,7 +134,6 @@ try { .replace(/<\/p>/g, '') .replace(/
`; @@ -155,23 +142,7 @@ try { // 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) - .sort((a, b) => a.localeCompare(b))) { - if (capitalize(tag, true) === 'Uncategorized') { - uncategorizedOutput += md - .render(`## ${capitalize(tag, true)}\n`) - .replace(/

/g, '

'); - for (let taggedSnippet of Object.entries(tagDbData).filter(v => v[1][0] === tag)) - uncategorizedOutput += - '
' + - md - .render(`\n${snippets[taggedSnippet[0] + '.md']}`) - .replace(/

/g, `${taggedSnippet[1].includes('advanced')?'advanced':''}

`) - .replace(/
([^\0]*?)<\/code><\/pre>/gm, (match, p1) => `
${Prism.highlight(unescapeHTML(p1), Prism.languages.javascript)}
`) - .replace(/<\/pre>\s+
📋 Copy to clipboard' +
-          '
'; - } else { + .sort((a, b) => capitalize(a, true) === 'Uncategorized' ? 1 : capitalize(b, true) === 'Uncategorized' ? -1 : a.localeCompare(b))) { output += md .render(`## ${capitalize(tag, true)}\n`) .replace(/

/g, '

'); @@ -187,9 +158,7 @@ try { .replace(/<\/pre>\s+
📋 Copy to clipboard' +
           '';
-    }
   }
-  output += uncategorizedOutput;
   // Add the ending static part
   output += `\n${endPart + '\n'}`;
   // Optimize punctuation nodes