|
|
@ -7,22 +7,24 @@ import { |
|
|
|
} from "./types"; |
|
|
|
} from "./types"; |
|
|
|
type HTMLContent = string; |
|
|
|
type HTMLContent = string; |
|
|
|
|
|
|
|
|
|
|
|
export const htmlTemplate = (content: HTMLContent) => ` |
|
|
|
export const htmlTemplate = (content: HTMLContent) => { |
|
|
|
<!DOCTYPE html> |
|
|
|
return ` |
|
|
|
<html lang="en"> |
|
|
|
<!DOCTYPE html> |
|
|
|
<head> |
|
|
|
<html lang="en"> |
|
|
|
<meta charset="utf-8" /> |
|
|
|
<head> |
|
|
|
<meta |
|
|
|
<meta charset="utf-8" /> |
|
|
|
name="description" |
|
|
|
<meta |
|
|
|
content="Web site created with EthDoc" |
|
|
|
name="description" |
|
|
|
/> |
|
|
|
content="Web site created with EthDoc" |
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> |
|
|
|
/> |
|
|
|
</head> |
|
|
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous"> |
|
|
|
<body> |
|
|
|
</head> |
|
|
|
${content} |
|
|
|
<body> |
|
|
|
</body> |
|
|
|
${content} |
|
|
|
</html> |
|
|
|
</body> |
|
|
|
`;
|
|
|
|
</html> |
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export const template = ( |
|
|
|
export const template = ( |
|
|
|
name: string, |
|
|
|
name: string, |
|
|
@ -69,7 +71,6 @@ export const template = ( |
|
|
|
<p>Returns:</p> |
|
|
|
<p>Returns:</p> |
|
|
|
|
|
|
|
|
|
|
|
${renderParameterDocumentation(item.outputs)} |
|
|
|
${renderParameterDocumentation(item.outputs)} |
|
|
|
|
|
|
|
|
|
|
|
` |
|
|
|
` |
|
|
|
) |
|
|
|
) |
|
|
|
.join("\n")} |
|
|
|
.join("\n")} |
|
|
@ -77,22 +78,11 @@ export const template = ( |
|
|
|
</div> |
|
|
|
</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>> = { |
|
|
|
const devMethodDocTemplate: Partial<TemplateDoc<MethodDoc>> = { |
|
|
|
author: (author: string) => `<p>Created By ${author}</p>`, |
|
|
|
author: (author: string) => `<p>Created By ${author}</p>`, |
|
|
|
details: (details: string) => `<p>${details}</p>`, |
|
|
|
details: (details: string) => `<p>${details}</p>`, |
|
|
|
return: (value: string) => `<p>Return : ${value}</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()
|
|
|
|
// returns: () => '', // Implemented by getParams()
|
|
|
|
params: () => "", // Implemented by getParams()
|
|
|
|
params: () => "", // Implemented by getParams()
|
|
|
|
}; |
|
|
|
}; |
|
|
@ -114,11 +104,9 @@ export const renderHeader = ( |
|
|
|
|
|
|
|
|
|
|
|
export const renderParameterDocumentation = ( |
|
|
|
export const renderParameterDocumentation = ( |
|
|
|
parameters: ParameterDocumentation[] |
|
|
|
parameters: ParameterDocumentation[] |
|
|
|
) => ` |
|
|
|
) => `${ |
|
|
|
${ |
|
|
|
|
|
|
|
parameters.length > 0 |
|
|
|
parameters.length > 0 |
|
|
|
? ` |
|
|
|
? `<table class="table table-sm table-bordered table-striped">
|
|
|
|
<table class="table table-sm table-bordered table-striped"> |
|
|
|
|
|
|
|
<thead> |
|
|
|
<thead> |
|
|
|
<tr> |
|
|
|
<tr> |
|
|
|
<th>Name</th> |
|
|
|
<th>Name</th> |
|
|
@ -127,18 +115,17 @@ export const renderParameterDocumentation = ( |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<tbody> |
|
|
|
${parameters.map( |
|
|
|
${parameters.map( |
|
|
|
(output) => `<tr>
|
|
|
|
(output) => `<tr>
|
|
|
|
<td>${output.name}</td> |
|
|
|
<td>${output.name}</td> |
|
|
|
<td>${output.type}</td> |
|
|
|
<td>${output.type}</td> |
|
|
|
<td>${output.description}</td> |
|
|
|
<td>${output.description}</td> |
|
|
|
</tr>` |
|
|
|
</tr>` |
|
|
|
)} |
|
|
|
).join("")} |
|
|
|
</tbody> |
|
|
|
</tbody> |
|
|
|
</table>` |
|
|
|
</table>` |
|
|
|
: "<p>No parameters</p>" |
|
|
|
: "<p>No parameters</p>" |
|
|
|
} |
|
|
|
}`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => { |
|
|
|
export const getMethodDetails = (devMethod?: Partial<MethodDoc>) => { |
|
|
|
return !devMethod |
|
|
|
return !devMethod |
|
|
|