@tinymce/moxiedoc
Advanced tools
Comparing version 0.2.0-feature.20220309231308599.sha3b8dd7a to 0.2.0-feature.20220319015008591.sha8390a5d
@@ -5,3 +5,3 @@ "use strict"; | ||
// TODO: we can pass this through later | ||
const baseURL = ''; | ||
const basePath = 'apis/'; | ||
const hasValue = (x) => { | ||
@@ -55,4 +55,4 @@ // empty helper for strings, objects, arrays | ||
const getNameFromFullName = (name) => name.split('.').slice(-1).join(''); | ||
const generateTypeLink = (type) => type.includes('tinymce', 0) ? 'link:' + baseURL + type.toLowerCase() + '.html[' + getNameFromFullName(type) + ']' : type; | ||
const generateDefinedByLink = (definedBy) => 'link:' + baseURL + definedBy.toLowerCase() + '.html[' + getNameFromFullName(definedBy) + ']'; | ||
const generateTypeXref = (type) => type.includes('tinymce', 0) ? 'xref:' + basePath + type.toLowerCase() + '.adoc[' + getNameFromFullName(type) + ']' : type; | ||
const generateDefinedByXref = (definedBy) => 'xref:' + basePath + definedBy.toLowerCase() + '.adoc[' + getNameFromFullName(definedBy) + ']'; | ||
const generateExamples = (examples) => { | ||
@@ -71,3 +71,3 @@ let tmp = '\n==== Examples\n'; | ||
params.forEach((param) => { | ||
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeLink).join(' | ') + ')` - ' + cleanup(param.desc); | ||
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeXref).join(' | ') + ')` - ' + cleanup(param.desc); | ||
}); | ||
@@ -79,3 +79,3 @@ return tmp + '\n'; | ||
ret.types.forEach((type) => { | ||
tmp += '\n* `' + generateTypeLink(type) + '` - ' + cleanup(ret.desc); | ||
tmp += '\n* `' + generateTypeXref(type) + '` - ' + cleanup(ret.desc); | ||
}); | ||
@@ -97,5 +97,5 @@ tmp += '\n'; | ||
tmp += '|' + item.name; | ||
tmp += '|`' + generateTypeLink(item.dataTypes[0]) + '`'; | ||
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -113,5 +113,5 @@ tmp += '|===\n'; | ||
tmp += '|' + item.name; | ||
tmp += '|`' + generateTypeLink(item.dataTypes[0]) + '`'; | ||
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -128,5 +128,5 @@ tmp += '|===\n'; | ||
data.constructors.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + '()]'; | ||
tmp += '|xref:' + item.name + '[' + item.name + '()]'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -143,3 +143,3 @@ tmp += '|===\n'; | ||
data.methods.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|xref:' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -157,5 +157,5 @@ tmp += '|===\n'; | ||
data.events.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + ']'; | ||
tmp += '|xref:' + item.name + '[' + item.name + ']'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -262,3 +262,3 @@ tmp += '|===\n'; | ||
data.borrows.forEach((item) => { | ||
tmp += '\n * link:' + baseURL + item.toLowerCase() + '.html[' + item + ']\n'; | ||
tmp += '\n * xref:' + basePath + item.toLowerCase() + '.adoc[' + item + ']\n'; | ||
}); | ||
@@ -265,0 +265,0 @@ } |
{ | ||
"name": "@tinymce/moxiedoc", | ||
"version": "0.2.0-feature.20220309231308599.sha3b8dd7a", | ||
"version": "0.2.0-feature.20220319015008591.sha8390a5d", | ||
"description": "A tool for generating API documentation", | ||
@@ -5,0 +5,0 @@ "author": "Tiny Technologies, Inc", |
@@ -11,3 +11,3 @@ import { Return } from '../../lib/member'; | ||
// TODO: we can pass this through later | ||
const baseURL = ''; | ||
const basePath = 'apis/'; | ||
@@ -75,7 +75,7 @@ const hasValue = <T>(x: T): x is NonNullable<T> => { | ||
const generateTypeLink = (type: string): string => | ||
type.includes('tinymce', 0) ? 'link:' + baseURL + type.toLowerCase() + '.html[' + getNameFromFullName(type) + ']' : type; | ||
const generateTypeXref = (type: string): string => | ||
type.includes('tinymce', 0) ? 'xref:' + basePath + type.toLowerCase() + '.adoc[' + getNameFromFullName(type) + ']' : type; | ||
const generateDefinedByLink = (definedBy: string) => | ||
'link:' + baseURL + definedBy.toLowerCase() + '.html[' + getNameFromFullName(definedBy) + ']'; | ||
const generateDefinedByXref = (definedBy: string) => | ||
'xref:' + basePath + definedBy.toLowerCase() + '.adoc[' + getNameFromFullName(definedBy) + ']'; | ||
@@ -96,3 +96,3 @@ const generateExamples = (examples: Array<{ content: string }>): string => { | ||
params.forEach((param) => { | ||
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeLink).join(' | ') + ')` - ' + cleanup(param.desc); | ||
tmp += '\n* `' + param.name + ' (' + param.types.map(generateTypeXref).join(' | ') + ')` - ' + cleanup(param.desc); | ||
}); | ||
@@ -105,3 +105,3 @@ return tmp + '\n'; | ||
ret.types.forEach((type) => { | ||
tmp += '\n* `' + generateTypeLink(type) + '` - ' + cleanup(ret.desc); | ||
tmp += '\n* `' + generateTypeXref(type) + '` - ' + cleanup(ret.desc); | ||
}); | ||
@@ -127,5 +127,5 @@ tmp += '\n'; | ||
tmp += '|' + item.name; | ||
tmp += '|`' + generateTypeLink(item.dataTypes[0]) + '`'; | ||
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -146,5 +146,5 @@ tmp += '|===\n'; | ||
tmp += '|' + item.name; | ||
tmp += '|`' + generateTypeLink(item.dataTypes[0]) + '`'; | ||
tmp += '|`' + generateTypeXref(item.dataTypes[0]) + '`'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -164,5 +164,5 @@ tmp += '|===\n'; | ||
data.constructors.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + '()]'; | ||
tmp += '|xref:' + item.name + '[' + item.name + '()]'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -180,3 +180,3 @@ tmp += '|===\n'; | ||
data.methods.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|xref:' + item.name + '[' + item.name + '()]|' + cleanup(item.desc) + '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -197,5 +197,5 @@ tmp += '|===\n'; | ||
data.events.forEach((item) => { | ||
tmp += '|link:#' + item.name + '[' + item.name + ']'; | ||
tmp += '|xref:' + item.name + '[' + item.name + ']'; | ||
tmp += '|' + cleanup(item.desc); | ||
tmp += '|`' + generateDefinedByLink(item.definedBy) + '`\n'; | ||
tmp += '|`' + generateDefinedByXref(item.definedBy) + '`\n'; | ||
}); | ||
@@ -325,3 +325,3 @@ tmp += '|===\n'; | ||
data.borrows.forEach((item) => { | ||
tmp += '\n * link:' + baseURL + item.toLowerCase() + '.html[' + item + ']\n'; | ||
tmp += '\n * xref:' + basePath + item.toLowerCase() + '.adoc[' + item + ']\n'; | ||
}); | ||
@@ -328,0 +328,0 @@ } |
Sorry, the diff of this file is not supported yet
343584