aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/pages/documentation
diff options
context:
space:
mode:
authorF. Eugene Aumson <gene@aumson.org>2018-09-22 23:06:48 +0800
committerF. Eugene Aumson <gene@aumson.org>2018-09-22 23:29:27 +0800
commit98d06d6d252ed379d60bcef915caf38a5ec7a5af (patch)
treeb68eac94243885495d06e67e70ad8b12a635a517 /packages/website/ts/pages/documentation
parent9f0dfb1e1a4c97e462cf298e0452be1d0fcf2216 (diff)
downloaddexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar
dexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.gz
dexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.bz2
dexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.lz
dexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.xz
dexon-sol-tools-98d06d6d252ed379d60bcef915caf38a5ec7a5af.tar.zst
dexon-sol-tools-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/documentation')
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx26
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({