Books implemented

This commit is contained in:
Luis Fernando Molina committed 2021-01-04 13:27:28 +01:00
1 parent a7b08d3a42
commit 48a6af5351
8 files changed
+145 -25

No files matched your search

+6 -1
View File
@@ -921,7 +921,12 @@ text-align: center;
vertical-align: middle;
}
.docs-link {
.docs-external-link {
text-decoration: none;
color: #31708f;
}
.docs-chapter {
text-decoration: none;
color: #31708f;
}
+2 -2
View File
@@ -193,8 +193,8 @@
<div class="menu-item" onClick="window.contextMenu.toHierarchy()">
<img src="Icons/Superalgos/docs-hierarchy-style.png" class="menu-img">
</div>
<div class="menu-item">
<div class="menu-item" onClick="window.contextMenu.toChapter()">
<img src="Icons/Superalgos/docs-chapter-style.png" class="menu-img">
</div>
<div class="menu-item" onClick="window.contextMenu.toError()">
<img src="Icons/Superalgos/docs-error-style.png" class="menu-img">
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

@@ -7,6 +7,10 @@
{
"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": "Chapter",
"text": "Superalgos->Docs Styles"
}
]
}
@@ -0,0 +1,27 @@
{
"type": "The Docs Explained",
"definition": {
"text": "This book will walk you through everything you need to know about the Docs.",
"updated": 1609762580891
},
"paragraphs": [
{
"style": "Chapter",
"text": "Superalgos->I->Docs Basics->Read Chapter I to learn the basics concepts. They are the foundation that will let you understand the commands and styles explained later in this book.",
"updated": 1609763076399
},
{
"style": "Chapter",
"text": "Superalgos->II->Docs Commands->The Docs include a powerful command line interface that allows you to quickly fire commands from the search box. Dive into Chapter II to learn the details of each available command.",
"updated": 1609763122458
},
{
"style": "Chapter",
"text": "Superalgos->III->Docs Commands Errors"
},
{
"style": "Chapter",
"text": "Superalgos->VI->Docs Paragraph Styles"
}
]
}
@@ -45,6 +45,7 @@ function newSuperalgosDocsContextMenu() {
toAnchor: toAnchor,
toBlock: toBlock,
toInclude: toInclude,
toChapter: toChapter,
toSection: toSection,
copyLink: copyLink,
toWebPageLink: toWebPageLink,
@@ -266,6 +267,13 @@ function newSuperalgosDocsContextMenu() {
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
}
function toChapter() {
let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id)
docSchemaParagraph.style = 'Chapter'
forceOutClick()
UI.projects.superalgos.spaces.docsSpace.documentPage.render()
}
function toWebPageLink() {
let docSchemaParagraph = UI.projects.superalgos.spaces.docsSpace.paragraphMap.get(UI.projects.superalgos.spaces.docsSpace.contextMenu.selectedParagraph.id)
docSchemaParagraph.style = 'Link'
@@ -464,6 +472,10 @@ function newSuperalgosDocsContextMenu() {
selectedParagraphData = paragraphNode.innerText.trim()
return true
}
if (paragraphNode.id.indexOf('-chapter') >= 0) {
selectedParagraphData = paragraphNode.innerText.trim()
return true
}
if (paragraphNode.id.indexOf('-link') >= 0) {
selectedParagraphData = UI.projects.superalgos.utilities.docs.reverseParseLink(paragraphNode.innerHTML)
return true
@@ -144,7 +144,7 @@ function newSuperalgosDocsDocumentPage() {
if (UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.category === 'Topic') {
buildOrderedTopicPageIndex()
buildOrderedTopicPageIndex(thisObject.docsSchemaDocument.topic)
generatePreviousAndNextPageNavigation()
/* Topic Title */
titleLabel = thisObject.docsSchemaDocument.topic + ' Topic Content'
@@ -203,12 +203,13 @@ function newSuperalgosDocsDocumentPage() {
}
function buildOrderedTopicPageIndex() {
function buildOrderedTopicPageIndex(topic) {
orderedTopicPageIndexArray = []
let schemaArray = SCHEMAS_BY_PROJECT.get(UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project).array.docsTopicSchema
for (let i = 0; i < schemaArray.length; i++) {
let arrayItem = schemaArray[i]
if (arrayItem.topic === thisObject.docsSchemaDocument.topic) {
if (arrayItem.topic === topic) {
let itemAdded = false
if (orderedTopicPageIndexArray.length === 0) {
orderedTopicPageIndexArray.push(arrayItem)
@@ -269,13 +270,11 @@ function newSuperalgosDocsDocumentPage() {
key = 'auto-generated-index-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Title",
text: "" + arrayItem.type + ""
text: "" + arrayItem.type + ""
}
autoGeneratedParagraphIndex++
HTML = HTML + '<p>' + arrayItem.pageNumber + '. ' +'<a class="docs-link" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Topic' + '\', \'' + arrayItem.type.replace(/'/g, 'AMPERSAND') + '\')">' + paragraph.text + '</a></p>'
HTML = HTML + '<p>' + arrayItem.pageNumber + '. ' + '<a class="docs-link" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\'' + UI.projects.superalgos.spaces.docsSpace.currentDocumentBeingRendered.project + '\', \'' + 'Topic' + '\', \'' + arrayItem.type.replace(/'/g, 'AMPERSAND') + '\')">' + paragraph.text + '</a></p>'
}
HTML = HTML = HTML + '</div>' // END Container for title and index
}
function addContent() {
@@ -285,22 +284,41 @@ function newSuperalgosDocsDocumentPage() {
let key = 'editable-paragraph-' + editableParagraphIndex
let paragraph = thisObject.docsSchemaDocument.paragraphs[i]
if (paragraph.style === "Include") {
renderParagraph(paragraph, key)
editableParagraphIndex++
let error = addIncludedParagraphs(paragraph.text)
if (error !== undefined) {
paragraph = {
style: "Error",
text: error
}
key = 'error-paragraph-' + autoGeneratedParagraphIndex
switch (paragraph.style) {
case "Include": {
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
editableParagraphIndex++
let error = addIncludedParagraphs(paragraph.text)
if (error !== undefined) {
paragraph = {
style: "Error",
text: error
}
key = 'error-paragraph-' + autoGeneratedParagraphIndex
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
}
break
}
case "Chapter": {
renderParagraph(paragraph, key)
editableParagraphIndex++
let error = addChapterIndex(paragraph.text)
if (error !== undefined) {
paragraph = {
style: "Error",
text: error
}
key = 'error-paragraph-' + autoGeneratedParagraphIndex
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
}
break
}
default: {
renderParagraph(paragraph, key)
editableParagraphIndex++
}
} else {
renderParagraph(paragraph, key)
editableParagraphIndex++
}
}
}
@@ -393,6 +411,44 @@ function newSuperalgosDocsDocumentPage() {
}
}
}
function addChapterIndex(chapterText) {
let splittedChapterText = chapterText.split('->')
let project = splittedChapterText[0]
let chapterNumber = splittedChapterText[1]
let chapterName = splittedChapterText[2]
let introText = splittedChapterText[3]
if (project === undefined || chapterNumber === undefined || chapterName === undefined) {
return 'Chapter paragraph style Syntax Error. Some of the required parameters are undefined. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
if (SCHEMAS_BY_PROJECT.get(project) === undefined) {
return 'Chapter paragraph style Syntax Error. The Project <i>' + project + '</i> could not be found. Check the Docs Chapter Style Syntax. This error message will dissapear as soon as you fix the problem.'
}
buildOrderedTopicPageIndex(chapterName)
let key = 'auto-generated-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Title",
text: 'Chapter ' + chapterNumber + ' - ' + chapterName
}
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
if (introText !== undefined) {
let key = 'auto-generated-paragraph-' + autoGeneratedParagraphIndex
paragraph = {
style: "Text",
text: introText
}
renderParagraph(paragraph, key)
autoGeneratedParagraphIndex++
}
generateMultiPageIndex()
}
}
function addImages() {
@@ -1358,6 +1414,14 @@ function newSuperalgosDocsDocumentPage() {
innerHTML = paragraph.text
break
}
case 'Chapter': {
styleClass = 'class="docs-chapter"'
prefix = ''
role = ''
key = key + '-chapter'
innerHTML = paragraph.text
break
}
}
HTML = HTML + '<p><div id="' + key + '" ' + styleClass + ' ' + role + '>' + prefix + ' ' + innerHTML + sufix + '</div></p>'
+9 -1
View File
@@ -190,7 +190,15 @@ function newSuperalgosUtilitiesDocs() {
let HTML = ''
let splittedText = text.split('->')
if (splittedText.length < 1) { return }
HTML = '<a params="' + text + '" href="http://' + splittedText[1] + '" target="_" class="docs-link">' + splittedText[0] + '</a>'
HTML = '<a params="' + text + '" href="http://' + splittedText[1] + '" target="_" class="docs-external-link">' + splittedText[0] + '</a>'
return HTML
}
function parseChapter(text) {
let HTML = ''
let splittedText = text.split('->')
if (splittedText.length < 1) { return }
HTML = '<a params="' + text + '" onClick="UI.projects.superalgos.spaces.docsSpace.navigateTo(\''+ splittedText[0] + '\', \'Topic\', \''+ splittedText[1] +'\')" class="docs-chapter-link">' + splittedText[1] + '</a>'
return HTML
}