From 311870683ed28b78561f4ea765afedba4c074c98 Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Tue, 16 Dec 2025 21:31:53 -0500 Subject: [PATCH] fixes --- index.html | 95 +++++++++++++++++++++++++++++++++++++++++++- src/server/server.go | 6 +-- 2 files changed, 97 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index d079f8f..43212e1 100644 --- a/index.html +++ b/index.html @@ -267,6 +267,10 @@ footer { :custom() Add a custom string to the site body + + markdown_to_html(str: string) + Returns generated HTML from provided Markdown string. +

Std

@@ -490,10 +494,99 @@ footer { +

Bus

+ + + + + + + + + + + + + + + + +
NameDescription
bus.urlThe current url that was given.
bus.paramsA table of url parameters if any. Ex: ?foo=bar*baz=foobar
+

Site

+ + + + + + + + + + + + + + + + + + + + +
NameDescription
site.versionThe version of the website found in the Fes.toml
site.nameThe name of the website found in the Fes.toml
site.authorsA table of all authors defined in Fes.toml
+

App

+ Fes's app module is a special table + because it contains user defined functions. These + functions are defined in the include/ For + example if you define a include/hello.lua + file with given contents:
local hello = {}
+
+hello.render(std) return std.h1("Hello, World!") end
+
+return hello
This can be called from another with, + fes.app.hello.render(fes.std). Do with this + as you will. +

Speical Directories

+ + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
www/The main website is + contained here, this is + where www/index.lua + lives.
static/All static content should + be placed here and can + be accessed at + /static/path-to-file.
include/Contains lua files that are + preloaded and globally + accessible.
archive/Files here can be viewed in + a file browser like + format at + /archive/path-to-dir.
diff --git a/src/server/server.go b/src/server/server.go index bab51c5..97823cc 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -136,7 +136,7 @@ func loadIncludeModules(L *lua.LState, includeDir string) *lua.LTable { return app } -func loadLua(luaDir string, entry string, cfg *config.MyConfig, requestData reqData) ([]byte, error) { +func loadLua(entry string, cfg *config.MyConfig, requestData reqData) ([]byte, error) { L := lua.NewState() defer L.Close() @@ -380,7 +380,7 @@ func Start(dir string) error { `) if _, err := os.Stat(filepath.Join("www", "404.lua")); err == nil { - if nf, err := loadLua(dir, "www/404.lua", &cfg, reqData{}); err == nil { + if nf, err := loadLua("www/404.lua", &cfg, reqData{}); err == nil { notFoundData = nf } } else if _, err := os.Stat("www/404.html"); err == nil { @@ -444,7 +444,7 @@ func Start(dir string) error { var data []byte if strings.HasSuffix(route, ".lua") { - data, err = loadLua(dir, route, &cfg, reqData{path: r.URL.Path, params: params}) + data, err = loadLua(route, &cfg, reqData{path: r.URL.Path, params: params}) } else if strings.HasSuffix(route, ".md") { data, err = os.ReadFile(route) data = []byte(markdownToHTML(string(data)))