generated docs: global vars in a table

This commit is contained in:
Andrew Kelley 2019-10-08 23:15:47 -04:00
parent ca3250a57c
commit 5e765356a7
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 27 additions and 10 deletions

View File

@ -22,6 +22,10 @@
padding:1em;
overflow-x: auto;
}
code {
font-family:"Source Code Pro",monospace;
font-size:1em;
}
nav {
width: 10em;
position: fixed;
@ -154,6 +158,12 @@
vertical-align: top;
}
#sectGlobalVars td {
vertical-align: top;
margin: 0;
padding: 0.5em;
}
.tok-kw {
color: #333;
font-weight: bold;
@ -310,8 +320,10 @@
</div>
<div id="sectGlobalVars" class="hidden">
<h2>Global Variables</h2>
<div id="listGlobalVars">
</div>
<table>
<tbody id="listGlobalVars">
</tbody>
</table>
</div>
<div id="sectFns" class="hidden">
<h2>Functions</h2>

View File

@ -633,22 +633,27 @@
}
if (varsList.length !== 0) {
resizeDomList(domListGlobalVars, varsList.length, '<div></div>');
resizeDomList(domListGlobalVars, varsList.length, '<tr><td></td><td></td><td></td></tr>');
for (var i = 0; i < varsList.length; i += 1) {
var decl = varsList[i];
var divDom = domListGlobalVars.children[i];
var trDom = domListGlobalVars.children[i];
var innerHtml = "";
innerHtml += '<pre><span class="tok-kw">pub</span> <span class="tok-kw">var</span> <a href="' +
navLinkDecl(decl.name) + '">' + escapeHtml(decl.name) + '</a>: ' +
typeIndexName(decl.type, true, true) + '</pre>';
var tdName = trDom.children[0];
var tdType = trDom.children[1];
var tdDesc = trDom.children[2];
tdName.innerHTML = '<a href="' +
navLinkDecl(decl.name) + '">' + escapeHtml(decl.name) + '</a>';
tdType.innerHTML = typeIndexName(decl.type, true, true);
var docs = zigAnalysis.astNodes[decl.src].docs;
if (docs != null) {
innerHtml += markdown(docs);
tdDesc.innerHTML = markdown(docs);
} else {
tdDesc.textContent = "";
}
divDom.innerHTML = innerHtml;
}
domSectGlobalVars.classList.remove("hidden");
}