diff options
author | F. Eugene Aumson <gene@aumson.org> | 2018-09-22 23:06:48 +0800 |
---|---|---|
committer | F. Eugene Aumson <gene@aumson.org> | 2018-09-22 23:29:27 +0800 |
commit | 98d06d6d252ed379d60bcef915caf38a5ec7a5af (patch) | |
tree | b68eac94243885495d06e67e70ad8b12a635a517 /packages/website/ts/pages | |
parent | 9f0dfb1e1a4c97e462cf298e0452be1d0fcf2216 (diff) | |
download | dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.gz dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.bz2 dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.lz dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.xz dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.zst dexon-0x-contracts-98d06d6d252ed379d60bcef915caf38a5ec7a5af.zip |
BREAKING CHANGE: document contracts from sol-doc
Change website to accept smart contract documentation in the format
generated by sol-doc rather than that generated by Doxity.
Diffstat (limited to 'packages/website/ts/pages')
-rw-r--r-- | packages/website/ts/pages/documentation/doc_page.tsx | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx index 9c144b93f..7bf3addc0 100644 --- a/packages/website/ts/pages/documentation/doc_page.tsx +++ b/packages/website/ts/pages/documentation/doc_page.tsx @@ -1,4 +1,11 @@ -import { DocAgnosticFormat, DocsInfo, Documentation } from '@0xproject/react-docs'; +import { + DocAgnosticFormat, + DocsInfo, + Documentation, + GeneratedDocJson, + SupportedDocJson, + TypeDocUtils, +} from '@0xproject/react-docs'; import findVersions = require('find-versions'); import * as _ from 'lodash'; import * as React from 'react'; @@ -128,7 +135,22 @@ export class DocPage extends React.Component<DocPageProps, DocPageState> { const versionFilePathToFetch = versionToFilePath[versionToFetch]; const versionDocObj = await docUtils.getJSONDocFileAsync(versionFilePathToFetch, docBucketRoot); - const docAgnosticFormat = this.props.docsInfo.convertToDocAgnosticFormat(versionDocObj); + let docAgnosticFormat; + if (this.props.docsInfo.type === SupportedDocJson.TypeDoc) { + docAgnosticFormat = new TypeDocUtils( + versionDocObj as GeneratedDocJson, + this.props.docsInfo, + ).convertToDocAgnosticFormat(); + } else if (this.props.docsInfo.type === SupportedDocJson.Solidity) { + // documenting solidity. + docAgnosticFormat = versionDocObj as DocAgnosticFormat; + // need to modify docsInfo like convertToDocAgnosticFormat() would do + this.props.docsInfo.menu.Contracts = []; + _.each(docAgnosticFormat, (docObj, contractName) => { + this.props.docsInfo.sections[contractName] = contractName; + this.props.docsInfo.menu.Contracts.push(contractName); + }); + } if (!this._isUnmounted) { this.setState({ |