Recursive Including Working

This commit is contained in:
Luis Fernando Molina committed 2020-12-23 13:27:11 +01:00
1 parent 79a6e8c89e
commit 51f3d50af7
6 files changed
+157 -31

No files matched your search

+27 -16
View File
@@ -666,23 +666,34 @@ color: #31708f;
}
.docs-hidden-anchor {
color: #b90d6c;
background-color: #ee6db4;
border-color: #830452;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
margin: 20px 0;
width: 95%;
color: #b90d6c;
background-color: #ee6db4;
border-color: #830452;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
margin: 20px 0;
width: 95%;
}
.docs-hidden-block {
color: #320db9;
background-color: #6d9aee;
border-color: #043783;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
margin: 20px 0;
width: 95%;
}
.docs-hidden-include {
color: #880db9;
background-color: #ea6dee;
border-color: #550483;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
margin: 20px 0;
width: 95%;
color: #880db9;
background-color: #ea6dee;
border-color: #550483;
padding: 15px;
border: 1px solid transparent;
border-radius: 4px;
margin: 20px 0;
width: 95%;
}
+1
View File
@@ -127,6 +127,7 @@
<li class="menu-item" onClick="window.contextMenu.toGif()">Gif Style</li>
<li class="menu-item" onClick="window.contextMenu.toPng()">Png Style</li>
<li class="menu-item" onClick="window.contextMenu.toAnchor()">Anchor</li>
<li class="menu-item" onClick="window.contextMenu.toBlock()">Block</li>
<li class="menu-item" onClick="window.contextMenu.toInclude()">Include</li>
</ul>
@@ -0,0 +1,66 @@
{
"type": "Arbol",
"definition": "Write here the 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": "Text",
"text": "Arbol 1"
},
{
"style": "Text",
"text": "Arbol 2"
},
{
"style": "Text",
"text": "Arbol 3"
},
{
"style": "Include",
"text": "Superalgos->Concept->Casa->Block #1"
},
{
"style": "Text",
"text": "Arbol 4"
},
{
"style": "Text",
"text": "Arbol 5"
},
{
"style": "Text",
"text": "Arbol 6"
},
{
"style": "Text",
"text": "Arbol 7"
},
{
"style": "Text",
"text": "Arbol 8"
},
{
"style": "Text",
"text": "Arbol 9"
},
{
"style": "Text",
"text": "Arbol 10"
},
{
"style": "Text",
"text": "Arbol 11"
},
{
"style": "Text",
"text": "Arbol 12"
},
{
"style": "Text",
"text": ""
}
]
}
@@ -10,9 +10,13 @@
"style": "Text",
"text": "Casa 1"
},
{
"style": "Block",
"text": "Block #1"
},
{
"style": "Include",
"text": "Superalgos->Concept->Vaina->Anchor 1"
"text": "Superalgos->Concept->Vaina->Block #1"
},
{
"style": "Text",
@@ -23,13 +27,17 @@
"text": "Casa 3"
},
{
"style": "Text",
"text": "Casa 4"
"style": "Include",
"text": "Superalgos->Concept->Vaina->Block #2"
},
{
"style": "Text",
"text": "Casa 5"
},
{
"style": "Text",
"text": "Block #1"
},
{
"style": "Text",
"text": "Casa 6"
@@ -41,6 +49,18 @@
{
"style": "Text",
"text": "Casa 8"
},
{
"style": "Text",
"text": "Casa 9"
},
{
"style": "Text",
"text": "Casa 10"
},
{
"style": "Text",
"text": "Casa 11"
}
]
}
@@ -7,8 +7,8 @@
"text": "Left click and Edit to enter edit mode and change this text. ENTER to write new paragraphs. ESC to exit edit mode."
},
{
"style": "Anchor",
"text": "Anchor 1"
"style": "Block",
"text": "Block #1"
},
{
"style": "Text",
@@ -23,8 +23,8 @@
"text": "Vaina Paragraph 3"
},
{
"style": "Anchor",
"text": "Anchor 2"
"style": "Block",
"text": "Block #2"
},
{
"style": "Text",
@@ -81,6 +81,7 @@ function newSuperalgosDocSpace() {
toGif: toGif,
toPng: toPng,
toAnchor: toAnchor,
toBlock: toBlock,
toInclude: toInclude
}
@@ -263,6 +264,13 @@ function newSuperalgosDocSpace() {
renderDocumentPage()
}
function toBlock() {
let docSchemaParagraph = paragraphMap.get(selectedParagraph.id)
docSchemaParagraph.style = 'Block'
contextMenuForceOutClick()
renderDocumentPage()
}
function toInclude() {
let docSchemaParagraph = paragraphMap.get(selectedParagraph.id)
docSchemaParagraph.style = 'Include'
@@ -603,6 +611,9 @@ function newSuperalgosDocSpace() {
if (paragraphNode.id.indexOf('-anchor') >= 0) {
selectedParagraphData = paragraphNode.innerText
}
if (paragraphNode.id.indexOf('-block') >= 0) {
selectedParagraphData = paragraphNode.innerText
}
if (paragraphNode.id.indexOf('-include') >= 0) {
selectedParagraphData = paragraphNode.innerText
}
@@ -1371,6 +1382,10 @@ function newSuperalgosDocSpace() {
documentPoints = documentPoints + thisPhraseCount * 0
break
}
case 'block': {
documentPoints = documentPoints + thisPhraseCount * 0
break
}
case 'include': {
documentPoints = documentPoints + thisPhraseCount * 0
break
@@ -1801,6 +1816,7 @@ function newSuperalgosDocSpace() {
style: "Error",
text: error
}
key = 'error-paragraph-' + paragraphIndex
renderParagraph(paragraph, key)
paragraphIndex++
}
@@ -1820,12 +1836,12 @@ function newSuperalgosDocSpace() {
let project = splittedIncludeText[0]
let category = splittedIncludeText[1]
let type = splittedIncludeText[2]
let anchor
let block
let definition = false
if (splittedIncludeText[3] === 'Definition') {
definition = true
} else {
anchor = splittedIncludeText[3]
block = splittedIncludeText[3]
}
let includedSchemaDocument
@@ -1857,19 +1873,19 @@ function newSuperalgosDocSpace() {
if (definition === true) {
} else {
let anchorFound = false
let blockFound = false
for (let i = 0; i < includedSchemaDocument.paragraphs.length; i++) {
let key = 'included-paragraph-' + paragraphIndex
let paragraph = includedSchemaDocument.paragraphs[i]
if (anchorFound === false) {
if (paragraph.style === "Anchor" && paragraph.text === anchor) {
anchorFound = true
if (blockFound === false) {
if (paragraph.style === "Block" && paragraph.text === block) {
blockFound = true
}
} else {
if (paragraph.style === "Anchor") {
return
if (paragraph.style === "Block") {
return // Expected return without errors
}
if (paragraph.style === "Include") {
renderParagraph(paragraph, key)
@@ -1880,6 +1896,7 @@ function newSuperalgosDocSpace() {
style: "Error",
text: error
}
key = 'error-paragraph-' + paragraphIndex
renderParagraph(paragraph, key)
paragraphIndex++
}
@@ -1889,6 +1906,9 @@ function newSuperalgosDocSpace() {
}
}
}
if (blockFound === false) {
return 'Block ' + block + ' not found.'
}
}
}
}
@@ -2728,6 +2748,14 @@ function newSuperalgosDocSpace() {
innerHTML = paragraph.text
break
}
case 'Block': {
styleClass = 'class="docs-hidden-block"'
prefix = ''
role = ''
key = key + '-block'
innerHTML = paragraph.text
break
}
case 'Include': {
styleClass = 'class="docs-hidden-include"'
prefix = ''