diff --git a/scripts/web.js b/scripts/web.js index 780d97f1e..57a477dca 100644 --- a/scripts/web.js +++ b/scripts/web.js @@ -128,11 +128,7 @@ let snippets = {}, startPart = '', endPart = '', output = '', - archivedStartPart = '', - archivedEndPart = '', archivedOutput = '', - glossaryStartPart = '', - glossaryEndPart = '', glossaryOutput = '', pagesOutput = [], tagDbData = {}; @@ -145,13 +141,11 @@ glossarySnippets = util.readSnippets(glossarySnippetsPath); // Load static parts for all pages try { - [startPart, endPart, archivedStartPart, archivedEndPart, glossaryStartPart, glossaryEndPart] = [ + [startPart, endPart, staticPageStartPart, staticPageEndPart] = [ 'page-start.html', 'page-end.html', - 'archived-page-start.html', - 'archived-page-end.html', - 'glossary-page-start.html', - 'glossary-page-end.html' + 'static-page-start.html', + 'static-page-end.html' ].map(filename => fs.readFileSync(path.join(staticPartsPath, filename), 'utf8')); } catch (err) { // Handle errors (hopefully not!) @@ -243,10 +237,51 @@ try { process.exit(1); } +const staticPageStartGenerator = (staticPart, heading, description) => { + let taggedData = util.prepTaggedData(tagDbData); + // Add the start static part + let htmlCode = `${staticPart}\n`; + + // Loop over tags and snippets to create the table of contents + for (let tag of taggedData) { + htmlCode += + '

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

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