authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-08 23:15:47-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-10-08 23:15:47-04:00
log5e765356a7c4f80d03a05d170018fded6750ebb6
tree19e4813e337907d52db6cc208e0205727bd95107
parentca3250a57c9d0c4011b66b32c500750087070a08
signaturelock-open Commit is signed but in an unrecognized format.

generated docs: global vars in a table


2 files changed, 27 insertions(+), 10 deletions(-)

lib/std/special/docs/index.html+14-2
...@@ -22,6 +22,10 @@...@@ -22,6 +22,10 @@
22 padding:1em;22 padding:1em;
23 overflow-x: auto;23 overflow-x: auto;
24 }24 }
25 code {
26 font-family:"Source Code Pro",monospace;
27 font-size:1em;
28 }
25 nav {29 nav {
26 width: 10em;30 width: 10em;
27 position: fixed;31 position: fixed;
...@@ -154,6 +158,12 @@...@@ -154,6 +158,12 @@
154 vertical-align: top;158 vertical-align: top;
155 }159 }
156160
161 #sectGlobalVars td {
162 vertical-align: top;
163 margin: 0;
164 padding: 0.5em;
165 }
166
157 .tok-kw {167 .tok-kw {
158 color: #333;168 color: #333;
159 font-weight: bold;169 font-weight: bold;
...@@ -310,8 +320,10 @@...@@ -310,8 +320,10 @@
310 </div>320 </div>
311 <div id="sectGlobalVars" class="hidden">321 <div id="sectGlobalVars" class="hidden">
312 <h2>Global Variables</h2>322 <h2>Global Variables</h2>
313 <div id="listGlobalVars">323 <table>
314 </div>324 <tbody id="listGlobalVars">
325 </tbody>
326 </table>
315 </div>327 </div>
316 <div id="sectFns" class="hidden">328 <div id="sectFns" class="hidden">
317 <h2>Functions</h2>329 <h2>Functions</h2>
lib/std/special/docs/main.js+13-8
...@@ -633,22 +633,27 @@...@@ -633,22 +633,27 @@
633 }633 }
634634
635 if (varsList.length !== 0) {635 if (varsList.length !== 0) {
636 resizeDomList(domListGlobalVars, varsList.length, '<div></div>');636 resizeDomList(domListGlobalVars, varsList.length, '<tr><td></td><td></td><td></td></tr>');
637 for (var i = 0; i < varsList.length; i += 1) {637 for (var i = 0; i < varsList.length; i += 1) {
638 var decl = varsList[i];638 var decl = varsList[i];
639 var divDom = domListGlobalVars.children[i];639 var trDom = domListGlobalVars.children[i];
640 var innerHtml = "";640 var innerHtml = "";
641641
642 innerHtml += '<pre><span class="tok-kw">pub</span> <span class="tok-kw">var</span> <a href="' +642 var tdName = trDom.children[0];
643 navLinkDecl(decl.name) + '">' + escapeHtml(decl.name) + '</a>: ' +643 var tdType = trDom.children[1];
644 typeIndexName(decl.type, true, true) + '</pre>';644 var tdDesc = trDom.children[2];
645
646 tdName.innerHTML = '<a href="' +
647 navLinkDecl(decl.name) + '">' + escapeHtml(decl.name) + '</a>';
648
649 tdType.innerHTML = typeIndexName(decl.type, true, true);
645650
646 var docs = zigAnalysis.astNodes[decl.src].docs;651 var docs = zigAnalysis.astNodes[decl.src].docs;
647 if (docs != null) {652 if (docs != null) {
648 innerHtml += markdown(docs);653 tdDesc.innerHTML = markdown(docs);
654 } else {
655 tdDesc.textContent = "";
649 }656 }
650
651 divDom.innerHTML = innerHtml;
652 }657 }
653 domSectGlobalVars.classList.remove("hidden");658 domSectGlobalVars.classList.remove("hidden");
654 }659 }