zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 5e765356a7c4f80d03a05d170018fded6750ebb6 (tree)
parent ca3250a57c9d0c4011b66b32c500750087070a08
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue,  8 Oct 2019 23:15:47 -0400

generated docs: global vars in a table

Diffstat:
Mlib/std/special/docs/index.html | 16++++++++++++++--
Mlib/std/special/docs/main.js | 21+++++++++++++--------
2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/lib/std/special/docs/index.html b/lib/std/special/docs/index.html @@ -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> diff --git a/lib/std/special/docs/main.js b/lib/std/special/docs/main.js @@ -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"); }