Merge pull request #1109 from Luis-Fernando-Molina/next-version

Contribution: Many Icons moved to inner folders
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-06-08 08:05:59 -04:00
commit 3abeccf920
365 files changed
+130 -89

No files matched your search

+28 -28
View File
@@ -102,94 +102,94 @@
<div id="menu" class="docs-menu-table">
<div class="menu-row">
<div class="menu-item" onClick="window.contextMenu.editParagraph()">
<img src="Icons/Superalgos/docs-action-edit-paragraph.png" class="menu-img" title="Edit">
<img src="Icons/Superalgos/Docs/docs-action-edit-paragraph.png" class="menu-img" title="Edit">
</div>
<div class="menu-item" onClick="window.contextMenu.toTitle()">
<img src="Icons/Superalgos/docs-title-style.png" class="menu-img" title="Title">
<img src="Icons/Superalgos/Docs/docs-title-style.png" class="menu-img" title="Title">
</div>
<div class="menu-item" onClick="window.contextMenu.toSubtitle()">
<img src="Icons/Superalgos/docs-subtitle-style.png" class="menu-img" title="Subtitle">
<img src="Icons/Superalgos/Docs/docs-subtitle-style.png" class="menu-img" title="Subtitle">
</div>
<div class="menu-item" onClick="window.contextMenu.toNote()">
<img src="Icons/Superalgos/docs-note-style.png" class="menu-img" title="Note">
<img src="Icons/Superalgos/Docs/docs-note-style.png" class="menu-img" title="Note">
</div>
<div class="menu-item" onClick="window.contextMenu.toJavascript()">
<img src="Icons/Superalgos/docs-js-code-style.png" class="menu-img" title="Javascript">
<img src="Icons/Superalgos/Docs/docs-js-code-style.png" class="menu-img" title="Javascript">
</div>
<div class="menu-item" onClick="window.contextMenu.toYouTubeVideo()">
<img src="Icons/Superalgos/docs-youtube-video-style.png" class="menu-img" title="Youtube">
<img src="Icons/Superalgos/Docs/docs-youtube-video-style.png" class="menu-img" title="Youtube">
</div>
<div class="menu-item" onClick="window.contextMenu.toBlock()">
<img src="Icons/Superalgos/docs-block-style.png" class="menu-img" title="Block">
<img src="Icons/Superalgos/Docs/docs-block-style.png" class="menu-img" title="Block">
</div>
</div>
<div class="menu-row">
<div class="menu-item" onClick="window.contextMenu.copyLink()">
<img src="Icons/Superalgos/docs-action-copy-to-clipboard.png" class="menu-img" title="Copy">
<img src="Icons/Superalgos/Docs/docs-action-copy-to-clipboard.png" class="menu-img" title="Copy">
</div>
<div class="menu-item" onClick="window.contextMenu.toText()">
<img src="Icons/Superalgos/docs-text-style.png" class="menu-img" title="Text">
<img src="Icons/Superalgos/Docs/docs-text-style.png" class="menu-img" title="Text">
</div>
<div class="menu-item" onClick="window.contextMenu.toList()">
<img src="Icons/Superalgos/docs-list-style.png" class="menu-img" title="List">
<img src="Icons/Superalgos/Docs/docs-list-style.png" class="menu-img" title="List">
</div>
<div class="menu-item" onClick="window.contextMenu.toSuccess()">
<img src="Icons/Superalgos/docs-success-style.png" class="menu-img" title="Success">
<img src="Icons/Superalgos/Docs/docs-success-style.png" class="menu-img" title="Success">
</div>
<div class="menu-item" onClick="window.contextMenu.toJson()">
<img src="Icons/Superalgos/docs-json-code-style.png" class="menu-img" title="Json">
<img src="Icons/Superalgos/Docs/docs-json-code-style.png" class="menu-img" title="Json">
</div>
<div class="menu-item" onClick="window.contextMenu.toGif()">
<img src="Icons/Superalgos/docs-gif-style.png" class="menu-img" title="Gif">
<img src="Icons/Superalgos/Docs/docs-gif-style.png" class="menu-img" title="Gif">
</div>
<div class="menu-item" onClick="window.contextMenu.toInclude()">
<img src="Icons/Superalgos/docs-include-style.png" class="menu-img" title="Include">
<img src="Icons/Superalgos/Docs/docs-include-style.png" class="menu-img" title="Include">
</div>
</div>
<div class="menu-row">
<div class="menu-item" onClick="window.contextMenu.toPlaceholder()">
<img src="Icons/Superalgos/docs-placeholder-style.png" class="menu-img" title="Placeholder">
<img src="Icons/Superalgos/Docs/docs-placeholder-style.png" class="menu-img" title="Placeholder">
</div>
<div class="menu-item" onClick="window.contextMenu.toSummary()">
<img src="Icons/Superalgos/docs-summary-style.png" class="menu-img" title="Summary">
<img src="Icons/Superalgos/Docs/docs-summary-style.png" class="menu-img" title="Summary">
</div>
<div class="menu-item" onClick="window.contextMenu.toCallout()">
<img src="Icons/Superalgos/docs-callout-style.png" class="menu-img" title="Callout">
<img src="Icons/Superalgos/Docs/docs-callout-style.png" class="menu-img" title="Callout">
</div>
<div class="menu-item" onClick="window.contextMenu.toImportant()">
<img src="Icons/Superalgos/docs-important-style.png" class="menu-img" title="Important">
<img src="Icons/Superalgos/Docs/docs-important-style.png" class="menu-img" title="Important">
</div>
<div class="menu-item" onClick="window.contextMenu.toTable()">
<img src="Icons/Superalgos/docs-table-style.png" class="menu-img" title="Table">
<img src="Icons/Superalgos/Docs/docs-table-style.png" class="menu-img" title="Table">
</div>
<div class="menu-item" onClick="window.contextMenu.toPng()">
<img src="Icons/Superalgos/docs-png-style.png" class="menu-img" title="Png">
<img src="Icons/Superalgos/Docs/docs-png-style.png" class="menu-img" title="Png">
</div>
<div class="menu-item" onClick="window.contextMenu.toSection()">
<img src="Icons/Superalgos/docs-section-style.png" class="menu-img" title="Section">
<img src="Icons/Superalgos/Docs/docs-section-style.png" class="menu-img" title="Section">
</div>
</div>
<div class="menu-row">
<div class="menu-item" onClick="window.contextMenu.deleteParagraph()">
<img src="Icons/Superalgos/docs-action-delete-paragraph.png" class="menu-img" title="Delete">
<img src="Icons/Superalgos/Docs/docs-action-delete-paragraph.png" class="menu-img" title="Delete">
</div>
<div class="menu-item" onClick="window.contextMenu.toWebPageLink()">
<img src="Icons/Superalgos/docs-web-page-link-style.png" class="menu-img" title="Link">
<img src="Icons/Superalgos/Docs/docs-web-page-link-style.png" class="menu-img" title="Link">
</div>
<div class="menu-item" onClick="window.contextMenu.toAnchor()">
<img src="Icons/Superalgos/docs-anchor-style.png" class="menu-img" title="Anchor">
<img src="Icons/Superalgos/Docs/docs-anchor-style.png" class="menu-img" title="Anchor">
</div>
<div class="menu-item" onClick="window.contextMenu.toWarning()">
<img src="Icons/Superalgos/docs-warning-style.png" class="menu-img" title="Warning">
<img src="Icons/Superalgos/Docs/docs-warning-style.png" class="menu-img" title="Warning">
</div>
<div class="menu-item" onClick="window.contextMenu.toHierarchy()">
<img src="Icons/Superalgos/docs-hierarchy-style.png" class="menu-img" title="Hierarchy">
<img src="Icons/Superalgos/Docs/docs-hierarchy-style.png" class="menu-img" title="Hierarchy">
</div>
<div class="menu-item" onClick="window.contextMenu.toError()">
<img src="Icons/Superalgos/docs-error-style.png" class="menu-img" title="Error">
<img src="Icons/Superalgos/Docs/docs-error-style.png" class="menu-img" title="Error">
</div>
<div class="menu-item" onClick="window.contextMenu.toChapter()">
<img src="Icons/Superalgos/docs-chapter-style.png" class="menu-img" title="Chapter">
<img src="Icons/Superalgos/Docs/docs-chapter-style.png" class="menu-img" title="Chapter">
</div>
</div>
</div>
+102 -48
View File
@@ -505,68 +505,105 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
for (let i = 0; i < docsSchema.length; i++) {
let schemaDocument = docsSchema[i]
/*
For some type of schemas we will save the file at an extra
folder derived from the document's type.
*/
let extraFolder
let fileName = schemaDocument.type.toLowerCase()
for (let j = 0; j < 10; j++) {
fileName = cleanFileName(fileName)
}
let pageNumber = '00' + schemaDocument.pageNumber
let oldFilePath = filePath
let newFilepath = filePath
switch (category) {
case 'Topic': {
fileName = schemaDocument.topic.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase()
fileName = cleanFileName(fileName)
let extraDir = schemaDocument.topic.split(' ')[0]
createNewDir(filePath + '/' + extraDir)
extraFolder = extraDir + '/' + cleanFileName(schemaDocument.topic)
newFilepath = filePath + '/' + extraFolder
break
}
case 'Tutorial': {
fileName = schemaDocument.tutorial.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase()
fileName = cleanFileName(fileName)
let extraDir = schemaDocument.tutorial.split(' ')[0]
createNewDir(filePath + '/' + extraDir)
extraFolder = extraDir + '/' + cleanFileName(schemaDocument.tutorial)
newFilepath = filePath + '/' + extraFolder
break
}
case 'Review': {
fileName = schemaDocument.review.toLowerCase() + '-' + pageNumber.substring(pageNumber.length - 3, pageNumber.length) + '-' + schemaDocument.type.toLowerCase()
fileName = cleanFileName(fileName)
let extraDir = schemaDocument.review.split(' ')[0]
createNewDir(filePath + '/' + extraDir)
extraFolder = extraDir + '/' + cleanFileName(schemaDocument.review)
newFilepath = filePath + '/' + extraFolder
break
}
case 'Node': {
let extraDir = schemaDocument.type.substring(0, 1)
createNewDir(filePath + '/' + extraDir)
extraFolder = extraDir + '/' + schemaDocument.type.split(' ')[0]
newFilepath = filePath + '/' + extraFolder
break
}
case 'Concept': {
extraFolder = schemaDocument.type.substring(0, 1)
newFilepath = filePath + '/' + extraFolder
break
}
}
fileName = fileName + '.json'
if (schemaDocument.deleted === true) {
try {
fs.unlinkSync(filePath + '/' + fileName)
console.log('[SUCCESS] ' + filePath + '/' + fileName + ' deleted.')
} catch (err) {
noErrorsDuringSaving = false
console.log('[ERROR] httpInterface -> Docs -> Save -> ' + filePath + '/' + fileName + ' could not be deleted.')
console.log('[ERROR] httpInterface -> Docs -> Save -> Resolve the issue that is preventing the Client to delete this file. Look at the error message below as a guide. At the UI you will need to delete this page again in order for the Client to retry next time you execute the docs.save command.')
console.log('[ERROR] httpInterface -> Docs -> Save -> err.stack = ' + err.stack)
fileName = fileName + '.json'
// if (schemaDocument.deleted === true) {
try {
fs.unlinkSync(oldFilePath + '/' + fileName)
console.log('[SUCCESS] ' + newFilepath + '/' + fileName + ' deleted.')
} catch (err) {
noErrorsDuringSaving = false
console.log('[ERROR] httpInterface -> Docs -> Save -> ' + newFilepath + '/' + fileName + ' could not be deleted.')
console.log('[ERROR] httpInterface -> Docs -> Save -> Resolve the issue that is preventing the Client to delete this file. Look at the error message below as a guide. At the UI you will need to delete this page again in order for the Client to retry next time you execute the docs.save command.')
console.log('[ERROR] httpInterface -> Docs -> Save -> err.stack = ' + err.stack)
}
// } else {
// if (schemaDocument.updated === true || schemaDocument.created === true) {
try {
let created = schemaDocument.created
let updated = schemaDocument.updated
schemaDocument.updated = undefined
schemaDocument.created = undefined
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
createNewDir(newFilepath)
fs.writeFileSync(newFilepath + '/' + fileName, fileContent)
if (created === true) {
console.log('[SUCCESS] ' + newFilepath + '/' + fileName + ' created.')
} else {
if (updated === true) {
console.log('[SUCCESS] ' + newFilepath + '/' + fileName + ' updated.')
}
}
} else {
if (schemaDocument.updated === true || schemaDocument.created === true) {
try {
let created = schemaDocument.created
let updated = schemaDocument.updated
schemaDocument.updated = undefined
schemaDocument.created = undefined
let fileContent = JSON.stringify(schemaDocument, undefined, 4)
try {
fs.mkdirSync(filePath)
} catch (err) {
if (err.message.indexOf('file already exists') < 0) {
throw (err)
}
}
fs.writeFileSync(filePath + '/' + fileName, fileContent)
if (created === true) {
console.log('[SUCCESS] ' + filePath + '/' + fileName + ' created.')
} else {
if (updated === true) {
console.log('[SUCCESS] ' + filePath + '/' + fileName + ' updated.')
}
}
} catch (err) {
noErrorsDuringSaving = false
console.log('[ERROR] httpInterface -> Docs -> Save -> ' + filePath + '/' + fileName + ' could not be created / updated.')
console.log('[ERROR] httpInterface -> Docs -> Save -> err.stack = ' + err.stack)
} catch (err) {
noErrorsDuringSaving = false
console.log('[ERROR] httpInterface -> Docs -> Save -> ' + newFilepath + '/' + fileName + ' could not be created / updated.')
console.log('[ERROR] httpInterface -> Docs -> Save -> err.stack = ' + err.stack)
}
// }
//}
function createNewDir(path) {
try {
fs.mkdirSync(path)
} catch (err) {
if (err.message.indexOf('file already exists') < 0) {
throw (err)
}
}
}
@@ -1531,17 +1568,32 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
break
}
}
getAllFilesInDirectoryAndSubdirectories(filePath + folder, onFilesReady)
function onFilesReady(files) {
let schemaArray = []
let fileList = fs.readdirSync(filePath + '/' + folder)
for (let k = 0; k < fileList.length; k++) {
let name = fileList[k]
let fileContent = fs.readFileSync(filePath + '/' + folder + '/' + name)
let schemaDocument = JSON.parse(fileContent)
schemaArray.push(schemaDocument)
let schemaArray = []
// let fileList = fs.readdirSync(filePath + '/' + folder)
for (let k = 0; k < files.length; k++) {
let name = files[k]
let nameSplitted = name.split(folder)
let fileName = nameSplitted[1]
for (let i = 0; i < 10; i++) {
fileName = fileName.replace('\\', '/')
}
let fileToRead = filePath + folder + fileName
let fileContent = fs.readFileSync(fileToRead)
let schemaDocument = JSON.parse(fileContent)
schemaArray.push(schemaDocument)
}
let schema = JSON.stringify(schemaArray)
respondWithContent(schema, httpResponse)
}
let schema = JSON.stringify(schemaArray)
respondWithContent(schema, httpResponse)
// console.log(filePath + '/' + folder)
} catch (err) {
if (err.message.indexOf('no such file or directory') < 0) {
console.log('Could not send Schema:', filePath, schemaType)
@@ -1752,7 +1804,9 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
callback(pathAndNames)
})
.catch(e => console.error(e));
.catch(e => {
callback([])
});
async function getFiles(dir) {
const subdirs = await readdir(dir);
File renamed without changes.
Loaded 100 of 365 files, more files were not shown because too many files have changed in this diff. Show more