From: Brendan Hansen Date: Fri, 24 Mar 2023 04:21:44 +0000 (-0500) Subject: added: documentation pages started X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=a24930f6e95a5e88f22636504010cda743be52a7;p=onyxlang.io.git added: documentation pages started --- diff --git a/onyx-pkg.ini b/onyx-pkg.ini index 388de1a..3d256dd 100644 --- a/onyx-pkg.ini +++ b/onyx-pkg.ini @@ -17,9 +17,9 @@ build_cmd= library= [dependencies] -git://onyxlang.io/repo/http-server=0.1.12 -git://onyxlang.io/repo/postgres-orm=0.0.20 -git://onyxlang.io/repo/otmp=0.0.4 +git://onyxlang.io/repo/http-server=0.1.19 +git://onyxlang.io/repo/postgres-orm=0.0.24 +git://onyxlang.io/repo/otmp=0.0.6 [dependency_folders] git://onyxlang.io/repo/http-server=http-server diff --git a/src/app.onyx b/src/app.onyx index 494c1f2..5038434 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -4,36 +4,41 @@ } use core -use http {Req :: Request, Res :: Response} +use http.server {Req :: Request, Res :: Response, route} reg: otmp.TemplateRegistry; -#inject http.Response { - render :: (r: ^http.Response, template: str, vars: any) { - s := reg->render_template(template, ^r.writer, .{ vars.data, vars.type }); +#inject Res { + render :: (r: &Res, template: str, vars: any) { + s := reg->render_template(template, &r.writer, .{ vars.data, vars.type }); r->status(200 if s == .None else 400); r->end(); } } -@http.route.{.GET, "/"} -(req: ^Req, res: ^Res) { - res->render("homepage", null); +@route.{.GET, "/"} +(req: &Req, res: &Res) { + res->render("pages/homepage", null); } -@http.route.{.GET, "/docs"} -(req: ^Req, res: ^Res) { - res->render("docs", null); +@route.{.GET, "/docs"} +(req: &Req, res: &Res) { + res->render("pages/docs", null); } -@http.route.{.GET, "/news"} -(req: ^Req, res: ^Res) { +@route.{.GET, "/docs/install"} +(req: &Req, res: &Res) { + res->render("pages/docs/install", null); +} + +@route.{.GET, "/news"} +(req: &Req, res: &Res) { if a := req.query->get_opt("a"); a { filename := tprintf("www/news-articles/{}.html", a.value); if os.file_exists(filename) { article := os.get_contents(filename); - defer delete(^article); + defer delete(&article); - res->render("news_article", ^.{ + res->render("pages/news_article", &.{ article = article }); } @@ -42,13 +47,13 @@ reg: otmp.TemplateRegistry; articles := make([..] str); for os.list_directory("www/news-articles") { - name := it->name(); + name := it->name(); if string.ends_with(name, ".html") { articles << string.temp_copy(name[0 .. name.length-5]); } } - res->render("news", ^.{ + res->render("pages/news", &.{ articles = articles }); } @@ -58,12 +63,12 @@ main :: () { reg = otmp.registry(); reg->load_directory("./www/templates", ".html"); - app := http.application(); + app := http.server.application(); - http.set_mime_type("svg", "image/svg+xml"); + http.server.set_mime_type("svg", "image/svg+xml"); - files := http.static("/static/", "./www/static/"); - app->pipe(^files); + files := http.server.static("/static/", "./www/static/"); + app->pipe(&files); #if #defined(runtime.vars.Debug) { app->pipe((req, res) => { @@ -71,18 +76,18 @@ main :: () { }); } - router := http.router(); + router := http.server.router(); router->collect_routes(); - app->pipe(^router); + app->pipe(&router); app->pipe((req, res) => { if !res.completed { - res->render("404", null); + res->render("pages/404", null); } }); - logger := http.logger(); - app->pipe(^logger); + logger := http.server.logger(); + app->pipe(&logger); app->serve(8080); println("Server stopping..."); diff --git a/www/static/css/new_style.css b/www/static/css/new_style.css index 4ee63a8..5d9af00 100644 --- a/www/static/css/new_style.css +++ b/www/static/css/new_style.css @@ -167,11 +167,23 @@ navbar a { flex-direction: row; justify-content: space-between; width: 100%; + gap: 24px; } .panel-container div { flex-basis: 0; - min-width: 200px; - padding: 6px 0; - /* background-color: var(--background-color); */ -} \ No newline at end of file + flex-grow: 1; + + padding: 12px 0; +/* background-color: var(--background-color);*/ +} + +.panel-container div h3 { + margin-bottom: 4px; +} + +.panel-container div p { + width: 100%; + text-align: justify; +} + diff --git a/www/static/images/logo.svg b/www/static/images/logo.svg index 93c70a6..e59d5b9 100644 --- a/www/static/images/logo.svg +++ b/www/static/images/logo.svg @@ -2,12 +2,12 @@ + units="px" + width="49px" /> + id="defs2"> + + + + + + + + + + style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.0293746" + d="M 11.763289,3.914572 1.3881028,9.8522703 a 0.10746311,0.10746311 90.000426 0 0 -1.4e-6,0.1865377 l 4.9883072,2.854897 A 0.32624697,0.32624697 164.99998 0 0 6.8203814,12.774742 L 11.900221,4.0525466 A 0.10062399,0.10062399 45.217132 0 0 11.763289,3.914572 Z" + inkscape:path-effect="#path-effect1196" + inkscape:original-d="M 12.089211,3.7280473 1.2251325,9.9455378 6.6574279,13.054537 Z" /> + style="fill:#333333;fill-rule:evenodd;stroke-width:0.029419" + d="M 12.162827,4.0018649 6.9729475,12.886067 a 0.0504192,0.0504192 45.290639 0 0 0.068524,0.06922 l 5.1227994,-2.923284 a 0.32119605,0.32119605 120.14455 0 0 0.162004,-0.2789709 l 0,-5.7069276 a 0.08771164,0.08771164 15.146085 0 0 -0.163448,-0.044243 z" + inkscape:path-effect="#path-effect1236" + inkscape:original-d="M 12.326275,3.7220702 6.8780241,13.04856 12.326275,9.9395598 Z" /> + style="fill:#999999;fill-rule:evenodd;stroke-width:0.0295315" + d="m 1.0890783,3.6985577 v 5.6525366 a 0.22068576,0.22068576 30.240095 0 0 0.329423,0.1920375 L 11.783187,3.6743435 a 0.08679074,0.08679074 75.240095 0 0 -0.04276,-0.1623148 l -10.4648157,0 a 0.18652896,0.18652896 135 0 0 -0.186529,0.186529 z" + inkscape:path-effect="#path-effect1194" + inkscape:original-d="M 1.0890783,3.5120287 V 9.7296608 L 12.069846,3.5120287 Z" /> + style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.029571" + d="M 6.4864206,0.28046515 1.4340775,3.1336232 a 0.08682156,0.08682156 75.272862 0 0 0.042693,0.1624213 H 11.967016 a 0.04985456,0.04985456 104.72714 0 0 0.02452,-0.093265 L 6.8167272,0.28046515 a 0.33586257,0.33586257 6.6844583e-7 0 0 -0.3303066,0 z" + inkscape:path-effect="#path-effect1192" + inkscape:original-d="M 6.6515739,0.18719981 1.1464635,3.2960445 H 12.156684 Z" /> + diff --git a/www/templates/pages/404.html b/www/templates/pages/404.html index d5ed672..0d5307b 100644 --- a/www/templates/pages/404.html +++ b/www/templates/pages/404.html @@ -1,15 +1,15 @@ {{block "content"}} -{% partial "navbar" %} +{% partial "partials/navbar" %}

404 - Page not found

- {% partial "footer" %} + {% partial "partials/footer" %}
{{endblock}} -{{extends "base"}} \ No newline at end of file +{{extends "pages/base"}} diff --git a/www/templates/pages/docs.html b/www/templates/pages/docs.html index 9addbe8..2282374 100644 --- a/www/templates/pages/docs.html +++ b/www/templates/pages/docs.html @@ -1,11 +1,18 @@ -{{block "content"}} +{{block "page_content"}} -{% partial "navbar" %} +
+

Onyx Docs

-
- {% partial "footer" %} -
+ + +
{{endblock}} -{{extends "base"}} \ No newline at end of file +{{extends "pages/normal_page"}} + diff --git a/www/templates/pages/docs/getting_started.html b/www/templates/pages/docs/getting_started.html new file mode 100644 index 0000000..e69de29 diff --git a/www/templates/pages/docs/install.html b/www/templates/pages/docs/install.html new file mode 100644 index 0000000..cf3233b --- /dev/null +++ b/www/templates/pages/docs/install.html @@ -0,0 +1,30 @@ +{{ block "page_content" }} + +
+

Installing Onyx

+
+ +
+

Try Online

+

+ Onyx is available to try online for free in Onyx Playground. + It allows you learn the syntax from examples, without installing the language. +

+
+ +
+

Linux

+
+ +
+

Windows

+
+ +
+

MacOS

+
+ + +{{ endblock }} + +{{ extends "pages/normal_page" }} diff --git a/www/templates/pages/docs/reference.html b/www/templates/pages/docs/reference.html new file mode 100644 index 0000000..e69de29 diff --git a/www/templates/pages/homepage.html b/www/templates/pages/homepage.html index e55aa55..2738a2a 100644 --- a/www/templates/pages/homepage.html +++ b/www/templates/pages/homepage.html @@ -1,31 +1,28 @@ -{{block "content"}} - -{% partial "navbar" %} +{{block "page_content"}}

The Onyx Programming Language

-

Onyx is a data-oriented, safe, and modern programming language for application development.

+

Onyx is a data-oriented, safe, and modern programming language for application development

-
-
-
-
-

Overview

-
- -
    -
  • Runs everywhere using WebAssembly
  • -
  • Fast compilation times (300,000+ lines / second)
  • -
  • Self-hosted, debuggable runtime using OVM-Wasm
  • -
  • Secure runtime using Wasmer
  • -
-
+
+
+
+

Overview

+
+ +
    +
  • Runs everywhere using WebAssembly
  • +
  • Fast compilation times (300,000+ lines / second)
  • +
  • Self-hosted, debuggable runtime using OVM-Wasm
  • +
  • Secure runtime using Wasmer
  • +
+
-
use core
+    
use core
 
 main :: () {
     f := factorial(10);
@@ -39,69 +36,70 @@ factorial :: (n: i32) -> i32 {
 }
 
-
-
+
+
+ +
+

Features

-
-

Features

- -
-
-

Portable

-
-
-

Simple

-
-
-

Extensible

-
-
-

Fun

-
+
+
+

Portable

+

By targetting WASM, Onyx can used in the browser, or natively with a custom runtime.

+
+
+

Data-Oriented

+

Ditch complicated classes and inheritance. Just focus on modeling the data for your application.

+
+
+

Extensible

+

With a C binding generation library, a useful C library is just one-step away.

+
+
+

Fun and Safe

+

Onyx enables programmer expressiveness, while making it easy to write bug-free code.

+
- {% partial "footer" %} -
- {{endblock}} -{{extends "base"}} +{{extends "pages/normal_page"}} diff --git a/www/templates/pages/news.html b/www/templates/pages/news.html index f16282a..a715cdd 100644 --- a/www/templates/pages/news.html +++ b/www/templates/pages/news.html @@ -1,23 +1,17 @@ -{{block "content"}} +{{block "page_content"}} -{% partial "navbar" %} +
+

News

-
-
-

News

- -
    - {{ foreach $article in $articles }} -
  • - {% $article %} -
  • - {{ endforeach }} -
-
- - {% partial "footer" %} -
+
    + {{ foreach $article in $articles }} +
  • + {% $article %} +
  • + {{ endforeach }} +
+
{{endblock}} -{{extends "base"}} \ No newline at end of file +{{extends "pages/normal_page"}} diff --git a/www/templates/pages/news_article.html b/www/templates/pages/news_article.html index ac5d491..e4c63d0 100644 --- a/www/templates/pages/news_article.html +++ b/www/templates/pages/news_article.html @@ -1,15 +1,15 @@ {{block "content"}} -{% partial "navbar" %} +{% partial "partials/navbar" %}
{% $article %}
- {% partial "footer" %} + {% partial "partials/footer" %}
{{endblock}} -{{extends "base"}} \ No newline at end of file +{{extends "pages/base"}} diff --git a/www/templates/pages/normal_page.html b/www/templates/pages/normal_page.html new file mode 100644 index 0000000..076e684 --- /dev/null +++ b/www/templates/pages/normal_page.html @@ -0,0 +1,12 @@ +{{block "content"}} + +
+{% partial "partials/navbar" %} +{% block "page_content" %} +{% partial "partials/footer" %} +
+ +{{endblock}} + +{{extends "pages/base"}} + diff --git a/www/templates/partials/navbar.html b/www/templates/partials/navbar.html index 146d78e..692ea43 100644 --- a/www/templates/partials/navbar.html +++ b/www/templates/partials/navbar.html @@ -1,7 +1,9 @@