From 7b5a676f925043e08de4384c16b1a97ded830314 Mon Sep 17 00:00:00 2001 From: SoftwareAndOutsourcing <5988222+SoftwareAndOutsourcing@users.noreply.github.com> Date: Tue, 29 Jun 2021 00:20:38 +0200 Subject: [PATCH 1/3] Remove log statement --- lib/mdProcessor.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/mdProcessor.js b/lib/mdProcessor.js index 64b5f03..0d7bb51 100755 --- a/lib/mdProcessor.js +++ b/lib/mdProcessor.js @@ -895,7 +895,6 @@ function generateTOCs( logger); } } catch (e) { - console.log(e); logger.warning("Excluded from toc generation because no corresponding destination folder found: " + sourcePath); } } @@ -1059,7 +1058,6 @@ function writeTocFile( } } catch (e) { logger.error("Failed to open file to write: " + tocFilename + "\n" + e.toString()); - console.log(e); } } else { logger.warning("Skipped writing toc file due to a file collision: " + tocFilename); @@ -1355,7 +1353,7 @@ function addYamlTopics( } if (tocItem) { - // last item of the topics tree + // last item of the topics tree if (isLast && i === topics.length - 1) { computedAttributes = { class: 'navgroup-end' From cef3b6c9dc2b42c3336b42ddbf159318c2ccceaf Mon Sep 17 00:00:00 2001 From: SoftwareAndOutsourcing <5988222+SoftwareAndOutsourcing@users.noreply.github.com> Date: Tue, 29 Jun 2021 00:23:03 +0200 Subject: [PATCH 2/3] Fix indentation --- lib/mdProcessor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mdProcessor.js b/lib/mdProcessor.js index 0d7bb51..ccb7d95 100755 --- a/lib/mdProcessor.js +++ b/lib/mdProcessor.js @@ -1359,7 +1359,7 @@ function addYamlTopics( class: 'navgroup-end' }; } else { - // navgroup with only an array of references + // navgroup with only an array of references if (level === 2 && i === 0) { computedAttributes = { class: 'navgroup', From 6c1ee373a3d28d68bf24c244f90c2af4284472a3 Mon Sep 17 00:00:00 2001 From: SoftwareAndOutsourcing <5988222+SoftwareAndOutsourcing@users.noreply.github.com> Date: Fri, 9 Jul 2021 11:30:01 +0200 Subject: [PATCH 3/3] Fix variable scope --- lib/mdProcessor.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/mdProcessor.js b/lib/mdProcessor.js index 25ba29f..8341662 100755 --- a/lib/mdProcessor.js +++ b/lib/mdProcessor.js @@ -287,8 +287,9 @@ function cleanupTempDirs(dir, logger) { logger.warning("Expected folder does not exist: " + dir); return; } + let stat; try { - let stat = fse.statSync(dir); + stat = fse.statSync(dir); if (!stat.isDirectory()) { logger.warning("Expected folder is a file: " + dir); return; @@ -415,8 +416,9 @@ function generateHTML( version ) { const tempDirPath = path.join(destination, FILENAME_TEMP); + let stat; try { - let stat = fse.statSync(tempDirPath); + stat = fse.statSync(tempDirPath); if (!stat.isDirectory()) { try { fse.removeSync(tempDirPath); /* file */ @@ -714,7 +716,7 @@ function writeTempTOCfile(tempDirPath, filename, extension, content, logger) { const tempTOCpath = path.join(tempDirPath, tempTOCfilename); try { const writeTempTOCFd = fse.openSync(tempTOCpath, "w"); - let success = common.writeFile(writeTempTOCFd, Buffer.from(content)); + const success = common.writeFile(writeTempTOCFd, Buffer.from(content)); fse.closeSync(writeTempTOCFd); if (!success) { logger.error("*** Failed to write file: " + tempTOCpath); @@ -977,7 +979,7 @@ function generateTOCs( } if (tocJSON) { - let adapter = new markedIt.tocJSONadapter(); + const adapter = new markedIt.tocJSONadapter(); tocFilename = path.join(destination, FILENAME_TOC_JSON); if (tocFileLines) { tocContent = generateTOC(