changed: preparing for initial release of website
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 5 Apr 2023 22:45:01 +0000 (17:45 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 5 Apr 2023 22:45:01 +0000 (17:45 -0500)
src/app.onyx
www/news-articles/index.json [new file with mode: 0644]
www/news-articles/ovmwasm.html
www/static/css/new_style.css
www/static/vendor/highlight.min.css
www/templates/pages/docs.html
www/templates/pages/docs/install.html
www/templates/pages/homepage.html
www/templates/pages/news.html

index 4b977df4a979eb7124c12114578a851ff627a13f..c0e12b0a0e30c689a90b1d1507508e6a76e479e2 100644 (file)
@@ -3,6 +3,7 @@ use runtime
 use otmp
 use http
 use http.server {Req :: Request, Res :: Response, route}
+use json
 
 #inject runtime.vars {
     Enable_Heap_Debug :: true
@@ -59,13 +60,22 @@ reg: otmp.TemplateRegistry;
 
 @route.{.GET, "/news"}
 (req: &Req, res: &Res) {
-    articles := make([..] str);
+    Article :: struct { name, description, path, date: str }
+    articles := make([..] Article);
+
+    article_file := os.get_contents("www/news-articles/index.json");
+    article_index, json_err := json.decode_with_error(article_file);
+    if json_err->has_error() {
+        res->status(500);
+        return;
+    }
 
-    for os.list_directory("www/news-articles") {
-        name := it->name();
-        if string.ends_with(name, ".html") {
-            articles << string.temp_copy(name[0 .. name.length-5]);
-        }
+    for article_index.root->as_array() {
+        name := it["name"]->as_str();
+        desc := it["description"]->as_str();
+        path := it["path"]->as_str();
+        date := it["date"]->as_str();
+        articles << .{ name, desc, path, date };
     }
 
     res->render("pages/news", &.{
diff --git a/www/news-articles/index.json b/www/news-articles/index.json
new file mode 100644 (file)
index 0000000..192714a
--- /dev/null
@@ -0,0 +1,8 @@
+[
+    {
+        "name": "Onyx's Custom Runtime",
+        "path": "ovmwasm",
+        "date": "5th April 2023",
+        "description": "Something about a brief introduction to the OVM-Wasm system."
+    }
+]
index 834dc5075c577338e7829965743b72a663d181d3..daef19e31f431d3a1fd951273f827e15a7eac004 100644 (file)
@@ -1,35 +1,33 @@
-<div class="container">
-    <h1>Onyx's Custom Runtime</h1>
+<h1>Onyx's Custom Runtime</h1>
 
-    <p>
-        As Onyx targets WebAssembly (WASM) exclusively, running code outside of the browser requires a <a href="https://webassembly.github.io/spec/core/appendix/embedding.html">WASM embedder</a>.
-        The job of the embedder is to translate the WASM Virtual Instruction Set Architecture into a "real" architecture that can be executed on the host system.
-        There are many great WASM embedders that exist for running WASM outside the browser. Here's a small, non-comprehensive list:
-    </p>
-    <ul>
-        <li><a href="https://wasmer.io">Wasmer</a></li>
-        <li><a href="https://wasmtime.dev">Wasmtime</a></li>
-        <li><a href="https://github.com/wasm3/wasm3">Wasm3</a></li>
-        <li><a href="https://wasmedge.org">WasmEdge</a></li>
-    </ul>
+<p>
+    As Onyx targets WebAssembly (WASM) exclusively, running code outside of the browser requires a <a href="https://webassembly.github.io/spec/core/appendix/embedding.html">WASM embedder</a>.
+    The job of the embedder is to translate the WASM Virtual Instruction Set Architecture into a "real" architecture that can be executed on the host system.
+    There are many great WASM embedders that exist for running WASM outside the browser. Here's a small, non-comprehensive list:
+</p>
+<ul>
+    <li><a href="https://wasmer.io">Wasmer</a></li>
+    <li><a href="https://wasmtime.dev">Wasmtime</a></li>
+    <li><a href="https://github.com/wasm3/wasm3">Wasm3</a></li>
+    <li><a href="https://wasmedge.org">WasmEdge</a></li>
+</ul>
 
-    <p>
-    All of these embedders are great in their own way, but the one thing they are not <em>great</em> at is providing a great developer experience for Onyx. For this reason, Onyx maintains support for two WASM embedders: <em>Wasmer</em> and <em>OVM-Wasm</em>. Wasmer is used as the faster, production-ready embedder, while OVM-Wasm is used as the development embedder.
-    </p>
+<p>
+All of these embedders are great in their own way, but the one thing they are not <em>great</em> at is providing a great developer experience for Onyx. For this reason, Onyx maintains support for two WASM embedders: <em>Wasmer</em> and <em>OVM-Wasm</em>. Wasmer is used as the faster, production-ready embedder, while OVM-Wasm is used as the development embedder.
+</p>
 
-    <p>
-    OVM-Wasm stands for <em>Onyx Virtual Machine for WASM</em>. The Onyx Virtual Machine (OVM) started as a separate project with the goal of providing a separate compile-target for Onyx; however, to reduce complexity, OVM-Wasm was created as a wrapper around OVM, that provides a <a href="https://github.com/WebAssembly/wasm-c-api">wasm-c-api</a> compatible interface, making it a WASM embedder.
-    Since OVM-Wasm is entirely specific to Onyx and can be easily modified to suit the needs of developing Onyx.
-    It has more features compared to a normal WASM embedder, such a <em>debugging interface</em> that is compatible with the Debug Adapter Protocol.
-    </p>
-    
-    <p>
-    Currently, it does not run as fast as it could.
-    This is due to several reason, but largely because it simply compiles WebAssembly down to an <em>interpreted</em> instruction stream, not machine-native instructions.
-    This was done to make OVM-Wasm more portable, but does come at a significant performance cost.
-    To compound onto this fact, the instruction stream itself is not optimized <em>at all</em>.
-    It is the most literal, WASM to OVM conversion possible.
-    This helps make the initial startup time faster, but does incur wasted performance.
-    It is on the (rather large) list of to-dos to add simple optimizations to the embedding process to make OVM-Wasm not <em>horribly</em> slow.
-    </p>
-</div>
+<p>
+OVM-Wasm stands for <em>Onyx Virtual Machine for WASM</em>. The Onyx Virtual Machine (OVM) started as a separate project with the goal of providing a separate compile-target for Onyx; however, to reduce complexity, OVM-Wasm was created as a wrapper around OVM, that provides a <a href="https://github.com/WebAssembly/wasm-c-api">wasm-c-api</a> compatible interface, making it a WASM embedder.
+Since OVM-Wasm is entirely specific to Onyx and can be easily modified to suit the needs of developing Onyx.
+It has more features compared to a normal WASM embedder, such a <em>debugging interface</em> that is compatible with the Debug Adapter Protocol.
+</p>
+
+<p>
+Currently, it does not run as fast as it could.
+This is due to several reasons, but largely because it compiles WebAssembly down to an <em>interpreted</em> instruction stream, not machine-native instructions.
+This was done to make OVM-Wasm more portable, but does come at a significant performance cost.
+To compound onto this fact, the instruction stream itself is not optimized <em>at all</em>.
+It is the most literal, WASM to OVM conversion possible.
+This helps the initial startup time be faster, but does incur wasted performance.
+It is on the (rather large) list of to-dos to add simple optimizations to the embedding process to make OVM-Wasm not <em>as</em> slow.
+</p>
index 6db2f8ab5e495560bf1d8c5afb4f36d11bf0eca4..bcce3babf351e720a092093b7a763c3f1bb63277 100644 (file)
@@ -14,6 +14,7 @@
         --dark-background-color: #111;
         --active-color: #555;
         --link-color: #bbf;
+        --visited-link-color: #bfbfff;
         --foreground-color: #fff;
     }
 }
@@ -27,7 +28,8 @@
         --light-background-color: #e0e0e0;
         --dark-background-color: #c0c0c0;
         --active-color: #cccccc;
-        --link-color: #224;
+        --link-color: #448;
+        --visited-link-color: #669;
         --foreground-color: #000000;
     }
 }
@@ -43,14 +45,27 @@ body {
 
 a {
     color: var(--link-color);
+    text-decoration: none;
+}
+
+a.link-button {
+    padding: 8px;
+    text-decoration: none;
+    background-color: var(--light-background-color);
+    transition: all 300ms;
+}
+
+a.link-button:hover {
+    background-color: var(--active-color);
+    cursor: pointer;
 }
 
 a:visited {
-    color: #88f;
+    color: var(--visited-link-color);
 }
 
 .container {
-    padding: 56px 12px;
+    padding: 48px 12px;
 }
 
 .container > .container.merge {
@@ -66,7 +81,7 @@ a:visited {
     margin-top: 20px;
 }
 
-.container ul {
+.container ul, .container ol {
     padding-left: 20px;
 }
 
@@ -90,7 +105,10 @@ a:visited {
 h1 {
     min-width: 100px;
     font-size: 36pt;
-    font-weight: lighter;
+}
+
+h1, h2, h3, h4, h5, h6 {
+    font-weight: 200;
 }
 
 .container h3 {
@@ -203,3 +221,13 @@ main {
     grid-template-rows: auto 1fr auto;
 }
 
+main pre {
+    border: 1px solid var(--terminal-background-color);
+    box-shadow: 0px 1px 10px 1px rgba(0, 0, 0, 0.2);
+    padding: 8px;
+    display: block;
+}
+
+main li {
+    margin-top: 8px;
+}
index 4dce1ebd405fa5d67e130adb6f7e9b4385b85b2a..106b70f8e77d2072326ff86050def3b17d8a7772 100644 (file)
-/*
- * Visual Studio 2015 dark style
- * Author: Nicolas LLOBERA <nllobera@gmail.com>
- */
-
-.hljs {
-  background: #1E1E1E;
-  color: #DCDCDC;
-}
-
-.hljs-keyword,
-.hljs-literal,
-.hljs-symbol,
-.hljs-name {
-  color: #569CD6;
-}
-.hljs-link {
-  color: #569CD6;
-  text-decoration: underline;
-}
-
-.hljs-built_in,
-.hljs-type {
-  color: #4EC9B0;
-}
-
-.hljs-number,
-.hljs-class {
-  color: #B8D7A3;
-}
-
-.hljs-string,
-.hljs-meta .hljs-string {
-  color: #D69D85;
-}
-
-.hljs-regexp,
-.hljs-template-tag {
-  color: #9A5334;
-}
-
-.hljs-subst,
-.hljs-function,
-.hljs-title,
-.hljs-params,
-.hljs-formula {
-  color: #DCDCDC;
-}
-
-.hljs-comment,
-.hljs-quote {
-  color: #57A64A;
-  font-style: italic;
-}
-
-.hljs-doctag {
-  color: #608B4E;
-}
-
-.hljs-meta,
-.hljs-meta .hljs-keyword,
-
-.hljs-tag {
-  color: #9B9B9B;
-}
-
-.hljs-variable,
-.hljs-template-variable {
-  color: #BD63C5;
-}
-
-.hljs-attr,
-.hljs-attribute {
-  color: #9CDCFE;
-}
-
-.hljs-section {
-  color: gold;
-}
-
-.hljs-emphasis {
-  font-style: italic;
-}
-
-.hljs-strong {
-  font-weight: bold;
-}
-
-/*.hljs-code {
-  font-family:'Monospace';
-}*/
-
-.hljs-bullet,
-.hljs-selector-tag,
-.hljs-selector-id,
-.hljs-selector-class,
-.hljs-selector-attr,
-.hljs-selector-pseudo {
-  color: #D7BA7D;
-}
-
-.hljs-addition {
-  background-color: #144212;
-  display: inline-block;
-  width: 100%;
-}
-
-.hljs-deletion {
-  background-color: #600;
-  display: inline-block;
-  width: 100%;
+@media (prefers-color-scheme: light) {
+    /*
+    Visual Studio-like style based on original C# coloring by Jason Diamond <jason@diamond.name>
+    */
+    .hljs {
+      background: white;
+      color: black;
+    }
+
+    .hljs-comment,
+    .hljs-quote,
+    .hljs-variable {
+      color: #008000;
+    }
+
+    .hljs-keyword,
+    .hljs-selector-tag,
+    .hljs-built_in,
+    .hljs-name,
+    .hljs-tag {
+      color: #00f;
+    }
+
+    .hljs-string,
+    .hljs-title,
+    .hljs-section,
+    .hljs-attribute,
+    .hljs-literal,
+    .hljs-template-tag,
+    .hljs-template-variable,
+    .hljs-type,
+    .hljs-addition {
+      color: #a31515;
+    }
+
+    .hljs-deletion,
+    .hljs-selector-attr,
+    .hljs-selector-pseudo,
+    .hljs-meta {
+      color: #2b91af;
+    }
+
+    .hljs-doctag {
+      color: #808080;
+    }
+
+    .hljs-attr {
+      color: #f00;
+    }
+
+    .hljs-symbol,
+    .hljs-bullet,
+    .hljs-link {
+      color: #00b0e8;
+    }
+
+
+    .hljs-emphasis {
+      font-style: italic;
+    }
+
+    .hljs-strong {
+      font-weight: bold;
+    }
+}
+
+@media (prefers-color-scheme: dark) {
+    /*
+     * Visual Studio 2015 dark style
+     * Author: Nicolas LLOBERA <nllobera@gmail.com>
+     */
+
+    .hljs {
+      background: #1E1E1E;
+      color: #DCDCDC;
+    }
+
+    .hljs-keyword,
+    .hljs-literal,
+    .hljs-symbol,
+    .hljs-name {
+      color: #569CD6;
+    }
+    .hljs-link {
+      color: #569CD6;
+      text-decoration: underline;
+    }
+
+    .hljs-built_in,
+    .hljs-type {
+      color: #4EC9B0;
+    }
+
+    .hljs-number,
+    .hljs-class {
+      color: #B8D7A3;
+    }
+
+    .hljs-string,
+    .hljs-meta .hljs-string {
+      color: #D69D85;
+    }
+
+    .hljs-regexp,
+    .hljs-template-tag {
+      color: #9A5334;
+    }
+
+    .hljs-subst,
+    .hljs-function,
+    .hljs-title,
+    .hljs-params,
+    .hljs-formula {
+      color: #DCDCDC;
+    }
+
+    .hljs-comment,
+    .hljs-quote {
+      color: #57A64A;
+      font-style: italic;
+    }
+
+    .hljs-doctag {
+      color: #608B4E;
+    }
+
+    .hljs-meta,
+    .hljs-meta .hljs-keyword,
+
+    .hljs-tag {
+      color: #9B9B9B;
+    }
+
+    .hljs-variable,
+    .hljs-template-variable {
+      color: #BD63C5;
+    }
+
+    .hljs-attr,
+    .hljs-attribute {
+      color: #9CDCFE;
+    }
+
+    .hljs-section {
+      color: gold;
+    }
+
+    .hljs-emphasis {
+      font-style: italic;
+    }
+
+    .hljs-strong {
+      font-weight: bold;
+    }
+
+    /*.hljs-code {
+      font-family:'Monospace';
+    }*/
+
+    .hljs-bullet,
+    .hljs-selector-tag,
+    .hljs-selector-id,
+    .hljs-selector-class,
+    .hljs-selector-attr,
+    .hljs-selector-pseudo {
+      color: #D7BA7D;
+    }
+
+    .hljs-addition {
+      background-color: #144212;
+      display: inline-block;
+      width: 100%;
+    }
+
+    .hljs-deletion {
+      background-color: #600;
+      display: inline-block;
+      width: 100%;
+    }
 }
index d791f2a507beb9e075941240591e6003e971527d..21a07c62f0cb61599b0378823530e26e889d3349 100644 (file)
@@ -2,17 +2,37 @@
 
 <div class="container">
     <h1>Onyx Docs</h1>
+</div>
+
+<div class="container">
+    <h2>Getting Started</h2>
+    <p>
+    Install Onyx locally on your system, or use it in your browser.
+    </p>
+    <p>
+    <a class="link-button"href="/docs/install">Install</a>
+    <a class="link-button" href="/playground/">Playground</a>
+    </p>
+</div>
 
-    <ul>
-        <li><a href="/docs/install">Installation</a></li>
-        <li>Getting Started</li>
-        <li>Language Reference Book</li>
-        <li>Packages</li>
-        <ul>
-            <li><a href="https://docs.onyxlang.io/packages/core">Core packages</a></li>
-        </ul>
-    </ul>
-    
+<div class="container">
+    <h2>Language Reference</h2>
+    <p>
+    Read about the features of Onyx.
+    </p>
+    <p>
+    <a class="link-button" href="https://docs.onyxlang.io/book">Language Book</a>
+    </p>
+</div>
+
+<div class="container">
+    <h2>Package Reference</h2>
+    <p>
+        Reference material for all packages shipped with the Onyx toolchain.
+    </p>
+    <p>
+        <a class="link-button" href="https://docs.onyxlang.io/packages/core">Core packages</a>
+    </p>
 </div>
 
 {{endblock}}
index 95e01ed6d25fb0e756fe3a5f8d591fabeb162a3c..e7b0da048556a5768a1cc0e33d1ab29c784250d7 100644 (file)
@@ -3,10 +3,10 @@
 <div class="container">
     <h1>Installing Onyx</h1>
     <p>
-        <a href="#online">Online</a>
-        <a href="#linux">Linux</a>
-        <a href="#windows">Windows</a>
-        <a href="#macos">MacOS</a>
+        <a class="link-button" href="#online">Online</a>
+        <a class="link-button" href="#linux">Linux</a>
+        <a class="link-button" href="#windows">Windows</a>
+        <a class="link-button" href="#macos">MacOS</a>
     </p>
 </div>
 
 
 <div class="container" id="linux">
     <h2>Linux</h2>
-    <p>
-    </p>
+    <div>
+        <h3>From Source</h3>
+        <p>
+            The easiest way to install Onyx on a Linux system is to clone the repository from GitHub, and then compile from source.
+            This is relatively simple, since Onyx does not use any fancy things in its source tree. Only C code and shell scripts.
+
+            <ol>
+                <li>
+                    Clone the respository at <a href="https://github.com/onyx-lang/onyx">onyx-lang/onyx</a>.
+                    <pre class="hljs"><code class="language-sh">git clone https://github.com/onyx-lang/onyx --depth 1</code></pre>
+                </li>
+                <li>
+                    Navigate into the new "onyx" directory.
+                    <pre class="hljs"><code class="language-sh">cd onyx</code></pre>
+                </li>
+                <li>
+                    Configure the <code>settings.sh</code> file to suit your system needs.
+                    If everything looks good, (or if you don't know what you are looking at), you should be good to go.
+                </li>
+                <li>
+                    Run <code>./build.sh</code>.
+                    This will compile and install Onyx onto your system.
+                    By default, the "onyx" binary will be placed in "/usr/bin", and the necessary libraries/core packages/tooling will be installed at "/usr/share/onyx".
+                </li>
+                <li>
+                    Try running the "onyx help" command. You should see something like this.
+                    <pre class="hljs"><code class="language-sh">$ onyx help
+Onyx toolchain version v0.1.0
+
+The toolchain for the Onyx programming language, created by Brendan Hansen.
+
+Usage:
+       onyx &lt;subcommand&gt;
+
+Subcommands:
+       help      Shows this help message. Use "onyx help <subcommand>".
+       build     Compiles an Onyx program into an executable.
+       run       Compiles and runs an Onyx program, all at once.
+       check     Checks syntax and types of an Onyx program.
+       package   Package manager</code></pre>
+                </li>
+            </ol>
+        </p>
+
+        <h3>Future Plans</h3>
+        <p>
+            In the future, Onyx may ship a ".deb" file for Debian-based distros to easily install.
+            While this is planned, it is not a priority at the moment.
+        </p>
+    </div>
 </div>
 
-<div class="container" id="windows">
+<div class="container light" id="windows">
     <h2>Windows</h2>
     <p>
+    <ol>
+        <li>Download the latest Windows release folder from the <a>Releases</a> on GitHub.</li>
+        <li>Extract the zip file to a permanent location.</li>
+        <li>Modify system environment variables.</li>
+        <ul>
+            <li>Add the extracted folder to your system or user's PATH variable.</li>
+            <li>Make a new variable called "ONYX_PATH", and set it equal to the extracted folder path.</li>
+        </ul>
+        <li>Log out and log back in to let system environment variable update.</li>
+        <li>Open a Command Prompt or Powershell instance, and try running "onyx help".</li>
+    </ol>
     </p>
 </div>
 
index 8ca5ca974da5a905baff4eea9fc6d56a08b5ef11..40e2c4ca6272cb5d4b479f21204704f8fb11b236 100644 (file)
@@ -22,7 +22,7 @@
         </ul>
     </div>
 
-    <pre class="hljs" style="overflow-y: scroll; width: 40%; border: 2px solid black; padding: 8px; display: block"><code class="language-onyx">use core {println}
+    <pre class="hljs" style="overflow-y: scroll; width: 40%;"><code class="language-onyx">use core {println}
 
 main :: () {
     f := factorial(10);
index 3a2022a746f1d533057e73294786359c206b05d1..3ee0613e76b233da1c5a8cf2923242f2ebb43916 100644 (file)
@@ -2,15 +2,17 @@
 
 <div class="container">
     <h1>News</h1>
+</div>
 
-    <ul>
-        {{ foreach $article in $articles }}
-        <li>
-            <a href="/news/{% $article %}">{% $article %}</a>
-        </li>
-        {{ endforeach }}
-    </ul>
+{{ foreach $article in $articles }}
+<div class="container">
+    <h2><a href="/news/{% $article.path %}">{% $article.name %}</a></h2>
+    <p><em>{% $article.date %}</em></p>
+    <p>
+    {% $article.description %}
+    </p>
 </div>
+{{ endforeach }}
 
 {{endblock}}