diff --git a/lib/mdProcessor.js b/lib/mdProcessor.js index 54130fb..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); @@ -896,7 +898,6 @@ function generateTOCs( logger); } } catch (e) { - console.log(e); logger.warning("Excluded from toc generation because no corresponding destination folder found: " + sourcePath); } } @@ -978,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( @@ -1060,7 +1061,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); @@ -1352,13 +1352,13 @@ 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' }; } else { - // navgroup with only an array of references + // navgroup with only an array of references if (level === 2 && i === 0) { computedAttributes = { class: 'navgroup',