-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathformat.js
139 lines (127 loc) · 3.21 KB
/
format.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/* eslint-disable no-unused-vars */
const test = [
{
id: 'WOQLClient',
longname: 'WOQLClient',
name: 'WOQLClient',
kind: 'class',
scope: 'global',
license: 'Apache Version 2',
meta: {
lineno: 11,
filename: 'woqlClient.js',
path: '/var/www/html/terminusdb-client/lib',
},
order: 0,
},
{
id: 'WOQLClient#copy',
longname: 'WOQLClient#copy',
name: 'copy',
kind: 'function',
scope: 'instance',
description: 'Creates a copy of the current client with a new connection Config',
memberof: 'WOQLClient',
returns: [
{
type: {
names: ['WOQLClient'],
},
},
],
meta: {
lineno: 39,
filename: 'woqlClient.js',
path: '/var/www/html/terminusdb-client/lib',
},
order: 2,
},
];
/* exports.orphans = function(options) {
//const parentData=
// options.data.root=options.data.root.slice(0,4)
options.data.root= options.data.root.slice(0,4)
return options.fn(options)
} */
exports.addAnchor = function (options) {
if (this.kind === 'constructor') return false;
return true;
};
exports.addSigName = function (options) {
if (this.kind === 'group') return false;
return true;
};
exports.getSigType = function () {
let outputString = ` \` ${this.type.names[0]}\``;
if (this.type.names.length === 1) return outputString;
// eslint-disable-next-line no-plusplus
for (let index = 1; index < this.type.names.length; index++) {
const element = this.type.names[index];
outputString += ` | \` ${element} \` `;
}
return outputString;
};
exports.ifKindTypeDef = function () {
if (this.kind === 'typedef') {
return true;
}
return false;
};
exports.makeAnchor = function (anchorName) {
if (typeof anchorName === 'string') {
const arr = anchorName.split(/\+|\./);
if (arr.length === 2) {
return arr[1];
}
}
// removing module_ from header
if (this.kind === 'module' && anchorName.includes('module_')) {
return anchorName.substr(7);
} if (this.kind === 'typedef' && anchorName.includes('module_TypeDef..')) {
return anchorName.substr(16);
}
return anchorName;
};
exports.docsFilter = function (data, options) {
// const parentData=
// options.data.root=options.data.root.slice(0,4)
// data.root= data.root.slice(0,4)
// return options.fn(options)
return JSON.stringify(data);
};
exports.testData = function (options) {
// if (this.testData) {
// const tt=this.testData.slice(0,4)
// options.context(tt)
return options.fn({ name: 'hello', test: 'hhhhhhh' });
// }
};
/**
* add only the not deprecated in the menu
*/
exports.isDeprecated = function () {
if (this.deprecated === undefined) return true;
return false;
};
exports.navItemAnchor = function () {
if (typeof this.label === 'string') {
const anchorName = this.label.replace(/ /g, '-');
return anchorName.toLowerCase();
}
return this.name;
};
let indentItemSub = false;
exports.indentItem = function (options) {
if (this.kind === 'class' || this.kind === 'module') {
indentItemSub = false;
return '';
}
if (this.kind === 'group') {
indentItemSub = true;
return ' ';
}
if (indentItemSub) {
return ' ';
}
return ' ';
};