Commit cb5a5ebb20

xackus <14938807+xackus@users.noreply.github.com>
2019-10-23 12:55:20
langref table of contents in a separate column on large displays
1 parent b3cbf29
Changed files (2)
doc/docgen.zig
@@ -371,8 +371,8 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
                             .Separator => continue,
                             .TagContent => {
                                 const param = tokenizer.buffer[bracket_tok.start..bracket_tok.end];
-                                if (mem.eql(u8, param, "3col")) {
-                                    columns = 3;
+                                if (mem.eql(u8, param, "2col")) {
+                                    columns = 2;
                                 } else {
                                     return parseError(
                                         tokenizer,
doc/langref.html.in
@@ -7,6 +7,7 @@
     <style>
       body{
         font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
+        margin: 0;
       }
       a:not(:hover) {
         text-decoration: none;
@@ -80,11 +81,35 @@
           font-weight: bold;
       }
 
+      #main-wrapper {
+        display: flex;
+        flex-direction: column;
+        height: 100vh;
+      }
+
+      #contents-wrapper {
+        flex-grow: 1;
+        padding: 0 2em;
+      }
+
       #contents {
         max-width: 60em;
         margin: auto;
       }
 
+      #index {
+        padding: 0 1em;
+      }
+
+      @media screen and (min-width: 1025px) {
+        #main-wrapper {
+            flex-direction: row;
+        }
+        #contents-wrapper, #index {
+            overflow: auto;
+        }
+      }
+
       h1 a, h2 a, h3 a, h4 a, h5 a {
         text-decoration: none;
         color: #333;
@@ -155,13 +180,18 @@
     </style>
   </head>
   <body>
-    <a href="https://ziglang.org/documentation/0.1.1">0.1.1</a> |
-    <a href="https://ziglang.org/documentation/0.2.0">0.2.0</a> |
-    <a href="https://ziglang.org/documentation/0.3.0">0.3.0</a> |
-    <a href="https://ziglang.org/documentation/0.4.0">0.4.0</a> |
-    <a href="https://ziglang.org/documentation/0.5.0">0.5.0</a> |
-    master
-    <div id="contents">
+    <div id="main-wrapper">
+      <div id="index">
+        <a href="https://ziglang.org/documentation/0.1.1">0.1.1</a> |
+        <a href="https://ziglang.org/documentation/0.2.0">0.2.0</a> |
+        <a href="https://ziglang.org/documentation/0.3.0">0.3.0</a> |
+        <a href="https://ziglang.org/documentation/0.4.0">0.4.0</a> |
+        <a href="https://ziglang.org/documentation/0.5.0">0.5.0</a> |
+        master
+        <h1>Index</h1>
+        {#nav#}
+      </div>
+      <div id="contents-wrapper"><div id="contents">
       {#header_open|Introduction#}
       <p>
       Zig is a general-purpose programming language for maintaining <strong>robust</strong>,
@@ -194,10 +224,6 @@
       </p>
       {#header_close#}
 
-      {#header_open|Index#}
-      {#nav#}
-      {#header_close#}
-
       {#header_open|Hello World#}
 
       {#code_begin|exe|hello#}
@@ -6556,7 +6582,7 @@ fn readFile(allocator: *Allocator, filename: []const u8) ![]u8 {
       {#header_close#}
 
       {#header_close#}
-      {#header_open|Builtin Functions|3col#}
+        {#header_open|Builtin Functions|2col#}
       <p>
       Builtin functions are provided by the compiler and are prefixed with <code>@</code>.
       The {#syntax#}comptime{#endsyntax#} keyword on a parameter means that the parameter must be known
@@ -10621,6 +10647,7 @@ keyword &lt;- KEYWORD_align / KEYWORD_and / KEYWORD_allowzero / KEYWORD_asm
         <li>Together we serve end users.</li>
       </ul>
       {#header_close#}
+      </div></div>
     </div>
   </body>
 </html>