From 1c229f1b3e0e4c160292360807879ba97ce73a3e Mon Sep 17 00:00:00 2001 From: vx-clutch Date: Sun, 28 Dec 2025 20:17:46 -0500 Subject: [PATCH] update examples --- examples/advanced/Fes.toml | 5 ---- examples/advanced/include/foo.lua | 7 ------ examples/advanced/www/index.lua | 15 ------------ examples/archive/README.md | 4 +++ .../archive/archive/{2025.12.07 => }/seal.png | Bin examples/archive/www/index.lua | 9 +------ .../{hello-with-docker/app => best}/Fes.toml | 2 +- examples/best/README.md | 23 ++++++++++++++++++ examples/best/include/footer.lua | 13 ++++++++++ examples/best/include/header.lua | 7 ++++++ examples/best/static/favicon.ico | Bin 0 -> 1406 bytes examples/best/www/index.lua | 20 +++++++++++++++ examples/default/www/index.lua | 4 +-- examples/error/README.md | 6 +++++ examples/error/www/index.lua | 4 +++ examples/hello-with-docker/app/www/index.lua | 8 ------ examples/hello-with-docker/docker-compose.yml | 7 ------ examples/hello/README.md | 4 +++ examples/markdown/README.md | 3 +++ examples/markdown/www/index.md | 4 ++- examples/simple/README.md | 5 ++++ 21 files changed, 96 insertions(+), 54 deletions(-) delete mode 100644 examples/advanced/Fes.toml delete mode 100644 examples/advanced/include/foo.lua delete mode 100644 examples/advanced/www/index.lua create mode 100644 examples/archive/README.md rename examples/archive/archive/{2025.12.07 => }/seal.png (100%) rename examples/{hello-with-docker/app => best}/Fes.toml (76%) create mode 100644 examples/best/README.md create mode 100644 examples/best/include/footer.lua create mode 100644 examples/best/include/header.lua create mode 100644 examples/best/static/favicon.ico create mode 100644 examples/best/www/index.lua create mode 100644 examples/error/README.md delete mode 100644 examples/hello-with-docker/app/www/index.lua delete mode 100644 examples/hello-with-docker/docker-compose.yml create mode 100644 examples/hello/README.md create mode 100644 examples/markdown/README.md create mode 100644 examples/simple/README.md diff --git a/examples/advanced/Fes.toml b/examples/advanced/Fes.toml deleted file mode 100644 index 65bc6af..0000000 --- a/examples/advanced/Fes.toml +++ /dev/null @@ -1,5 +0,0 @@ -[app] - -name = "advanced" -version = "0.0.1" -authors = ["vx-clutch"] \ No newline at end of file diff --git a/examples/advanced/include/foo.lua b/examples/advanced/include/foo.lua deleted file mode 100644 index ee67099..0000000 --- a/examples/advanced/include/foo.lua +++ /dev/null @@ -1,7 +0,0 @@ -local foo = {} - -foo.render = function() - return "This was called from a foo function" -end - -return foo diff --git a/examples/advanced/www/index.lua b/examples/advanced/www/index.lua deleted file mode 100644 index 6e98178..0000000 --- a/examples/advanced/www/index.lua +++ /dev/null @@ -1,15 +0,0 @@ -local fes = require("fes") -local std = fes.std - - -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -site:h1("Hello, World!") - -site:note( - fes.app.foo.render() -) - -return site diff --git a/examples/archive/README.md b/examples/archive/README.md new file mode 100644 index 0000000..0b7aab4 --- /dev/null +++ b/examples/archive/README.md @@ -0,0 +1,4 @@ +# archive + +This example demonstrates the archive feature of Fes it is useful for file +sharing purposes. diff --git a/examples/archive/archive/2025.12.07/seal.png b/examples/archive/archive/seal.png similarity index 100% rename from examples/archive/archive/2025.12.07/seal.png rename to examples/archive/archive/seal.png diff --git a/examples/archive/www/index.lua b/examples/archive/www/index.lua index 5353bc7..6a96cd7 100644 --- a/examples/archive/www/index.lua +++ b/examples/archive/www/index.lua @@ -1,17 +1,10 @@ local fes = require("fes") -local std = fes.std - local site = fes.fes() site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") site:h1("Hello, World!") -site:note(fes.util.cc { - std.h2("Files"), - std.ul { - std.a("/archive", "to the file room!"), - } -}) +site:a("/archive", fes.std.h2("To the file room!")) return site diff --git a/examples/hello-with-docker/app/Fes.toml b/examples/best/Fes.toml similarity index 76% rename from examples/hello-with-docker/app/Fes.toml rename to examples/best/Fes.toml index 31606c1..38a5e3d 100644 --- a/examples/hello-with-docker/app/Fes.toml +++ b/examples/best/Fes.toml @@ -1,5 +1,5 @@ [app] -name = "hello" +name = "best" version = "0.0.1" authors = ["vx-clutch"] \ No newline at end of file diff --git a/examples/best/README.md b/examples/best/README.md new file mode 100644 index 0000000..93a79a3 --- /dev/null +++ b/examples/best/README.md @@ -0,0 +1,23 @@ +# best + +This is an example of best practices for the Fes framework. + +## Parts + +With best practice we can break our sites into a few parts. + +## Index + +The main page of the site loads in the header and the footer, as well as shows +some core information + +## Include + +Within include the header and footer are defined. + +* **Header:** Site navigation and name display +* **Footer:** Extra and external information. + +## Static + +This is where we store our favicon. diff --git a/examples/best/include/footer.lua b/examples/best/include/footer.lua new file mode 100644 index 0000000..cfd0ed9 --- /dev/null +++ b/examples/best/include/footer.lua @@ -0,0 +1,13 @@ +local footer = {} + +footer.render = function(std) + return table.concat({ + std.h2("Other resources"), + std.tl({ + std.external("https://git.vxserver.dev/fSD/fes", "Fes source"), + std.external("https://docs.vxserver.dev/static/fes.html", "Documentation"), + }), +}) +end + +return footer diff --git a/examples/best/include/header.lua b/examples/best/include/header.lua new file mode 100644 index 0000000..4a60a1e --- /dev/null +++ b/examples/best/include/header.lua @@ -0,0 +1,7 @@ +local header = {} + +header.render = function(std) + return std.center(std.ha("/", std.h1("Best Practices"))) +end + +return header diff --git a/examples/best/static/favicon.ico b/examples/best/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9db4ded6129ab8a7f6070aef7934e5abcd7937a6 GIT binary patch literal 1406 zcmeH{Ur5tY6vscC`6pAisoAtYYN<_Y{j-|0Ej4RubFEs|rp{%y(gzFrLy{$F_7X@C z;`AY3dhJajN`n|8fe$@}m@Eq4=4exC&6=~{w8VVw(R2CUb3f-?&cnIf10rEbr3iZr zjggQ7C8VAO!^l zj0`);&CNw*|4e&(JLBWy3=R$=m&+L&8>7Cyp4r)1l4?gtzVF9ovmqJ?B2&Mludk2R z)>c&S=dfC>(Ca4@3c*7!4u=D;*GpuRi<=-D)t)i$JE z9;8oxFf}zL)bP^T*$FS^Fjg8+tJMSo0XjN5aP;;NRr;2=xHv{fM@cQe#n8|Y*|&$$ z>2#zN-=M$0AHUy^N~J=fP!L_`LR|L|lgUKF<8O3zbs@4%kdu=`TU#4a(;Fm@JV@HT z%*@P?pPx@wRu+?!lQcIsV>B9BSXjX4^KrN3ItGJ*`T2PgdVeC5$q{vDUgh3K9aiA1vE;nt389r&*uD5y9g77A_(j}5^x z8#B`rN*fODDYK=8@xZ=aSF+UV$Xuo2xWLg{>r-S9yCAyNT*s4Q?O*LB<^PIbsQDxbYR3l7)McZcHXen8zKejxcBJ5XX zg*E0sX^7gbt=znR86m%}Ix&6)$EnU_=l#QZ7f!F>@}nm=ELRW5<<{h-^w$sYE&?9> X(HFu0l`k5?3JBjXkPg9B3KhX`3~0$B literal 0 HcmV?d00001 diff --git a/examples/best/www/index.lua b/examples/best/www/index.lua new file mode 100644 index 0000000..96af136 --- /dev/null +++ b/examples/best/www/index.lua @@ -0,0 +1,20 @@ +local fes = require("fes") +local std = fes.std +local u = fes.util + +local site = fes.fes() + +site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") +site.title = "Best practices" +site.favicon = "/static/favicon.ico" + +site:banner(fes.app.header.render(std)) + +site:note(u.cc { + std.h2("Hello, World!"), + std.p("This is an example of the best practices/canonical Fes site.") +}) + +site:note(fes.app.footer.render(std)) + +return site diff --git a/examples/default/www/index.lua b/examples/default/www/index.lua index d369c0e..12a2a55 100644 --- a/examples/default/www/index.lua +++ b/examples/default/www/index.lua @@ -1,8 +1,8 @@ local fes = require("fes") local site = fes.fes() --- site.copyright = fes.util.copyright("https://example.com", "vx-clutch") +site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") site:h1("Hello, World!") -return site \ No newline at end of file +return site diff --git a/examples/error/README.md b/examples/error/README.md new file mode 100644 index 0000000..c11361a --- /dev/null +++ b/examples/error/README.md @@ -0,0 +1,6 @@ +# error + +This shows what a Lua error looks like to the user. Lua errors are the most +common and the most critical so that is why they are shown to the user. Other, +lesser errors, are only shown to the developer because of their different +nature. diff --git a/examples/error/www/index.lua b/examples/error/www/index.lua index 79ec327..77aaecf 100644 --- a/examples/error/www/index.lua +++ b/examples/error/www/index.lua @@ -1,6 +1,10 @@ local fes = require("fes") local site = fes.fes() +site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") + This is what an error looks like +site:h1("Hello, World!") + return site diff --git a/examples/hello-with-docker/app/www/index.lua b/examples/hello-with-docker/app/www/index.lua deleted file mode 100644 index 12a2a55..0000000 --- a/examples/hello-with-docker/app/www/index.lua +++ /dev/null @@ -1,8 +0,0 @@ -local fes = require("fes") -local site = fes.fes() - -site.copyright = fes.util.copyright("https://fsd.vxserver.dev", "fSD") - -site:h1("Hello, World!") - -return site diff --git a/examples/hello-with-docker/docker-compose.yml b/examples/hello-with-docker/docker-compose.yml deleted file mode 100644 index 8ad387a..0000000 --- a/examples/hello-with-docker/docker-compose.yml +++ /dev/null @@ -1,7 +0,0 @@ -services: - hello: - image: git.vxserver.dev/fsd/fes:latest - ports: - - "3000:3000" - volumes: - - ./app:/app diff --git a/examples/hello/README.md b/examples/hello/README.md new file mode 100644 index 0000000..fd8567d --- /dev/null +++ b/examples/hello/README.md @@ -0,0 +1,4 @@ +# hello + +This is a very simple hello world program, the only difference between this and +default is this README. diff --git a/examples/markdown/README.md b/examples/markdown/README.md new file mode 100644 index 0000000..98d5834 --- /dev/null +++ b/examples/markdown/README.md @@ -0,0 +1,3 @@ +# markdown + +This example demonstrate Fes's ability to handle markdown routes. diff --git a/examples/markdown/www/index.md b/examples/markdown/www/index.md index ba4fcdf..846dbbd 100644 --- a/examples/markdown/www/index.md +++ b/examples/markdown/www/index.md @@ -1 +1,3 @@ -# Hello, World! +# Markdown! + +**Fes** also supports markdown routes! diff --git a/examples/simple/README.md b/examples/simple/README.md new file mode 100644 index 0000000..70e9d20 --- /dev/null +++ b/examples/simple/README.md @@ -0,0 +1,5 @@ +# simple + +This simple example shows the extensibility of the Fes framework. It shows the +you do not necessarily need to use the site object (although it is recommended) +you can define your own site, similar to how Lisps do things.