|
|
|
@ -7,7 +7,8 @@ import { |
|
|
|
|
} from "./types"; |
|
|
|
|
type HTMLContent = string; |
|
|
|
|
|
|
|
|
|
export const htmlTemplate = (content: HTMLContent) => ` |
|
|
|
|
export const htmlTemplate = (content: HTMLContent) => { |
|
|
|
|
return ` |
|
|
|
|
<!DOCTYPE html> |
|
|
|
|
<html lang="en"> |
|
|
|
|
<head> |
|
|
|
@ -22,7 +23,8 @@ export const htmlTemplate = (content: HTMLContent) => ` |
|
|
|
|
${content} |
|
|
|
|
</body> |
|
|
|
|
</html> |
|
|
|
|
`;
|
|
|
|
|
` |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export const template = ( |
|
|
|
|
name: string, |
|
|
|
@ -69,7 +71,6 @@ export const template = ( |
|
|
|
|
<p>Returns:</p> |
|
|
|
|
|
|
|
|
|
${renderParameterDocumentation(item.outputs)} |
|
|
|
|
|
|
|
|
|
` |
|
|
|
|
) |
|
|
|
|
.join("\n")} |
|
|
|
@ -77,22 +78,11 @@ export const template = ( |
|
|
|
|
</div> |
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
// const contractDocTemplate: TemplateDoc<ContractDoc> = {
|
|
|
|
|
// author: (author: string) => '',//`Author: ${author}`,
|
|
|
|
|
// details: (details: string) => `<p class="lead text-muted">${details}</p>`,
|
|
|
|
|
// title: (title: string) => {
|
|
|
|
|
// return title ?
|
|
|
|
|
// `<small>${title}</small>`
|
|
|
|
|
// : ''
|
|
|
|
|
// },
|
|
|
|
|
// notice: (notice: string) => `<p class="lead text-muted">${notice}</p>`,
|
|
|
|
|
// methods: () => '' // Methods is managed by getMethod()
|
|
|
|
|
// }
|
|
|
|
|
const devMethodDocTemplate: Partial<TemplateDoc<MethodDoc>> = { |
|
|
|
|
author: (author: string) => `<p>Created By ${author}</p>`, |
|
|
|
|
details: (details: string) => `<p>${details}</p>`, |
|
|
|
|
return: (value: string) => `<p>Return : ${value}</p>`, |
|
|
|
|
notice: (notice: string) => `<p>${notice}</p>`, |
|
|
|
|
notice: (notice: string) => notice ? `<p>${notice}</p>` : '', |
|
|
|
|
// returns: () => '', // Implemented by getParams()
|
|
|
|
|
params: () => "", // Implemented by getParams()
|
|
|
|
|
}; |
|
|
|
@ -114,11 +104,9 @@ export const renderHeader = ( |
|
|
|
|
|
|
|
|
|
export const renderParameterDocumentation = ( |
|
|
|
|
parameters: ParameterDocumentation[] |
|
|
|
|
) => ` |
|
|
|
|
${ |
|
|
|
|
) => `${ |
|
|
|
|
parameters.length > 0 |
|
|
|
|
? ` |
|
|
|
|
<table class="table table-sm table-bordered table-striped"> |
|
|
|
|
? `<table class="table table-sm table-bordered table-striped">
|
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<th>Name</th> |
|
|
|
@ -133,12 +121,11 @@ export const renderParameterDocumentation = ( |
|
|
|
|
<td>${output.type}</td> |
|
|
|
|
<td>${output.description}</td> |
|
|
|
|
</tr>` |
|
|
|
|
)} |
|
|
|
|
).join("")} |
|
|
|
|
</tbody> |
|
|
|
|
</table>` |
|
|
|
|
: "<p>No parameters</p>" |
|
|
|
|
} |
|
|
|
|
`;
|
|
|
|
|
}`;
|
|
|
|
|
|
|
|
|
|
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => { |
|
|
|
|
return !devMethod |
|
|
|
|