mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49:24 +02:00
indent fix
This commit is contained in:
parent
301aba06a3
commit
a048f6f7d5
1 changed files with 176 additions and 183 deletions
|
@ -100,7 +100,8 @@ const html_reg_returnSize = /<h5>Returns:<\/h5>/g;
|
||||||
const html_reg_returnSize_replace = '<h6>Returns:<\/h6>';
|
const html_reg_returnSize_replace = '<h6>Returns:<\/h6>';
|
||||||
const html_reg_depreciated = /(<dt class="important tag-deprecated"[\s\S]+?<\/dt>[\s\S]+?)(<dd>)([\s\S]+?<ul[\s\S]+?<li>)([\s\S]+?)(<\/ul>[\s\S]+?)(<\/dd>)/g;
|
const html_reg_depreciated = /(<dt class="important tag-deprecated"[\s\S]+?<\/dt>[\s\S]+?)(<dd>)([\s\S]+?<ul[\s\S]+?<li>)([\s\S]+?)(<\/ul>[\s\S]+?)(<\/dd>)/g;
|
||||||
const html_reg_depreciated_replace = '<em><strong>$1</strong><div>$4</div></em>'
|
const html_reg_depreciated_replace = '<em><strong>$1</strong><div>$4</div></em>'
|
||||||
// Procedural functions
|
|
||||||
|
// Procedural functions
|
||||||
|
|
||||||
//remove .html from non http links
|
//remove .html from non http links
|
||||||
function removeHTML(match, p1, p2, p3) {
|
function removeHTML(match, p1, p2, p3) {
|
||||||
|
@ -329,8 +330,8 @@ function makeGroupTOC(group) {
|
||||||
return htmlGroup.join("\n");
|
return htmlGroup.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle Class TOCS
|
// Handle Class TOCS
|
||||||
function makeClassTOC(group){
|
function makeClassTOC(group){
|
||||||
let linkArray = []
|
let linkArray = []
|
||||||
group.forEach( item => {
|
group.forEach( item => {
|
||||||
linkArray.push(`<div><h5>${item.type}</h5></div>`)
|
linkArray.push(`<div><h5>${item.type}</h5></div>`)
|
||||||
|
@ -345,10 +346,10 @@ function makeGroupTOC(group) {
|
||||||
linkArray.push("<br>");
|
linkArray.push("<br>");
|
||||||
})
|
})
|
||||||
return linkArray.join("\n");
|
return linkArray.join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract IDS for TOC
|
// Extract IDS for TOC
|
||||||
function extractIDs(groupToExtract){
|
function extractIDs(groupToExtract){
|
||||||
let firstLine = "";
|
let firstLine = "";
|
||||||
let id = "";
|
let id = "";
|
||||||
let extractedIDs = [];
|
let extractedIDs = [];
|
||||||
|
@ -364,12 +365,12 @@ function makeGroupTOC(group) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return extractedIDs;
|
return extractedIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper for splitting up html
|
// Helper for splitting up html
|
||||||
// Takes: Content to split, SearchTerm to Split by, and term to End Splitting By
|
// Takes: Content to split, SearchTerm to Split by, and term to End Splitting By
|
||||||
// Returns: [newContent after Split, Array of extracted ]
|
// Returns: [newContent after Split, Array of extracted ]
|
||||||
function splitBy(content, searchTerm, endSplitTerm, title){
|
function splitBy(content, searchTerm, endSplitTerm, title){
|
||||||
let foundArray = [];
|
let foundArray = [];
|
||||||
let curIndex = -1;
|
let curIndex = -1;
|
||||||
let afterCurSearchIndex = -1
|
let afterCurSearchIndex = -1
|
||||||
|
@ -424,10 +425,10 @@ function makeGroupTOC(group) {
|
||||||
content = append(content, html_reg_findByArticleClose, classHeader, true);
|
content = append(content, html_reg_findByArticleClose, classHeader, true);
|
||||||
}
|
}
|
||||||
return [content, foundArray];
|
return [content, foundArray];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split the signals and methods [Might make this more generic]
|
// Split the signals and methods [Might make this more generic]
|
||||||
function splitMethodsSignals(allItemToSplit){
|
function splitMethodsSignals(allItemToSplit){
|
||||||
let methodArray = [];
|
let methodArray = [];
|
||||||
let signalArray = [];
|
let signalArray = [];
|
||||||
|
|
||||||
|
@ -441,22 +442,22 @@ function makeGroupTOC(group) {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return [methodArray, signalArray];
|
return [methodArray, signalArray];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to append
|
// Helper to append
|
||||||
// Takes content, the search term to appendTo, the content to append,
|
// Takes content, the search term to appendTo, the content to append,
|
||||||
// and bool if the append is before the found area
|
// and bool if the append is before the found area
|
||||||
function append(content, searchTermToAppendto, contentToAppend, appendBefore){
|
function append(content, searchTermToAppendto, contentToAppend, appendBefore){
|
||||||
let contentArray = content.split("\n");
|
let contentArray = content.split("\n");
|
||||||
let foundIndex = findArrayTrim(contentArray, searchTermToAppendto)
|
let foundIndex = findArrayTrim(contentArray, searchTermToAppendto)
|
||||||
foundIndex = appendBefore ? foundIndex : foundIndex +1
|
foundIndex = appendBefore ? foundIndex : foundIndex +1
|
||||||
|
|
||||||
contentArray.splice(foundIndex,0,contentToAppend)
|
contentArray.splice(foundIndex,0,contentToAppend)
|
||||||
return contentArray.join("\n")
|
return contentArray.join("\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for append
|
// Helper function for append
|
||||||
function findArrayTrim(array, searchTerm){
|
function findArrayTrim(array, searchTerm){
|
||||||
var index = -1;
|
var index = -1;
|
||||||
for (var i = 0; i < array.length; i++){
|
for (var i = 0; i < array.length; i++){
|
||||||
index = array[i].trim().indexOf(searchTerm.trim());
|
index = array[i].trim().indexOf(searchTerm.trim());
|
||||||
|
@ -465,7 +466,7 @@ function makeGroupTOC(group) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove grav directory if exists to make sure old files aren't kept
|
// Remove grav directory if exists to make sure old files aren't kept
|
||||||
if (fs.existsSync(dir_grav)){
|
if (fs.existsSync(dir_grav)){
|
||||||
|
@ -486,10 +487,8 @@ baseMDDirectories.forEach( md => {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Read jsdoc output folder and process html files
|
// Read jsdoc output folder and process html files
|
||||||
let links = [];
|
|
||||||
let unTouchedLinks = [];
|
|
||||||
|
|
||||||
let files = fs.readdirSync(dir_out);
|
let files = fs.readdirSync(dir_out);
|
||||||
|
|
||||||
// Create initial Group name member map to handle individual link
|
// Create initial Group name member map to handle individual link
|
||||||
files.forEach(function (file){
|
files.forEach(function (file){
|
||||||
let curSource = path.join(dir_out, file);
|
let curSource = path.join(dir_out, file);
|
||||||
|
@ -534,7 +533,6 @@ files.forEach(function (file, index){
|
||||||
.replace(html_reg_static,"") // Remove static from the file names
|
.replace(html_reg_static,"") // Remove static from the file names
|
||||||
.replace(html_reg_title,"") // Remove title
|
.replace(html_reg_title,"") // Remove title
|
||||||
.replace(html_reg_objectHeader,"") // Remove extra Object Header
|
.replace(html_reg_objectHeader,"") // Remove extra Object Header
|
||||||
// .replace(html_reg_htmlExt,"")
|
|
||||||
.replace(html_reg_dlClassDetails, "") // Remove unneccsary dlClassDetails Tag
|
.replace(html_reg_dlClassDetails, "") // Remove unneccsary dlClassDetails Tag
|
||||||
.replace(html_reg_allNonHTTPLinks, removeHTML) // Remove the .html extension from all links
|
.replace(html_reg_allNonHTTPLinks, removeHTML) // Remove the .html extension from all links
|
||||||
.replace(html_reg_allNonHTTPLinks, allLinksToLowerCase) // Turn all links into lowercase before ID tags
|
.replace(html_reg_allNonHTTPLinks, allLinksToLowerCase) // Turn all links into lowercase before ID tags
|
||||||
|
@ -582,7 +580,6 @@ files.forEach(function (file, index){
|
||||||
let splitMethods = processedMethodsSignalsAndTypeDefs[0];
|
let splitMethods = processedMethodsSignalsAndTypeDefs[0];
|
||||||
let splitSignals = processedMethodsSignalsAndTypeDefs[1];
|
let splitSignals = processedMethodsSignalsAndTypeDefs[1];
|
||||||
let splitTypeDefinitionIDS;
|
let splitTypeDefinitionIDS;
|
||||||
// let splitDescription = processedMethodsSignalsAndTypeDefs[3];
|
|
||||||
let splitMethodIDS = extractIDs(splitMethods);
|
let splitMethodIDS = extractIDs(splitMethods);
|
||||||
let splitSignalIDS = extractIDs(splitSignals);
|
let splitSignalIDS = extractIDs(splitSignals);
|
||||||
if (foundTypeDefinitions){
|
if (foundTypeDefinitions){
|
||||||
|
@ -590,12 +587,9 @@ files.forEach(function (file, index){
|
||||||
}
|
}
|
||||||
let arrayToPassToClassToc = [];
|
let arrayToPassToClassToc = [];
|
||||||
|
|
||||||
// if (splitDescription) {
|
|
||||||
// currentContent = append(currentContent, html_reg_containerOverview, splitDescription);
|
|
||||||
// }
|
|
||||||
if (splitMethods.length > 0) {
|
if (splitMethods.length > 0) {
|
||||||
arrayToPassToClassToc.push({type: "Methods", array: splitMethodIDS});
|
arrayToPassToClassToc.push({type: "Methods", array: splitMethodIDS});
|
||||||
// Add the Signals header to the Signals HTML
|
// Add the Methods header to the Methods HTML
|
||||||
splitMethods.unshift(html_reg_findByMethod_replace)
|
splitMethods.unshift(html_reg_findByMethod_replace)
|
||||||
currentContent = append(currentContent, html_reg_findByArticleClose, splitMethods.join('\n'), true);
|
currentContent = append(currentContent, html_reg_findByArticleClose, splitMethods.join('\n'), true);
|
||||||
}
|
}
|
||||||
|
@ -607,7 +601,7 @@ files.forEach(function (file, index){
|
||||||
}
|
}
|
||||||
if (foundTypeDefinitions && foundTypeDefinitions.length > 0) {
|
if (foundTypeDefinitions && foundTypeDefinitions.length > 0) {
|
||||||
arrayToPassToClassToc.push({type: "Type Definitions", array: splitTypeDefinitionIDS});
|
arrayToPassToClassToc.push({type: "Type Definitions", array: splitTypeDefinitionIDS});
|
||||||
// Add the Signals header to the Signals HTML
|
// Add the Type Defs header to the Type Defs HTML
|
||||||
foundTypeDefinitions.unshift(html_reg_typeDefinitonsTitle_replace)
|
foundTypeDefinitions.unshift(html_reg_typeDefinitonsTitle_replace)
|
||||||
currentContent = append(currentContent, html_reg_findByArticleClose, foundTypeDefinitions.join('\n'), true);
|
currentContent = append(currentContent, html_reg_findByArticleClose, foundTypeDefinitions.join('\n'), true);
|
||||||
}
|
}
|
||||||
|
@ -616,7 +610,6 @@ files.forEach(function (file, index){
|
||||||
if (groupName === "Global"){
|
if (groupName === "Global"){
|
||||||
currentContent = append(currentContent, html_reg_findByTitle, classTOC);
|
currentContent = append(currentContent, html_reg_findByTitle, classTOC);
|
||||||
} else if (htmlTitle === "Controller") {
|
} else if (htmlTitle === "Controller") {
|
||||||
// currentContent = currentContent.replace(html_reg_availableIn, "");
|
|
||||||
let curatedList = currentContent.match(html_reg_findControllerCuratedList);
|
let curatedList = currentContent.match(html_reg_findControllerCuratedList);
|
||||||
currentContent = currentContent.replace(html_reg_findControllerCuratedList, "");
|
currentContent = currentContent.replace(html_reg_findControllerCuratedList, "");
|
||||||
let entityMethods = currentContent.match(html_reg_findEntityMethods);
|
let entityMethods = currentContent.match(html_reg_findEntityMethods);
|
||||||
|
|
Loading…
Reference in a new issue