diff --git a/Client/httpInterface.js b/Client/httpInterface.js index d9bdeb903..fdc397241 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -468,7 +468,14 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE schemaDocument.created = undefined let fileContent = JSON.stringify(schemaDocument, undefined, 4) fs.writeFileSync(filePath + '/' + fileName, fileContent) - console.log('[SUCCESS] ' + filePath + '/' + fileName + ' updated.') + if (schemaDocument.created === true) { + console.log('[SUCCESS] ' + filePath + '/' + fileName + ' created.') + return + } + if (schemaDocument.updated === true) { + console.log('[SUCCESS] ' + filePath + '/' + fileName + ' updated.') + return + } } catch (err) { console.log('[ERROR] httpInterface -> Docs -> Save -> ' + filePath + '/' + fileName + ' could not be created / updated.') console.log('[ERROR] httpInterface -> Docs -> Save -> Dont worry, the changes are still at the UI, but you will need to do 2 things: 1) Resolve the issue that is preventing the Client to write this file. Look at the error message below as a guide. 2) At the UI, locate this page and edit it with some small change again, so that is flagged that contains changes, otherwise those original changes will be ignored by the Client during the next docs.save command execution.') diff --git a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json b/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json deleted file mode 100644 index 30971fa93..000000000 --- a/Projects/Superalgos/Schemas/Docs-Concepts/vaina.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "Vaina", - "definition": { - "text": "Write here the summary / definition of this Concept." - }, - "paragraphs": [ - { - "style": "Text", - "text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode." - }, - { - "style": "Hierarchy", - "text": "Superalgos->Trading System->5", - "updated": 1610353697255 - } - ] -} \ No newline at end of file diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js index 4489ff16f..10999ddb9 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/ContextMenu.js @@ -425,7 +425,7 @@ function newSuperalgosDocsContextMenu() { return true } if (paragraphNode.id.indexOf('-table') >= 0) { - selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseTable(paragraphNode.innerHTML) + selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseTable(paragraphNode) return true } if (paragraphNode.id.indexOf('-hierarchy') >= 0) { diff --git a/Projects/Superalgos/UI/Utilities/Docs.js b/Projects/Superalgos/UI/Utilities/Docs.js index 4b05bf732..839222a9c 100644 --- a/Projects/Superalgos/UI/Utilities/Docs.js +++ b/Projects/Superalgos/UI/Utilities/Docs.js @@ -15,7 +15,7 @@ function newSuperalgosUtilitiesDocs() { reverseParseHierarchy: reverseParseHierarchy, reverseParseTable: reverseParseTable, addBold: addBold, - addKeyboard: addKeyboard, + addKeyboard: addKeyboard, addCodeToCamelCase: addCodeToCamelCase, addCodeToWhiteList: addCodeToWhiteList, addItalics: addItalics, @@ -220,36 +220,50 @@ function newSuperalgosUtilitiesDocs() { return splittedHTML[3] } - function reverseParseTable(HTML) { - text = removeRGB(HTML) + function reverseParseTable(paragraphNode) { - /* Single occurrance replacements */ - text = text.replace(' ', '') - text = text.replace('
', '') - text = text.replace('', '') - text = text.replace('', '') - text = text.replace('', '') - text = text.replace('', '') + let tableNode = paragraphNode.childNodes[0] + let thead + let tbody + let result = '' - /* All instances replacements */ - text = text.replaceAll('', '') - text = text.replaceAll('', '') - text = text.replaceAll('', '|') - text = text.replaceAll('', '|') - text = text.replaceAll('', '|') - text = text.replaceAll('', '|') - text = text.replaceAll('', '|') - text = text.replaceAll('', '|') - text = text.replaceAll('', '') + for (let i = 0; i < tableNode.childNodes.length; i++) { + let childNode = tableNode.childNodes[i] + if (childNode.nodeName === "THEAD") { + thead = childNode + } + if (childNode.nodeName === "TBODY") { + tbody = childNode + } + } + if (thead !== undefined) { processTRs(thead) } + if (tbody !== undefined) { processTRs(tbody) } + + function processTRs(TRs) { + for (let i = 0; i < TRs.childNodes.length; i++) { + let TR = TRs.childNodes[i] + for (let j = 0; j < TR.childNodes.length; j++) { + let TD = TR.childNodes[j] + if (TD.innerText.trim() === "") { + let RGB = removeRGB(TD.innerHTML) + result = result + '|' + RGB + } else { + result = result + '|' + TD.innerText + } + } + result = result + '|' + } + } /* We break lines where needed */ - text = text.replaceAll('||', '|' + String.fromCharCode(10) + '|') - return text.trim() + result = result.replaceAll('||', '|' + String.fromCharCode(10) + '|') + return result.trim() function removeRGB(HTML) { let text = HTML text = text.replaceAll('
   
', '') + text = text.replaceAll(' ', '') return text.trim() } } @@ -278,53 +292,53 @@ function newSuperalgosUtilitiesDocs() { for (let i = 0; i < splittedText.length; i++) { let word = splittedText[i] if ( - word === 'Ctrl' || - word === 'Alt' || + word === 'Ctrl' || + word === 'Alt' || word === 'Shift' || - word === 'Cmd' || - word === 'F1' || - word === 'F2' || - word === 'F3' || - word === 'F4' || - word === 'F5' || - word === 'F6' || - word === 'F7' || - word === 'F8' || - word === 'F9' || - word === 'F10' || - word === 'F11' || - word === 'F12' || + word === 'Cmd' || + word === 'F1' || + word === 'F2' || + word === 'F3' || + word === 'F4' || + word === 'F5' || + word === 'F6' || + word === 'F7' || + word === 'F8' || + word === 'F9' || + word === 'F10' || + word === 'F11' || + word === 'F12' || word === 'Del' || - word === '←' || - word === '→' || - word === '↑' || - word === '↓' || - word === 'Key-A' || + word === '←' || + word === '→' || + word === '↑' || + word === '↓' || + word === 'Key-A' || word === 'Key-B' || word === 'Key-C' || - word === 'Key-D' || + word === 'Key-D' || word === 'Key-E' || word === 'Key-F' || - word === 'Key-G' || + word === 'Key-G' || word === 'Key-H' || word === 'Key-I' || - word === 'Key-J' || + word === 'Key-J' || word === 'Key-K' || word === 'Key-L' || - word === 'Key-M' || + word === 'Key-M' || word === 'Key-N' || word === 'Key-O' || - word === 'Key-P' || + word === 'Key-P' || word === 'Key-Q' || word === 'Key-R' || word === 'Key-S' || // S - word === 'Key-T' || + word === 'Key-T' || word === 'Key-U' || - word === 'Key-V' || + word === 'Key-V' || word === 'Key-W' || word === 'Key-X' || - word === 'Key-Y' || - word === 'Key-Z' + word === 'Key-Y' || + word === 'Key-Z' ) { word = '' + word + '' }