mirror of
https://github.com/ziglang/zig.git
synced 2026-01-07 05:55:36 +00:00
generated docs: better rendering of unknown decls
This commit is contained in:
parent
d15a71afc9
commit
bc393eefa1
@ -289,6 +289,17 @@
|
||||
<pre id="fnProtoCode"></pre>
|
||||
</div>
|
||||
<h1 id="hdrName" class="hidden"></h1>
|
||||
<div id="fnExamples" class="hidden"></div>
|
||||
<div id="fnNoExamples" class="hidden">
|
||||
<p>This function is not tested or referenced.</p>
|
||||
</div>
|
||||
<div id="declNoRef" class="hidden">
|
||||
<p>
|
||||
This declaration is not tested or referenced, and it has therefore not been included in
|
||||
semantic analysis, which means the only documentation available is whatever is in the
|
||||
doc comments.
|
||||
</p>
|
||||
</div>
|
||||
<div id="fnDocs" class="hidden"></div>
|
||||
<div id="sectFnErrors" class="hidden">
|
||||
<h2>Errors</h2>
|
||||
@ -297,10 +308,6 @@
|
||||
</div>
|
||||
<div id="tableFnErrors"><dl id="listFnErrors"></dl></div>
|
||||
</div>
|
||||
<div id="fnExamples" class="hidden"></div>
|
||||
<div id="fnNoExamples" class="hidden">
|
||||
<p>This function is not tested or referenced.</p>
|
||||
</div>
|
||||
<div id="sectSearchResults" class="hidden">
|
||||
<h2>Search Results</h2>
|
||||
<ul id="listSearchResults"></ul>
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
var domFnErrorsAnyError = document.getElementById("fnErrorsAnyError");
|
||||
var domFnExamples = document.getElementById("fnExamples");
|
||||
var domFnNoExamples = document.getElementById("fnNoExamples");
|
||||
var domDeclNoRef = document.getElementById("declNoRef");
|
||||
var domSearch = document.getElementById("search");
|
||||
var domSectSearchResults = document.getElementById("sectSearchResults");
|
||||
var domListSearchResults = document.getElementById("listSearchResults");
|
||||
@ -112,6 +113,7 @@
|
||||
domSectFnErrors.classList.add("hidden");
|
||||
domFnExamples.classList.add("hidden");
|
||||
domFnNoExamples.classList.add("hidden");
|
||||
domDeclNoRef.classList.add("hidden");
|
||||
domFnErrorsAnyError.classList.add("hidden");
|
||||
domTableFnErrors.classList.add("hidden");
|
||||
domSectGlobalVars.classList.add("hidden");
|
||||
@ -160,7 +162,12 @@
|
||||
renderNav();
|
||||
|
||||
var lastDecl = curNav.declObjs[curNav.declObjs.length - 1];
|
||||
if (lastDecl.kind === 'var') {
|
||||
if (lastDecl.pubDecls != null) {
|
||||
renderContainer(lastDecl);
|
||||
}
|
||||
if (lastDecl.kind == null) {
|
||||
return renderUnknownDecl(lastDecl);
|
||||
} else if (lastDecl.kind === 'var') {
|
||||
return renderVar(lastDecl);
|
||||
} else if (lastDecl.kind === 'const' && lastDecl.type != null) {
|
||||
var typeObj = zigAnalysis.types[lastDecl.type];
|
||||
@ -169,13 +176,21 @@
|
||||
} else {
|
||||
return renderValue(lastDecl);
|
||||
}
|
||||
}
|
||||
if (lastDecl.kind != null) {
|
||||
} else {
|
||||
renderType(lastDecl);
|
||||
}
|
||||
if (lastDecl.pubDecls != null) {
|
||||
renderContainer(lastDecl);
|
||||
}
|
||||
|
||||
function renderUnknownDecl(decl) {
|
||||
domDeclNoRef.classList.remove("hidden");
|
||||
|
||||
var docs = zigAnalysis.astNodes[decl.src].docs;
|
||||
if (docs != null) {
|
||||
domFnDocs.innerHTML = markdown(docs);
|
||||
} else {
|
||||
domFnDocs.innerHTML = '<p>There are no doc comments for this declaration.</p>';
|
||||
}
|
||||
domFnDocs.classList.remove("hidden");
|
||||
}
|
||||
|
||||
function typeIsErrSet(typeIndex) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user