Commit c481510c99
Changed files (1)
lib
docs
lib/docs/main.js
@@ -3053,8 +3053,21 @@ Happy writing!
if (typeIsErrSet(declValue.expr.type)) {
errSetsList.push(decl);
} else if (typeIsStructWithNoFields(declValue.expr.type)) {
- if (getAstNode(decl.src).docs) {
- namespacesWithDocsList.push(decl);
+
+ let docs = getAstNode(decl.src).docs;
+ if (!docs) {
+ // If this is a re-export, try to fetch docs from the actual definition
+ const { value, seenDecls } = resolveValue(decl.value, true);
+ if (seenDecls.length > 0) {
+ const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]);
+ docs = getAstNode(definitionDecl.src).docs;
+ } else {
+ docs = getAstNode(getType(value.expr.type).src).docs;
+ }
+ }
+
+ if (docs) {
+ namespacesWithDocsList.push({decl, docs});
} else {
namespacesNoDocsList.push(decl);
}
@@ -3068,8 +3081,19 @@ Happy writing!
if (typeIsErrSet(declValue.expr.type)) {
errSetsList.push(decl);
} else if (typeIsStructWithNoFields(declValue.expr.type)) {
- if (getAstNode(decl.src).docs) {
- namespacesWithDocsList.push(decl);
+ let docs = getAstNode(decl.src).docs;
+ if (!docs) {
+ // If this is a re-export, try to fetch docs from the actual definition
+ const { value, seenDecls } = resolveValue(decl.value, true);
+ if (seenDecls.length > 0) {
+ const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]);
+ docs = getAstNode(definitionDecl.src).docs;
+ } else {
+ docs = getAstNode(getType(value.expr.type).src).docs;
+ }
+ }
+ if (docs) {
+ namespacesWithDocsList.push({decl, docs});
} else {
namespacesNoDocsList.push(decl);
}
@@ -3215,8 +3239,19 @@ Happy writing!
let descDom = liDom.children[1];
let docs = getAstNode(decl.src).docs;
+ if (!docs) {
+ // If this is a re-export, try to fetch docs from the actual definition
+ const { value, seenDecls } = resolveValue(decl.value, true);
+ if (seenDecls.length > 0) {
+ const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]);
+ docs = getAstNode(definitionDecl.src).docs;
+ } else {
+ docs = getAstNode(getType(value.expr.type).src).docs;
+ }
+ }
+
if (docs) {
- descDom.innerHTML = markdown(shortDesc(getAstNode(decl.src).docs));
+ descDom.innerHTML = markdown(shortDesc(docs));
} else {
descDom.innerHTML = "<p class='understated'><i>No documentation provided.</i></p>";
}
@@ -3241,16 +3276,17 @@ Happy writing!
for (let i = 0; i < namespacesWithDocsList.length; i += 1) {
let liDom = activeList.children[i - offset];
let aDom = liDom.children[0];
- let decl = namespacesWithDocsList[i];
+ let { decl, docs } = namespacesWithDocsList[i];
aDom.textContent = decl.name;
aDom.setAttribute("href", navLinkDecl(decl.name));
+
let descDom = liDom.children[1];
- descDom.innerHTML = markdown(shortDesc(getAstNode(decl.src).docs));
+ descDom.innerHTML = markdown(shortDesc(docs));
if (i == splitPoint - 1) {
activeList = domListNamespacesRight;
offset = splitPoint;
- }
+ }
}
domListNamespacesLeft.classList.remove("hidden");