merge base branch

This commit is contained in:
Fabio Berger
2018-10-04 19:03:01 +01:00
154 changed files with 3649 additions and 1232 deletions

View File

@@ -18,6 +18,7 @@ export class DocsInfo {
public packageName: string;
public packageUrl: string;
public menu: DocsMenu;
public typeSectionName: string;
public sections: SectionsMap;
public sectionNameToMarkdownByVersion: SectionNameToMarkdownByVersion;
public contractsByVersionByNetworkId?: ContractsByVersionByNetworkId;
@@ -28,6 +29,7 @@ export class DocsInfo {
this.displayName = config.displayName;
this.packageName = config.packageName;
this.packageUrl = config.packageUrl;
this.typeSectionName = config.type === SupportedDocJson.SolDoc ? 'structs' : 'types';
this.sections = config.markdownSections;
this.sectionNameToMarkdownByVersion = config.sectionNameToMarkdownByVersion;
this.contractsByVersionByNetworkId = config.contractsByVersionByNetworkId;
@@ -53,7 +55,7 @@ export class DocsInfo {
_.isEmpty(docSection.properties) &&
_.isEmpty(docSection.events);
if (!_.isUndefined(this.sections.types) && sectionName === this.sections.types) {
if (sectionName === this.typeSectionName) {
const sortedTypesNames = _.sortBy(docSection.types, 'name');
const typeNames = _.map(sortedTypesNames, t => t.name);
const typeLinks = _.map(typeNames, typeName => {
@@ -94,12 +96,12 @@ export class DocsInfo {
return subsectionNameToLinks;
}
public getTypeDefinitionsByName(docAgnosticFormat: DocAgnosticFormat): { [name: string]: TypeDefinitionByName } {
if (_.isUndefined(this.sections.types)) {
if (_.isUndefined(docAgnosticFormat[this.typeSectionName])) {
return {};
}
const typeDocSection = docAgnosticFormat[this.sections.types];
const typeDefinitionByName = _.keyBy(typeDocSection.types, 'name') as any;
const section = docAgnosticFormat[this.typeSectionName];
const typeDefinitionByName = _.keyBy(section.types, 'name') as any;
return typeDefinitionByName;
}
public getSectionNameToLinks(): ObjectMap<ALink[]> {