Skip to content

Commit

Permalink
fix(dgeni): type alias symbols don't get link tag added (#3110)
Browse files Browse the repository at this point in the history
  • Loading branch information
griest024 authored Sep 23, 2024
1 parent 8743e69 commit 5cb84f3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
22 changes: 14 additions & 8 deletions tools/dgeni/src/processors/addLinkTagToDaffodilReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
Document,
} from 'dgeni';

import { CollectLinkableSymbolsProcessor } from './collect-linkable-symbols';

/**
* Adds a link tag ({@link }) around daffodil models, classes, etc.
*/
Expand All @@ -12,6 +14,8 @@ export class AddLinkTagToDaffodilReferencesProcessor implements Processor {
$runBefore = ['rendering-docs'];

$process(docs: Document[]): Document[] {
console.log(CollectLinkableSymbolsProcessor.symbols);

const docDictionary = docs.reduce((acc, doc) => ({
...acc,
[doc.name]: true,
Expand All @@ -21,14 +25,16 @@ export class AddLinkTagToDaffodilReferencesProcessor implements Processor {
}

addLinksToDoc(doc, docDictionary): Document {
return {
...doc,
typeParams: this.addLinks(doc.typeParams?.slice(1, doc.typeParams.length - 1), docDictionary),
members: doc.members?.map(member => ({
...member,
type: this.addLinks(member.type, docDictionary),
})),
};
doc.typeParams = this.addLinks(doc.typeParams?.slice(1, doc.typeParams.length - 1), docDictionary);
if (doc.typeDefinition) {
doc.typeDefinition = this.addLinks(doc.typeDefinition, docDictionary);
}
doc.members = doc.members?.map(member => ({
...member,
type: this.addLinks(member.type, docDictionary),
}));

return doc;
}

addLinks(str: string, docDictionary): string {
Expand Down
12 changes: 6 additions & 6 deletions tools/dgeni/src/processors/breadcrumb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ export class BreadcrumbProcessor implements FilterableProcessor {
return breadcrumbs;
}

$process(docs: Array<ParentedDocument & KindedDocument>): Array<BreadcrumbedDocument> {
return docs.map(doc => ({
...doc,
breadcrumbs: this.docTypes.includes(doc.docType)
$process(docs: Array<ParentedDocument & KindedDocument>): Array<ParentedDocument & KindedDocument & BreadcrumbedDocument> {
return docs.map(doc => {
doc.breadcrumbs = this.docTypes.includes(doc.docType)
? this.getBreadcrumbs(doc)
: [],
}));
: [];
return <ParentedDocument & KindedDocument & BreadcrumbedDocument>doc;
});
}
};

Expand Down

0 comments on commit 5cb84f3

Please sign in to comment.