Commit e370fdba562f83f0422f69d03c9004fc02ca884a

Thomas de Grivel 2024-10-14T20:12:30

wip test_httpd

diff --git a/README.md b/README.md
index e279df3..4641bbb 100644
--- a/README.md
+++ b/README.md
@@ -32,33 +32,10 @@ Supported architectures :
 [Join us on kmx.io Discord server !](https://discord.gg/A4MWkpUDsG)
 
 
-## Guides
-
-### [Installation](INSTALL.md)
-
-Follow the [KC3 installation guide](INSTALL.md).
-
-
-### [Tests](TESTING.md)
-
-Follow the [KC3 testing guide](TESTING.md)
-
-
-### [Usage](USAGE.md)
-
-Follow the [KC3 usage guide](USAGE.md)
-
-
-### [Structure](STRUCTURE.md)
-
-Follow the [KC3 structure guide](STRUCTURE.md)
-
-
-### [Tutorial and examples](TUTORIAL.md)
-
-Follow the [KC3 tutorial and examples guide](TUTORIAL.md) .
-
+## [Guides](https://kc3-lang.org/doc/3_Guides)
 
+Follow the [KC3 guides](https://kc3-lang.org/doc/3_Guides) to discover how to use KC3 for
+your own projects.
 
 
 ## TODO
diff --git a/doc/3_Guides/index.en.md b/doc/3_Guides/index.en.md
index 3249f6d..adc9e95 100644
--- a/doc/3_Guides/index.en.md
+++ b/doc/3_Guides/index.en.md
@@ -1,29 +1,29 @@
 # 3 KC3 Guides
 
-## 3.1 [Install](3.1_Install)
+## 3.1 [Install](/doc/3_Guides/3.1_Install)
 
 KC3 installation guide, follow these instructions carefully to install
 KC3 locally from sources.
 
 
-## 3.2 [Testing](3.2_Testing)
+## 3.2 [Testing](/doc/3_Guides/3.2_Testing)
 
 Testing that your KC3 installation is correct. The test infrastructure
 contains hundreds of thousands of test assertions each checking that
 your local version of KC3 is OK.
 
 
-## 3.3 [Usage](3.3_Usage)
+## 3.3 [Usage](/doc/3_Guides/3.3_Usage)
 
 KC3 usage. How to use KC3 in details.
 
 
-## 3.4 [Structure](3.4_Structure)
+## 3.4 [Structure](/doc/3_Guides/3.4_Structure)
 
 Details about the structure of the whole KC3 project.
 
 
-## 3.5 [Tutorial](3.5_Turorial)
+## 3.5 [Tutorial](/doc/3_Guides/3.5_Turorial)
 
 A small tutorial to guide you through using KC3 effectively for
 development.
diff --git a/httpd/fx/app/controllers/fx_controller.kc3 b/httpd/fx/app/controllers/fx_controller.kc3
index ddb4c0b..cdf6f04 100644
--- a/httpd/fx/app/controllers/fx_controller.kc3
+++ b/httpd/fx/app/controllers/fx_controller.kc3
@@ -80,22 +80,22 @@ defmodule FXController do
     end
   }
 
-  def fx_route = fn (req) {
-    if (req.method != GET &&
-        req.method != HEAD) do
+  def fx_route = fn (request) {
+    if (request.method != GET &&
+        request.method != HEAD) do
       HTTPd.error_405_page(req)
     else
-      if (req.url == "/fx" ||
-          Str.starts_with?(req.url, "/fx/")) do
+      if (request.url == "/fx" ||
+          Str.starts_with?(request.url, "/fx/")) do
         path = "." + req.url
-        response = show_file(path)
+        response = show_file(path, request.url)
         if (response) do
           response
         else
-          HTTPd.error_404_page(req)
+          HTTPd.error_404_page(request)
         end
       else
-        HTTPd.error_404_page(req)
+        HTTPd.error_404_page(request)
       end
     end
   }
diff --git a/test/httpd/app/controllers/doc_controller.kc3 b/test/httpd/app/controllers/doc_controller.kc3
index f9d29fd..7dc9c4f 100644
--- a/test/httpd/app/controllers/doc_controller.kc3
+++ b/test/httpd/app/controllers/doc_controller.kc3
@@ -59,24 +59,24 @@ defmodule DocController do
     }
   }
 
-  def show_html = fn (path_html) {
+  def show_html = fn (path_html, url) {
     index = doc_index("./doc/", path_html)
     menu = DocView.render_menu(index)
     title = "kc3-lang.org"
     html = File.read_all(path_html)
     page = DocView.render_show(menu, html)
-    body = LayoutView.render(title, page)
+    body = LayoutView.render(title, page, url)
     %HTTP.Response{body: body}
   }
 
-  def show_md = fn (path_md) {
+  def show_md = fn (path_md, url) {
     index = doc_index("./doc/", path_md)
     menu = DocView.render_menu(index)
     title = "kc3-lang.org"
     md = File.read_all(path_md)
     html = Markdown.to_html_str(md)
     page = DocView.render_show(menu, html)
-    body = LayoutView.render(title, page)
+    body = LayoutView.render(title, page, url)
     %HTTP.Response{body: body}
   }
 
@@ -86,15 +86,15 @@ defmodule DocController do
       locale = "en"
       path_html = ".#{request.url}/index.#{locale}.html"
       if File.exists?(path_html) do
-        show_html(path_html)
+        show_html(path_html, request.url)
       else
         path_md = ".#{request.url}/index.#{locale}.md"
         if File.exists?(path_md) do
-          show_md(path_md)
+          show_md(path_md, request.url)
         else
           path_md = ".#{request.url}.#{locale}.md"
           if File.exists?(path_md) do
-            show_md(path_md)
+            show_md(path_md, request.url)
           else
             HTTPd.error_404_page(request)
           end
diff --git a/test/httpd/app/views/layout_view.kc3 b/test/httpd/app/views/layout_view.kc3
index 8c76e11..5a97273 100644
--- a/test/httpd/app/views/layout_view.kc3
+++ b/test/httpd/app/views/layout_view.kc3
@@ -8,9 +8,8 @@ defmodule LayoutView do
 
   def footer = EKC3.render(template_footer)
 
-  def nav = EKC3.render(template_nav)
-
-  def render = fn (title, page) {
+  def render = fn (title, page, url) {
+    nav = EKC3.render(template_nav)
     EKC3.render(template)
   }