Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update docs
  • Loading branch information
xlc committed May 3, 2020
commit 40f0ed37d41efdaa0188d0c2ae11c5987954f1d3
7 changes: 7 additions & 0 deletions packages/typegen/src/templates/docs.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{#if docs.length}}
/**
{{#each docs}}
* {{{this}}}
{{/each}}
**/
{{/if}}
13 changes: 2 additions & 11 deletions packages/typegen/src/util/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,13 @@ import Handlebars from 'handlebars';
import { Text } from '@polkadot/types';

import { indent } from './formatting';
import { readTemplate } from './file';

type AnyString = Text | string;
type Arg = [AnyString, AnyString];

Handlebars.registerPartial({
docs: Handlebars.compile(`
{{~#if docs.length}}
/**
{{~#each docs}}

* {{{this}}}
{{~/each}}

**/
{{/if}}
`)
docs: Handlebars.compile(readTemplate('docs'))
});

export function createDocComments (spaces: number, docs: AnyString[], args: Arg[] = []): string {
Expand Down