| ... | ... | @@ -3053,8 +3053,21 @@ Happy writing! |
| 3053 | 3053 | if (typeIsErrSet(declValue.expr.type)) { |
| 3054 | 3054 | errSetsList.push(decl); |
| 3055 | 3055 | } else if (typeIsStructWithNoFields(declValue.expr.type)) { |
| 3056 | | if (getAstNode(decl.src).docs) { |
| 3057 | | namespacesWithDocsList.push(decl); |
| 3056 | |
| 3057 | let docs = getAstNode(decl.src).docs; |
| 3058 | if (!docs) { |
| 3059 | // If this is a re-export, try to fetch docs from the actual definition |
| 3060 | const { value, seenDecls } = resolveValue(decl.value, true); |
| 3061 | if (seenDecls.length > 0) { |
| 3062 | const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]); |
| 3063 | docs = getAstNode(definitionDecl.src).docs; |
| 3064 | } else { |
| 3065 | docs = getAstNode(getType(value.expr.type).src).docs; |
| 3066 | } |
| 3067 | } |
| 3068 | |
| 3069 | if (docs) { |
| 3070 | namespacesWithDocsList.push({decl, docs}); |
| 3058 | 3071 | } else { |
| 3059 | 3072 | namespacesNoDocsList.push(decl); |
| 3060 | 3073 | } |
| ... | ... | @@ -3068,8 +3081,19 @@ Happy writing! |
| 3068 | 3081 | if (typeIsErrSet(declValue.expr.type)) { |
| 3069 | 3082 | errSetsList.push(decl); |
| 3070 | 3083 | } else if (typeIsStructWithNoFields(declValue.expr.type)) { |
| 3071 | | if (getAstNode(decl.src).docs) { |
| 3072 | | namespacesWithDocsList.push(decl); |
| 3084 | let docs = getAstNode(decl.src).docs; |
| 3085 | if (!docs) { |
| 3086 | // If this is a re-export, try to fetch docs from the actual definition |
| 3087 | const { value, seenDecls } = resolveValue(decl.value, true); |
| 3088 | if (seenDecls.length > 0) { |
| 3089 | const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]); |
| 3090 | docs = getAstNode(definitionDecl.src).docs; |
| 3091 | } else { |
| 3092 | docs = getAstNode(getType(value.expr.type).src).docs; |
| 3093 | } |
| 3094 | } |
| 3095 | if (docs) { |
| 3096 | namespacesWithDocsList.push({decl, docs}); |
| 3073 | 3097 | } else { |
| 3074 | 3098 | namespacesNoDocsList.push(decl); |
| 3075 | 3099 | } |
| ... | ... | @@ -3215,8 +3239,19 @@ Happy writing! |
| 3215 | 3239 | |
| 3216 | 3240 | let descDom = liDom.children[1]; |
| 3217 | 3241 | let docs = getAstNode(decl.src).docs; |
| 3242 | if (!docs) { |
| 3243 | // If this is a re-export, try to fetch docs from the actual definition |
| 3244 | const { value, seenDecls } = resolveValue(decl.value, true); |
| 3245 | if (seenDecls.length > 0) { |
| 3246 | const definitionDecl = getDecl(seenDecls[seenDecls.length - 1]); |
| 3247 | docs = getAstNode(definitionDecl.src).docs; |
| 3248 | } else { |
| 3249 | docs = getAstNode(getType(value.expr.type).src).docs; |
| 3250 | } |
| 3251 | } |
| 3252 | |
| 3218 | 3253 | if (docs) { |
| 3219 | | descDom.innerHTML = markdown(shortDesc(getAstNode(decl.src).docs)); |
| 3254 | descDom.innerHTML = markdown(shortDesc(docs)); |
| 3220 | 3255 | } else { |
| 3221 | 3256 | descDom.innerHTML = "<p class='understated'><i>No documentation provided.</i></p>"; |
| 3222 | 3257 | } |
| ... | ... | @@ -3241,16 +3276,17 @@ Happy writing! |
| 3241 | 3276 | for (let i = 0; i < namespacesWithDocsList.length; i += 1) { |
| 3242 | 3277 | let liDom = activeList.children[i - offset]; |
| 3243 | 3278 | let aDom = liDom.children[0]; |
| 3244 | | let decl = namespacesWithDocsList[i]; |
| 3279 | let { decl, docs } = namespacesWithDocsList[i]; |
| 3245 | 3280 | aDom.textContent = decl.name; |
| 3246 | 3281 | aDom.setAttribute("href", navLinkDecl(decl.name)); |
| 3282 | |
| 3247 | 3283 | |
| 3248 | 3284 | let descDom = liDom.children[1]; |
| 3249 | | descDom.innerHTML = markdown(shortDesc(getAstNode(decl.src).docs)); |
| 3285 | descDom.innerHTML = markdown(shortDesc(docs)); |
| 3250 | 3286 | if (i == splitPoint - 1) { |
| 3251 | 3287 | activeList = domListNamespacesRight; |
| 3252 | 3288 | offset = splitPoint; |
| 3253 | | } |
| 3289 | } |
| 3254 | 3290 | } |
| 3255 | 3291 | |
| 3256 | 3292 | domListNamespacesLeft.classList.remove("hidden"); |